summaryrefslogtreecommitdiff
path: root/tests/control-flow/bug761267-2.c-expected
blob: 14476bde57f8a5abc789dceb48d7e2820d593225 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
/* control_flow_bug761267_2.c generated by valac, the Vala compiler
 * generated from control_flow_bug761267_2.vala, do not modify */

#include <glib.h>
#include <glib-object.h>
#include <gobject/gvaluecollector.h>
#include <string.h>

#if !defined(VALA_EXTERN)
#if defined(_MSC_VER)
#define VALA_EXTERN __declspec(dllexport) extern
#elif __GNUC__ >= 4
#define VALA_EXTERN __attribute__((visibility("default"))) extern
#else
#define VALA_EXTERN extern
#endif
#endif

typedef struct _Bar Bar;

#define TYPE_FOO (foo_get_type ())
#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))

typedef struct _Foo Foo;
typedef struct _FooClass FooClass;
typedef struct _FooPrivate FooPrivate;
#define _bar_free0(var) ((var == NULL) ? NULL : (var = (bar_free (var), NULL)))
typedef struct _ParamSpecFoo ParamSpecFoo;
#define _g_free0(var) ((var == NULL) ? NULL : (var = (g_free (var), NULL)))
#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; }
#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);

struct _Bar {
	gint k;
};

struct _Foo {
	GTypeInstance parent_instance;
	volatile int ref_count;
	FooPrivate * priv;
	gint i;
	Bar* b;
};

struct _FooClass {
	GTypeClass parent_class;
	void (*finalize) (Foo *self);
};

struct _FooPrivate {
	gint _j;
};

struct _ParamSpecFoo {
	GParamSpec parent_instance;
};

static gint Foo_private_offset;
static gpointer foo_parent_class = NULL;

VALA_EXTERN void bar_free (Bar * self);
G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, bar_free)
static void bar_instance_init (Bar * self);
VALA_EXTERN Bar* bar_new (void);
VALA_EXTERN gpointer foo_ref (gpointer instance);
VALA_EXTERN void foo_unref (gpointer instance);
VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
                            const gchar* nick,
                            const gchar* blurb,
                            GType object_type,
                            GParamFlags flags);
VALA_EXTERN void value_set_foo (GValue* value,
                    gpointer v_object);
VALA_EXTERN void value_take_foo (GValue* value,
                     gpointer v_object);
VALA_EXTERN gpointer value_get_foo (const GValue* value);
VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
VALA_EXTERN gint foo_foo (Foo* self);
VALA_EXTERN Bar* foo_bar (Foo* self);
VALA_EXTERN Bar** foo_bars (Foo* self,
                gint n,
                gint* result_length1);
VALA_EXTERN gint* foo_seq (Foo* self,
               gint n,
               gint* result_length1);
VALA_EXTERN Foo* foo_new (void);
VALA_EXTERN Foo* foo_construct (GType object_type);
VALA_EXTERN gint foo_get_j (Foo* self);
VALA_EXTERN void foo_set_j (Foo* self,
                gint value);
static void foo_finalize (Foo * obj);
static GType foo_get_type_once (void);
VALA_EXTERN void bar (Foo* f);
static gint* _int_dup (gint* self);
static gint* _vala_array_dup1 (gint* self,
                        gssize length);
VALA_EXTERN void baz (Foo* f);
static gboolean _int_equal (const gint * s1,
                     const gint * s2);
static gint* _vala_array_dup2 (gint* self,
                        gssize length);
static void _vala_main (void);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

Bar*
bar_new (void)
{
	Bar* self;
	self = g_slice_new0 (Bar);
	bar_instance_init (self);
	return self;
}

static void
bar_instance_init (Bar * self)
{
	self->k = 17;
}

void
bar_free (Bar * self)
{
	g_slice_free (Bar, self);
}

static inline gpointer
foo_get_instance_private (Foo* self)
{
	return G_STRUCT_MEMBER_P (self, Foo_private_offset);
}

gint
foo_foo (Foo* self)
{
	gint result;
	g_return_val_if_fail (IS_FOO (self), 0);
	result = self->i;
	return result;
}

Bar*
foo_bar (Foo* self)
{
	Bar* _tmp0_;
	Bar* result;
	g_return_val_if_fail (IS_FOO (self), NULL);
	_tmp0_ = bar_new ();
	result = _tmp0_;
	return result;
}

Bar**
foo_bars (Foo* self,
          gint n,
          gint* result_length1)
{
	Bar** a = NULL;
	Bar** _tmp0_;
	gint a_length1;
	gint _a_size_;
	Bar** _tmp5_;
	gint _tmp5__length1;
	Bar** result;
	g_return_val_if_fail (IS_FOO (self), NULL);
	_tmp0_ = g_new0 (Bar*, n + 1);
	a = _tmp0_;
	a_length1 = n;
	_a_size_ = a_length1;
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp1_ = FALSE;
			_tmp1_ = TRUE;
			while (TRUE) {
				Bar** _tmp3_;
				gint _tmp3__length1;
				Bar* _tmp4_ = NULL;
				if (!_tmp1_) {
					gint _tmp2_;
					_tmp2_ = i;
					i = _tmp2_ + 1;
				}
				_tmp1_ = FALSE;
				if (!(i < n)) {
					break;
				}
				_tmp3_ = a;
				_tmp3__length1 = a_length1;
				_tmp4_ = bar_new ();
				_tmp4_->k = i;
				_bar_free0 (_tmp3_[i]);
				_tmp3_[i] = _tmp4_;
			}
		}
	}
	_tmp5_ = a;
	_tmp5__length1 = a_length1;
	if (result_length1) {
		*result_length1 = _tmp5__length1;
	}
	result = _tmp5_;
	return result;
}

gint*
foo_seq (Foo* self,
         gint n,
         gint* result_length1)
{
	gint* a = NULL;
	gint* _tmp0_;
	gint a_length1;
	gint _a_size_;
	gint* _tmp4_;
	gint _tmp4__length1;
	gint* result;
	g_return_val_if_fail (IS_FOO (self), NULL);
	_tmp0_ = g_new0 (gint, n);
	a = _tmp0_;
	a_length1 = n;
	_a_size_ = a_length1;
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp1_ = FALSE;
			_tmp1_ = TRUE;
			while (TRUE) {
				gint* _tmp3_;
				gint _tmp3__length1;
				if (!_tmp1_) {
					gint _tmp2_;
					_tmp2_ = i;
					i = _tmp2_ + 1;
				}
				_tmp1_ = FALSE;
				if (!(i < n)) {
					break;
				}
				_tmp3_ = a;
				_tmp3__length1 = a_length1;
				_tmp3_[i] = i;
			}
		}
	}
	_tmp4_ = a;
	_tmp4__length1 = a_length1;
	if (result_length1) {
		*result_length1 = _tmp4__length1;
	}
	result = _tmp4_;
	return result;
}

Foo*
foo_construct (GType object_type)
{
	Foo* self = NULL;
	self = (Foo*) g_type_create_instance (object_type);
	return self;
}

Foo*
foo_new (void)
{
	return foo_construct (TYPE_FOO);
}

gint
foo_get_j (Foo* self)
{
	gint result;
	g_return_val_if_fail (IS_FOO (self), 0);
	result = self->priv->_j;
	return result;
}

void
foo_set_j (Foo* self,
           gint value)
{
	g_return_if_fail (IS_FOO (self));
	self->priv->_j = value;
}

static void
value_foo_init (GValue* value)
{
	value->data[0].v_pointer = NULL;
}

static void
value_foo_free_value (GValue* value)
{
	if (value->data[0].v_pointer) {
		foo_unref (value->data[0].v_pointer);
	}
}

static void
value_foo_copy_value (const GValue* src_value,
                      GValue* dest_value)
{
	if (src_value->data[0].v_pointer) {
		dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
	} else {
		dest_value->data[0].v_pointer = NULL;
	}
}

static gpointer
value_foo_peek_pointer (const GValue* value)
{
	return value->data[0].v_pointer;
}

static gchar*
value_foo_collect_value (GValue* value,
                         guint n_collect_values,
                         GTypeCValue* collect_values,
                         guint collect_flags)
{
	if (collect_values[0].v_pointer) {
		Foo * object;
		object = collect_values[0].v_pointer;
		if (object->parent_instance.g_class == NULL) {
			return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
			return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		}
		value->data[0].v_pointer = foo_ref (object);
	} else {
		value->data[0].v_pointer = NULL;
	}
	return NULL;
}

static gchar*
value_foo_lcopy_value (const GValue* value,
                       guint n_collect_values,
                       GTypeCValue* collect_values,
                       guint collect_flags)
{
	Foo ** object_p;
	object_p = collect_values[0].v_pointer;
	if (!object_p) {
		return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
	}
	if (!value->data[0].v_pointer) {
		*object_p = NULL;
	} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
		*object_p = value->data[0].v_pointer;
	} else {
		*object_p = foo_ref (value->data[0].v_pointer);
	}
	return NULL;
}

GParamSpec*
param_spec_foo (const gchar* name,
                const gchar* nick,
                const gchar* blurb,
                GType object_type,
                GParamFlags flags)
{
	ParamSpecFoo* spec;
	g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
	spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
	G_PARAM_SPEC (spec)->value_type = object_type;
	return G_PARAM_SPEC (spec);
}

gpointer
value_get_foo (const GValue* value)
{
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
	return value->data[0].v_pointer;
}

void
value_set_foo (GValue* value,
               gpointer v_object)
{
	Foo * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
		foo_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		foo_unref (old);
	}
}

void
value_take_foo (GValue* value,
                gpointer v_object)
{
	Foo * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		foo_unref (old);
	}
}

static void
foo_class_init (FooClass * klass,
                gpointer klass_data)
{
	foo_parent_class = g_type_class_peek_parent (klass);
	((FooClass *) klass)->finalize = foo_finalize;
	g_type_class_adjust_private_offset (klass, &Foo_private_offset);
}

static void
foo_instance_init (Foo * self,
                   gpointer klass)
{
	Bar* _tmp0_;
	self->priv = foo_get_instance_private (self);
	self->i = 42;
	self->priv->_j = 23;
	_tmp0_ = bar_new ();
	self->b = _tmp0_;
	self->ref_count = 1;
}

static void
foo_finalize (Foo * obj)
{
	Foo * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
	g_signal_handlers_destroy (self);
	_bar_free0 (self->b);
}

static GType
foo_get_type_once (void)
{
	static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
	static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, (GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
	static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
	GType foo_type_id;
	foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, &g_define_type_fundamental_info, 0);
	Foo_private_offset = g_type_add_instance_private (foo_type_id, sizeof (FooPrivate));
	return foo_type_id;
}

GType
foo_get_type (void)
{
	static volatile gsize foo_type_id__once = 0;
	if (g_once_init_enter (&foo_type_id__once)) {
		GType foo_type_id;
		foo_type_id = foo_get_type_once ();
		g_once_init_leave (&foo_type_id__once, foo_type_id);
	}
	return foo_type_id__once;
}

gpointer
foo_ref (gpointer instance)
{
	Foo * self;
	self = instance;
	g_atomic_int_inc (&self->ref_count);
	return instance;
}

void
foo_unref (gpointer instance)
{
	Foo * self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		FOO_GET_CLASS (self)->finalize (self);
		g_type_free_instance ((GTypeInstance *) self);
	}
}

static gint*
_int_dup (gint* self)
{
	gint* dup;
	dup = g_new0 (gint, 1);
	memcpy (dup, self, sizeof (gint));
	return dup;
}

static gpointer
__int_dup0 (gpointer self)
{
	return self ? _int_dup (self) : NULL;
}

static gint*
_vala_array_dup1 (gint* self,
                  gssize length)
{
	if (length > 0) {
		return _vala_memdup2 (self, length * sizeof (gint));
	}
	return NULL;
}

void
bar (Foo* f)
{
	g_return_if_fail ((f == NULL) || IS_FOO (f));
	{
		Foo* _tmp0_ = NULL;
		Bar* _tmp1_ = NULL;
		Bar* b = NULL;
		Bar* _tmp3_;
		Bar* _tmp4_;
		_tmp0_ = f;
		_tmp1_ = NULL;
		if (_tmp0_ != NULL) {
			Bar* _tmp2_;
			_tmp2_ = foo_bar (_tmp0_);
			_bar_free0 (_tmp1_);
			_tmp1_ = _tmp2_;
		}
		_tmp3_ = _tmp1_;
		_tmp1_ = NULL;
		b = _tmp3_;
		_tmp4_ = b;
		_vala_assert (_tmp4_ == NULL, "b == null");
		_bar_free0 (b);
		_bar_free0 (_tmp1_);
	}
	{
		gint* a = NULL;
		gint a_length1;
		gint _a_size_;
		gint* _tmp5_ = NULL;
		gint* _tmp6_;
		gint _tmp6__length1;
		gint _tmp5__length1;
		gint __tmp5__size_;
		gint* _tmp7_ = NULL;
		gint* i = NULL;
		gint* _tmp10_;
		gint* _tmp11_;
		a = NULL;
		a_length1 = 0;
		_a_size_ = a_length1;
		_tmp6_ = a;
		_tmp6__length1 = a_length1;
		_tmp5_ = _tmp6_;
		_tmp5__length1 = _tmp6__length1;
		__tmp5__size_ = _tmp5__length1;
		_tmp7_ = NULL;
		if (_tmp5_ != NULL) {
			gint _tmp8_;
			gint* _tmp9_;
			_tmp8_ = _tmp5_[3];
			_tmp9_ = __int_dup0 (&_tmp8_);
			_g_free0 (_tmp7_);
			_tmp7_ = _tmp9_;
		}
		_tmp10_ = _tmp7_;
		_tmp7_ = NULL;
		i = _tmp10_;
		_tmp11_ = i;
		_vala_assert (_tmp11_ == NULL, "i == null");
		_g_free0 (i);
		_g_free0 (_tmp7_);
		a = (g_free (a), NULL);
	}
	{
		gint* a = NULL;
		gint a_length1;
		gint _a_size_;
		gint* _tmp12_ = NULL;
		gint* _tmp13_;
		gint _tmp13__length1;
		gint _tmp12__length1;
		gint __tmp12__size_;
		gint* _tmp14_ = NULL;
		gint _tmp14__length1;
		gint __tmp14__size_;
		gint* s = NULL;
		gint* _tmp15_;
		gint _tmp15__length1;
		gint s_length1;
		gint _s_size_;
		a = NULL;
		a_length1 = 0;
		_a_size_ = a_length1;
		_tmp13_ = a;
		_tmp13__length1 = a_length1;
		_tmp12_ = _tmp13_;
		_tmp12__length1 = _tmp13__length1;
		__tmp12__size_ = _tmp12__length1;
		_tmp14_ = NULL;
		_tmp14__length1 = 0;
		__tmp14__size_ = _tmp14__length1;
		if (_tmp12_ != NULL) {
			_tmp14_ = _tmp12_ + 1;
			_tmp14__length1 = 3 - 1;
			__tmp14__size_ = _tmp14__length1;
		}
		_tmp15_ = (_tmp14_ != NULL) ? _vala_array_dup1 (_tmp14_, _tmp14__length1) : _tmp14_;
		_tmp15__length1 = _tmp14__length1;
		s = _tmp15_;
		s_length1 = _tmp15__length1;
		_s_size_ = s_length1;
		_vala_assert (s == NULL, "s == null");
		s = (g_free (s), NULL);
		a = (g_free (a), NULL);
	}
}

static gboolean
_int_equal (const gint * s1,
            const gint * s2)
{
	if (s1 == s2) {
		return TRUE;
	}
	if (s1 == NULL) {
		return FALSE;
	}
	if (s2 == NULL) {
		return FALSE;
	}
	return (*s1) == (*s2);
}

static gint*
_vala_array_dup2 (gint* self,
                  gssize length)
{
	if (length > 0) {
		return _vala_memdup2 (self, length * sizeof (gint));
	}
	return NULL;
}

void
baz (Foo* f)
{
	g_return_if_fail ((f == NULL) || IS_FOO (f));
	{
		gint* a = NULL;
		gint _tmp0_ = 0;
		gint* _tmp1_;
		gint a_length1;
		gint _a_size_;
		gint* _tmp2_ = NULL;
		gint* _tmp3_;
		gint _tmp3__length1;
		gint _tmp2__length1;
		gint __tmp2__size_;
		gint* _tmp4_ = NULL;
		gint* i = NULL;
		gint* _tmp7_;
		gint* _tmp8_;
		gint _tmp9_;
		_tmp1_ = foo_seq (f, 10, &_tmp0_);
		a = _tmp1_;
		a_length1 = _tmp0_;
		_a_size_ = a_length1;
		_tmp3_ = a;
		_tmp3__length1 = a_length1;
		_tmp2_ = _tmp3_;
		_tmp2__length1 = _tmp3__length1;
		__tmp2__size_ = _tmp2__length1;
		_tmp4_ = NULL;
		if (_tmp2_ != NULL) {
			gint _tmp5_;
			gint* _tmp6_;
			_tmp5_ = _tmp2_[3];
			_tmp6_ = __int_dup0 (&_tmp5_);
			_g_free0 (_tmp4_);
			_tmp4_ = _tmp6_;
		}
		_tmp7_ = _tmp4_;
		_tmp4_ = NULL;
		i = _tmp7_;
		_tmp8_ = i;
		_tmp9_ = 3;
		_vala_assert (_int_equal (_tmp8_, &_tmp9_) == TRUE, "i == 3");
		_g_free0 (i);
		_g_free0 (_tmp4_);
		a = (g_free (a), NULL);
	}
	{
		gint* a = NULL;
		gint _tmp10_ = 0;
		gint* _tmp11_;
		gint a_length1;
		gint _a_size_;
		gint* _tmp12_ = NULL;
		gint* _tmp13_;
		gint _tmp13__length1;
		gint _tmp12__length1;
		gint __tmp12__size_;
		gint* _tmp14_ = NULL;
		gint _tmp14__length1;
		gint __tmp14__size_;
		gint* s = NULL;
		gint* _tmp15_;
		gint _tmp15__length1;
		gint s_length1;
		gint _s_size_;
		gint* _tmp16_;
		gint _tmp16__length1;
		gint _tmp17_;
		_tmp11_ = foo_seq (f, 10, &_tmp10_);
		a = _tmp11_;
		a_length1 = _tmp10_;
		_a_size_ = a_length1;
		_tmp13_ = a;
		_tmp13__length1 = a_length1;
		_tmp12_ = _tmp13_;
		_tmp12__length1 = _tmp13__length1;
		__tmp12__size_ = _tmp12__length1;
		_tmp14_ = NULL;
		_tmp14__length1 = 0;
		__tmp14__size_ = _tmp14__length1;
		if (_tmp12_ != NULL) {
			_tmp14_ = _tmp12_ + 1;
			_tmp14__length1 = 3 - 1;
			__tmp14__size_ = _tmp14__length1;
		}
		_tmp15_ = (_tmp14_ != NULL) ? _vala_array_dup2 (_tmp14_, _tmp14__length1) : _tmp14_;
		_tmp15__length1 = _tmp14__length1;
		s = _tmp15_;
		s_length1 = _tmp15__length1;
		_s_size_ = s_length1;
		_tmp16_ = s;
		_tmp16__length1 = s_length1;
		_tmp17_ = _tmp16_[0];
		_vala_assert (_tmp17_ == 1, "s[0] == 1");
		s = (g_free (s), NULL);
		a = (g_free (a), NULL);
	}
	{
		Foo* _tmp18_ = NULL;
		Bar* _tmp19_ = NULL;
		Bar* b = NULL;
		Bar* _tmp21_;
		Bar* _tmp22_;
		_tmp18_ = f;
		_tmp19_ = NULL;
		if (_tmp18_ != NULL) {
			Bar* _tmp20_;
			_tmp20_ = _tmp18_->b;
			_tmp18_->b = NULL;
			_bar_free0 (_tmp19_);
			_tmp19_ = _tmp20_;
		}
		_tmp21_ = _tmp19_;
		_tmp19_ = NULL;
		b = _tmp21_;
		_tmp22_ = b;
		_vala_assert (_tmp22_->k == 17, "b.k == 17");
		_bar_free0 (b);
		_bar_free0 (_tmp19_);
	}
	{
		Foo* _tmp23_ = NULL;
		Bar* _tmp24_ = NULL;
		Bar* b = NULL;
		Bar* _tmp26_;
		Bar* _tmp27_;
		_tmp23_ = f;
		_tmp24_ = NULL;
		if (_tmp23_ != NULL) {
			Bar* _tmp25_;
			_tmp25_ = foo_bar (_tmp23_);
			_bar_free0 (_tmp24_);
			_tmp24_ = _tmp25_;
		}
		_tmp26_ = _tmp24_;
		_tmp24_ = NULL;
		b = _tmp26_;
		_tmp27_ = b;
		_vala_assert (_tmp27_->k == 17, "b.k == 17");
		_bar_free0 (b);
		_bar_free0 (_tmp24_);
	}
	{
		Foo* _tmp28_ = NULL;
		Bar** _tmp29_ = NULL;
		gint _tmp29__length1;
		gint __tmp29__size_;
		Bar** a = NULL;
		Bar** _tmp32_;
		gint _tmp32__length1;
		gint a_length1;
		gint _a_size_;
		Bar** _tmp33_ = NULL;
		Bar** _tmp34_;
		gint _tmp34__length1;
		gint _tmp33__length1;
		gint __tmp33__size_;
		Bar* _tmp35_ = NULL;
		Bar* b = NULL;
		Bar* _tmp37_;
		Bar* _tmp38_;
		_tmp28_ = f;
		_tmp29_ = NULL;
		_tmp29__length1 = 0;
		__tmp29__size_ = _tmp29__length1;
		if (_tmp28_ != NULL) {
			gint _tmp30_ = 0;
			Bar** _tmp31_;
			_tmp31_ = foo_bars (_tmp28_, 10, &_tmp30_);
			_tmp29_ = (_vala_array_free (_tmp29_, _tmp29__length1, (GDestroyNotify) bar_free), NULL);
			_tmp29_ = _tmp31_;
			_tmp29__length1 = _tmp30_;
			__tmp29__size_ = _tmp29__length1;
		}
		_tmp32_ = _tmp29_;
		_tmp32__length1 = _tmp29__length1;
		_tmp29_ = NULL;
		_tmp29__length1 = 0;
		a = _tmp32_;
		a_length1 = _tmp32__length1;
		_a_size_ = a_length1;
		_tmp34_ = a;
		_tmp34__length1 = a_length1;
		_tmp33_ = _tmp34_;
		_tmp33__length1 = _tmp34__length1;
		__tmp33__size_ = _tmp33__length1;
		_tmp35_ = NULL;
		if (_tmp33_ != NULL) {
			Bar* _tmp36_;
			_tmp36_ = _tmp33_[3];
			_tmp33_[3] = NULL;
			_bar_free0 (_tmp35_);
			_tmp35_ = _tmp36_;
		}
		_tmp37_ = _tmp35_;
		_tmp35_ = NULL;
		b = _tmp37_;
		_tmp38_ = b;
		_vala_assert (_tmp38_->k == 3, "b.k == 3");
		_bar_free0 (b);
		_bar_free0 (_tmp35_);
		a = (_vala_array_free (a, a_length1, (GDestroyNotify) bar_free), NULL);
		_tmp29_ = (_vala_array_free (_tmp29_, _tmp29__length1, (GDestroyNotify) bar_free), NULL);
	}
	{
		Foo* _tmp39_ = NULL;
		gint* _tmp40_ = NULL;
		gint* j = NULL;
		gint* _tmp44_;
		gint* _tmp45_;
		gint _tmp46_;
		_tmp39_ = f;
		_tmp40_ = NULL;
		if (_tmp39_ != NULL) {
			gint _tmp41_;
			gint _tmp42_;
			gint* _tmp43_;
			_tmp41_ = foo_get_j (_tmp39_);
			_tmp42_ = _tmp41_;
			_tmp43_ = __int_dup0 (&_tmp42_);
			_g_free0 (_tmp40_);
			_tmp40_ = _tmp43_;
		}
		_tmp44_ = _tmp40_;
		_tmp40_ = NULL;
		j = _tmp44_;
		_tmp45_ = j;
		_tmp46_ = 23;
		_vala_assert (_int_equal (_tmp45_, &_tmp46_) == TRUE, "j == 23");
		_g_free0 (j);
		_g_free0 (_tmp40_);
	}
	{
		Foo* _tmp47_ = NULL;
		gint* _tmp48_ = NULL;
		gint* i = NULL;
		gint* _tmp51_;
		gint _tmp52_;
		_tmp47_ = f;
		_tmp48_ = NULL;
		if (_tmp47_ != NULL) {
			gint _tmp49_;
			gint* _tmp50_;
			_tmp49_ = foo_foo (_tmp47_);
			_tmp50_ = __int_dup0 (&_tmp49_);
			_g_free0 (_tmp48_);
			_tmp48_ = _tmp50_;
		}
		_tmp51_ = _tmp48_;
		_tmp48_ = NULL;
		i = _tmp51_;
		_tmp52_ = 42;
		_vala_assert (_int_equal (i, &_tmp52_) == TRUE, "i == 42");
		_g_free0 (i);
		_g_free0 (_tmp48_);
	}
}

static void
_vala_main (void)
{
	{
		Foo* _tmp0_;
		Foo* _tmp1_;
		bar (NULL);
		_tmp0_ = foo_new ();
		_tmp1_ = _tmp0_;
		baz (_tmp1_);
		_foo_unref0 (_tmp1_);
	}
	{
		Foo* _tmp2_ = NULL;
		Foo* _tmp3_;
		gint* _tmp4_ = NULL;
		gint* i = NULL;
		gint* _tmp6_;
		gint _tmp7_;
		_tmp3_ = foo_new ();
		_tmp2_ = _tmp3_;
		_tmp4_ = NULL;
		if (_tmp2_ != NULL) {
			gint* _tmp5_;
			_tmp5_ = __int_dup0 (&_tmp2_->i);
			_g_free0 (_tmp4_);
			_tmp4_ = _tmp5_;
		}
		_tmp6_ = _tmp4_;
		_tmp4_ = NULL;
		i = _tmp6_;
		_tmp7_ = 42;
		_vala_assert (_int_equal (i, &_tmp7_) == TRUE, "i == 42");
		_g_free0 (i);
		_g_free0 (_tmp4_);
		_foo_unref0 (_tmp2_);
	}
}

int
main (int argc,
      char ** argv)
{
	_vala_main ();
	return 0;
}

static void
_vala_array_destroy (gpointer array,
                     gssize array_length,
                     GDestroyNotify destroy_func)
{
	if ((array != NULL) && (destroy_func != NULL)) {
		gssize i;
		for (i = 0; i < array_length; i = i + 1) {
			if (((gpointer*) array)[i] != NULL) {
				destroy_func (((gpointer*) array)[i]);
			}
		}
	}
}

static void
_vala_array_free (gpointer array,
                  gssize array_length,
                  GDestroyNotify destroy_func)
{
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}

static inline gpointer
_vala_memdup2 (gconstpointer mem,
               gsize byte_size)
{
	gpointer new_mem;
	if (mem && byte_size != 0) {
		new_mem = g_malloc (byte_size);
		memcpy (new_mem, mem, byte_size);
	} else {
		new_mem = NULL;
	}
	return new_mem;
}