#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*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ free(int *);
scalar_t__ malloc(int);
int main(int argc, char **argv) {
  int A[100];
  int *B;
  int *C;
  int *tmp;
  int i;
  for (i = 0; i < 100; i++)
    A[i] = i;
  B = (int *)malloc(sizeof(int) * 100);
  for (i = 0; i < 110; i++)
    B[i] = i;
  for (i = 0; i < 100; i++)
    C[i] = 1;
  tmp = B;
  B = C;
  C = tmp;
  free(B);
  free(C);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1c0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x1bc(%rbp)
cmpl   $0x64,-0x1bc(%rbp)
jge    1188 <main+0x58>
mov    -0x1bc(%rbp),%ecx
movslq -0x1bc(%rbp),%rax
mov    %ecx,-0x1a0(%rbp,%rax,4)
mov    -0x1bc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1bc(%rbp)
jmp    1153 <main+0x23>
mov    $0x190,%edi
call   1040 <malloc@plt>
mov    %rax,-0x1a8(%rbp)
movl   $0x0,-0x1bc(%rbp)
cmpl   $0x6e,-0x1bc(%rbp)
jge    11db <main+0xab>
mov    -0x1bc(%rbp),%edx
mov    -0x1a8(%rbp),%rax
movslq -0x1bc(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x1bc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1bc(%rbp)
jmp    11a3 <main+0x73>
movl   $0x0,-0x1bc(%rbp)
cmpl   $0x64,-0x1bc(%rbp)
jge    121b <main+0xeb>
mov    -0x1b0(%rbp),%rax
movslq -0x1bc(%rbp),%rcx
movl   $0x1,(%rax,%rcx,4)
mov    -0x1bc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1bc(%rbp)
jmp    11e5 <main+0xb5>
mov    -0x1a8(%rbp),%rax
mov    %rax,-0x1b8(%rbp)
mov    -0x1b0(%rbp),%rax
mov    %rax,-0x1a8(%rbp)
mov    -0x1b8(%rbp),%rax
mov    %rax,-0x1b0(%rbp)
mov    -0x1a8(%rbp),%rdi
call   1030 <free@plt>
mov    -0x1b0(%rbp),%rdi
call   1030 <free@plt>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x190,%edi
call   1030 <malloc@plt>
xor    %ecx,%ecx
nopl   (%rax)
mov    %ecx,(%rax,%rcx,4)
add    $0x1,%rcx
jmp    1120 <main+0x10>

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [100 x i32]
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %10
br label %11
11: ; preds = %19, %2
%12 = load i32, i32* %10
%13 = icmp slt i32 %12, 100
br i1 %13, label %14, label %22
14: ; preds = %11
%15 = load i32, i32* %10
%16 = load i32, i32* %10
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [100 x i32], [100 x i32]* %6, i64 0, i64 %17
store i32 %15, i32* %18
br label %19
19: ; preds = %14
%20 = load i32, i32* %10
%21 = add nsw i32 %20, 1
store i32 %21, i32* %10
br label %11
22: ; preds = %11
%23 = call i64 @malloc(i32 400)
%24 = inttoptr i64 %23 to i32*
store i32* %24, i32** %7
store i32 0, i32* %10
br label %25
25: ; preds = %34, %22
%26 = load i32, i32* %10
%27 = icmp slt i32 %26, 110
br i1 %27, label %28, label %37
28: ; preds = %25
%29 = load i32, i32* %10
%30 = load i32*, i32** %7
%31 = load i32, i32* %10
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i32, i32* %30, i64 %32
store i32 %29, i32* %33
br label %34
34: ; preds = %28
%35 = load i32, i32* %10
%36 = add nsw i32 %35, 1
store i32 %36, i32* %10
br label %25
37: ; preds = %25
store i32 0, i32* %10
br label %38
38: ; preds = %46, %37
%39 = load i32, i32* %10
%40 = icmp slt i32 %39, 100
br i1 %40, label %41, label %49
41: ; preds = %38
%42 = load i32*, i32** %8
%43 = load i32, i32* %10
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds i32, i32* %42, i64 %44
store i32 1, i32* %45
br label %46
46: ; preds = %41
%47 = load i32, i32* %10
%48 = add nsw i32 %47, 1
store i32 %48, i32* %10
br label %38
49: ; preds = %38
%50 = load i32*, i32** %7
store i32* %50, i32** %9
%51 = load i32*, i32** %8
store i32* %51, i32** %7
%52 = load i32*, i32** %9
store i32* %52, i32** %8
%53 = load i32*, i32** %7
%54 = call i32 @free(i32* %53)
%55 = load i32*, i32** %8
%56 = call i32 @free(i32* %55)
%57 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i64 @malloc(i32 400)
%4 = inttoptr i64 %3 to i32*
br label %5
5: ; preds = %5, %2
%6 = phi i64 [ %10, %5 ], [ 0, %2 ]
%7 = icmp ult i64 %6, 110
tail call void @llvm.assume(i1 %7)
%8 = getelementptr inbounds i32, i32* %4, i64 %6
%9 = trunc i64 %6 to i32
store i32 %9, i32* %8
%10 = add nuw nsw i64 %6, 1
br label %5
}