#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ free(int *);
int *malloc(int);
int main(void) {
  int i;
  int *a[36];
  for (i = 0; i < 36; i++) {
    a[i] = malloc(200);
  }
  for (i = 0; i < 36 - 1; i++) {
    free(a[i]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x130,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x24,-0x8(%rbp)
jge    116a <main+0x4a>
mov    $0xc8,%edi
call   1040 <malloc@plt>
mov    %rax,%rcx
movslq -0x8(%rbp),%rax
mov    %rcx,-0x130(%rbp,%rax,8)
ff
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1139 <main+0x19>
movl   $0x0,-0x8(%rbp)
cmpl   $0x23,-0x8(%rbp)
jge    119a <main+0x7a>
movslq -0x8(%rbp),%rax
mov    -0x130(%rbp,%rax,8),%rdi
ff
call   1030 <free@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1171 <main+0x51>
xor    %eax,%eax
add    $0x130,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x120,%rsp
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
mov    $0xc8,%edi
call   1040 <malloc@plt>
mov    %rax,(%rsp,%rbx,8)
add    $0x1,%rbx
cmp    $0x24,%rbx
jne    1130 <main+0x10>
mov    (%rsp),%rdi
call   1030 <free@plt>
mov    0x8(%rsp),%rdi
call   1030 <free@plt>
mov    0x10(%rsp),%rdi
call   1030 <free@plt>
mov    0x18(%rsp),%rdi
call   1030 <free@plt>
mov    0x20(%rsp),%rdi
call   1030 <free@plt>
mov    0x28(%rsp),%rdi
call   1030 <free@plt>
mov    0x30(%rsp),%rdi
call   1030 <free@plt>
mov    0x38(%rsp),%rdi
call   1030 <free@plt>
mov    0x40(%rsp),%rdi
call   1030 <free@plt>
mov    0x48(%rsp),%rdi
call   1030 <free@plt>
mov    0x50(%rsp),%rdi
call   1030 <free@plt>
mov    0x58(%rsp),%rdi
call   1030 <free@plt>
mov    0x60(%rsp),%rdi
call   1030 <free@plt>
mov    0x68(%rsp),%rdi
call   1030 <free@plt>
mov    0x70(%rsp),%rdi
call   1030 <free@plt>
mov    0x78(%rsp),%rdi
call   1030 <free@plt>
mov    0x80(%rsp),%rdi
call   1030 <free@plt>
mov    0x88(%rsp),%rdi
call   1030 <free@plt>
mov    0x90(%rsp),%rdi
call   1030 <free@plt>
mov    0x98(%rsp),%rdi
call   1030 <free@plt>
mov    0xa0(%rsp),%rdi
call   1030 <free@plt>
mov    0xa8(%rsp),%rdi
call   1030 <free@plt>
mov    0xb0(%rsp),%rdi
call   1030 <free@plt>
mov    0xb8(%rsp),%rdi
call   1030 <free@plt>
mov    0xc0(%rsp),%rdi
call   1030 <free@plt>
mov    0xc8(%rsp),%rdi
call   1030 <free@plt>
mov    0xd0(%rsp),%rdi
call   1030 <free@plt>
mov    0xd8(%rsp),%rdi
call   1030 <free@plt>
mov    0xe0(%rsp),%rdi
call   1030 <free@plt>
mov    0xe8(%rsp),%rdi
call   1030 <free@plt>
mov    0xf0(%rsp),%rdi
call   1030 <free@plt>
mov    0xf8(%rsp),%rdi
call   1030 <free@plt>
mov    0x100(%rsp),%rdi
call   1030 <free@plt>
mov    0x108(%rsp),%rdi
call   1030 <free@plt>
mov    0x110(%rsp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x120,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [36 x i32*]
store i32 0, i32* %1
store i32 0, i32* %2
br label %4
4: ; preds = %12, %0
%5 = load i32, i32* %2
%6 = icmp slt i32 %5, 36
br i1 %6, label %7, label %15
7: ; preds = %4
%8 = call i32* @malloc(i32 200)
%9 = load i32, i32* %2
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds [36 x i32*], [36 x i32*]* %3, i64 0, i64 %10
store i32* %8, i32** %11
br label %12
12: ; preds = %7
%13 = load i32, i32* %2
%14 = add nsw i32 %13, 1
store i32 %14, i32* %2
br label %4
15: ; preds = %4
store i32 0, i32* %2
br label %16
16: ; preds = %25, %15
%17 = load i32, i32* %2
%18 = icmp slt i32 %17, 35
br i1 %18, label %19, label %28
19: ; preds = %16
%20 = load i32, i32* %2
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [36 x i32*], [36 x i32*]* %3, i64 0, i64 %21
%23 = load i32*, i32** %22
%24 = call i32 @free(i32* %23)
br label %25
25: ; preds = %19
%26 = load i32, i32* %2
%27 = add nsw i32 %26, 1
store i32 %27, i32* %2
br label %16
28: ; preds = %16
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [36 x i32*]
%2 = bitcast [36 x i32*]* %1 to i8*
br label %3
3: ; preds = %0, %3
%4 = phi i64 [ 0, %0 ], [ %7, %3 ]
%5 = tail call i32* @malloc(i32 200)
%6 = getelementptr inbounds [36 x i32*], [36 x i32*]* %1, i64 0, i64 %4
store i32* %5, i32** %6
%7 = add nuw nsw i64 %4, 1
%8 = icmp eq i64 %7, 36
br i1 %8, label %9, label %3
9: ; preds = %3
%10 = getelementptr inbounds [36 x i32*], [36 x i32*]* %1, i64 0, i64 0
%11 = load i32*, i32** %10
%12 = tail call i32 @free(i32* %11)
%13 = getelementptr inbounds [36 x i32*], [36 x i32*]* %1, i64 0, i64 1
%14 = load i32*, i32** %13
%15 = tail call i32 @free(i32* %14)
%16 = getelementptr inbounds [36 x i32*], [36 x i32*]* %1, i64 0, i64 2
%17 = load i32*, i32** %16
%18 = tail call i32 @free(i32* %17)
%19 = getelementptr inbounds [36 x i32*], [36 x i32*]* %1, i64 0, i64 3
%20 = load i32*, i32** %19
%21 = tail call i32 @free(i32* %20)
%22 = getelementptr inbounds [36 x i32*], [36 x i32*]* %1, i64 0, i64 4
%23 = load i32*, i32** %22
%24 = tail call i32 @free(i32* %23)
%25 = getelementptr inbounds [36 x i32*], [36 x i32*]* %1, i64 0, i64 5
%26 = load i32*, i32** %25
%27 = tail call i32 @free(i32* %26)
%28 = getelementptr inbounds [36 x i32*], [36 x i32*]* %1, i64 0, i64 6
%29 = load i32*, i32** %28
%30 = tail call i32 @free(i32* %29)
%31 = getelementptr inbounds [36 x i32*], [36 x i32*]* %1, i64 0, i64 7
%32 = load i32*, i32** %31
%33 = tail call i32 @free(i32* %32)
%34 = getelementptr inbounds [36 x i32*], [36 x i32*]* %1, i64 0, i64 8
%35 = load i32*, i32** %34
%36 = tail call i32 @free(i32* %35)
%37 = getelementptr inbounds [36 x i32*], [36 x i32*]* %1, i64 0, i64 9
%38 = load i32*, i32** %37
%39 = tail call i32 @free(i32* %38)
%40 = getelementptr inbounds [36 x i32*], [36 x i32*]* %1, i64 0, i64 10
%41 = load i32*, i32** %40
%42 = tail call i32 @free(i32* %41)
%43 = getelementptr inbounds [36 x i32*], [36 x i32*]* %1, i64 0, i64 11
%44 = load i32*, i32** %43
%45 = tail call i32 @free(i32* %44)
%46 = getelementptr inbounds [36 x i32*], [36 x i32*]* %1, i64 0, i64 12
%47 = load i32*, i32** %46
%48 = tail call i32 @free(i32* %47)
%49 = getelementptr inbounds [36 x i32*], [36 x i32*]* %1, i64 0, i64 13
%50 = load i32*, i32** %49
%51 = tail call i32 @free(i32* %50)
%52 = getelementptr inbounds [36 x i32*], [36 x i32*]* %1, i64 0, i64 14
%53 = load i32*, i32** %52
%54 = tail call i32 @free(i32* %53)
%55 = getelementptr inbounds [36 x i32*], [36 x i32*]* %1, i64 0, i64 15
%56 = load i32*, i32** %55
%57 = tail call i32 @free(i32* %56)
%58 = getelementptr inbounds [36 x i32*], [36 x i32*]* %1, i64 0, i64 16
%59 = load i32*, i32** %58
%60 = tail call i32 @free(i32* %59)
%61 = getelementptr inbounds [36 x i32*], [36 x i32*]* %1, i64 0, i64 17
%62 = load i32*, i32** %61
%63 = tail call i32 @free(i32* %62)
%64 = getelementptr inbounds [36 x i32*], [36 x i32*]* %1, i64 0, i64 18
%65 = load i32*, i32** %64
%66 = tail call i32 @free(i32* %65)
%67 = getelementptr inbounds [36 x i32*], [36 x i32*]* %1, i64 0, i64 19
%68 = load i32*, i32** %67
%69 = tail call i32 @free(i32* %68)
%70 = getelementptr inbounds [36 x i32*], [36 x i32*]* %1, i64 0, i64 20
%71 = load i32*, i32** %70
%72 = tail call i32 @free(i32* %71)
%73 = getelementptr inbounds [36 x i32*], [36 x i32*]* %1, i64 0, i64 21
%74 = load i32*, i32** %73
%75 = tail call i32 @free(i32* %74)
%76 = getelementptr inbounds [36 x i32*], [36 x i32*]* %1, i64 0, i64 22
%77 = load i32*, i32** %76
%78 = tail call i32 @free(i32* %77)
%79 = getelementptr inbounds [36 x i32*], [36 x i32*]* %1, i64 0, i64 23
%80 = load i32*, i32** %79
%81 = tail call i32 @free(i32* %80)
%82 = getelementptr inbounds [36 x i32*], [36 x i32*]* %1, i64 0, i64 24
%83 = load i32*, i32** %82
%84 = tail call i32 @free(i32* %83)
%85 = getelementptr inbounds [36 x i32*], [36 x i32*]* %1, i64 0, i64 25
%86 = load i32*, i32** %85
%87 = tail call i32 @free(i32* %86)
%88 = getelementptr inbounds [36 x i32*], [36 x i32*]* %1, i64 0, i64 26
%89 = load i32*, i32** %88
%90 = tail call i32 @free(i32* %89)
%91 = getelementptr inbounds [36 x i32*], [36 x i32*]* %1, i64 0, i64 27
%92 = load i32*, i32** %91
%93 = tail call i32 @free(i32* %92)
%94 = getelementptr inbounds [36 x i32*], [36 x i32*]* %1, i64 0, i64 28
%95 = load i32*, i32** %94
%96 = tail call i32 @free(i32* %95)
%97 = getelementptr inbounds [36 x i32*], [36 x i32*]* %1, i64 0, i64 29
%98 = load i32*, i32** %97
%99 = tail call i32 @free(i32* %98)
%100 = getelementptr inbounds [36 x i32*], [36 x i32*]* %1, i64 0, i64 30
%101 = load i32*, i32** %100
%102 = tail call i32 @free(i32* %101)
%103 = getelementptr inbounds [36 x i32*], [36 x i32*]* %1, i64 0, i64 31
%104 = load i32*, i32** %103
%105 = tail call i32 @free(i32* %104)
%106 = getelementptr inbounds [36 x i32*], [36 x i32*]* %1, i64 0, i64 32
%107 = load i32*, i32** %106
%108 = tail call i32 @free(i32* %107)
%109 = getelementptr inbounds [36 x i32*], [36 x i32*]* %1, i64 0, i64 33
%110 = load i32*, i32** %109
%111 = tail call i32 @free(i32* %110)
%112 = getelementptr inbounds [36 x i32*], [36 x i32*]* %1, i64 0, i64 34
%113 = load i32*, i32** %112
%114 = tail call i32 @free(i32* %113)
ret i32 0
}