#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 *alloca(int);
int main() {
  int *i = alloca(sizeof(int));
  int *j = alloca(sizeof(int));
  int *c = alloca(sizeof(int));
  *c = 0;
  for (*i = 0; *i < 100; (*i)++)
    *c = *c + 1;
  for (*j = 5; *j < 21; *j += 3)
    *c = *c + 1;
  return *c;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x4,%edi
call   1030 <alloca@plt>
mov    %rax,-0x10(%rbp)
mov    $0x4,%edi
call   1030 <alloca@plt>
mov    %rax,-0x18(%rbp)
mov    $0x4,%edi
call   1030 <alloca@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x10(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x10(%rbp),%rax
cmpl   $0x64,(%rax)
jge    1189 <main+0x79>
mov    -0x20(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
jmp    115d <main+0x4d>
mov    -0x18(%rbp),%rax
movl   $0x5,(%rax)
mov    -0x18(%rbp),%rax
cmpl   $0x15,(%rax)
jge    11bf <main+0xaf>
mov    -0x20(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
add    $0x3,%ecx
mov    %ecx,(%rax)
jmp    1193 <main+0x83>
mov    -0x20(%rbp),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0x4,%edi
call   1030 <alloca@plt>
mov    %rax,%rbx
mov    $0x4,%edi
call   1030 <alloca@plt>
mov    %rax,%r14
mov    $0x4,%edi
call   1030 <alloca@plt>
movl   $0x0,(%rax)
movl   $0x0,(%rbx)
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
addl   $0x1,(%rax)
mov    (%rbx),%ecx
lea    0x1(%rcx),%edx
mov    %edx,(%rbx)
cmp    $0x63,%ecx
jl     1150 <main+0x40>
movl   $0x5,(%r14)
cs nopw 0x0(%rax,%rax,1)
addl   $0x1,(%rax)
mov    (%r14),%ecx
lea    0x3(%rcx),%edx
mov    %edx,(%r14)
cmp    $0x12,%ecx
jl     1170 <main+0x60>
mov    (%rax),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32*
%4 = alloca i32*
store i32 0, i32* %1
%5 = call i32* @alloca(i32 4)
store i32* %5, i32** %2
%6 = call i32* @alloca(i32 4)
store i32* %6, i32** %3
%7 = call i32* @alloca(i32 4)
store i32* %7, i32** %4
%8 = load i32*, i32** %4
store i32 0, i32* %8
%9 = load i32*, i32** %2
store i32 0, i32* %9
br label %10
10: ; preds = %19, %0
%11 = load i32*, i32** %2
%12 = load i32, i32* %11
%13 = icmp slt i32 %12, 100
br i1 %13, label %14, label %23
14: ; preds = %10
%15 = load i32*, i32** %4
%16 = load i32, i32* %15
%17 = add nsw i32 %16, 1
%18 = load i32*, i32** %4
store i32 %17, i32* %18
br label %19
19: ; preds = %14
%20 = load i32*, i32** %2
%21 = load i32, i32* %20
%22 = add nsw i32 %21, 1
store i32 %22, i32* %20
br label %10
23: ; preds = %10
%24 = load i32*, i32** %3
store i32 5, i32* %24
br label %25
25: ; preds = %34, %23
%26 = load i32*, i32** %3
%27 = load i32, i32* %26
%28 = icmp slt i32 %27, 21
br i1 %28, label %29, label %38
29: ; preds = %25
%30 = load i32*, i32** %4
%31 = load i32, i32* %30
%32 = add nsw i32 %31, 1
%33 = load i32*, i32** %4
store i32 %32, i32* %33
br label %34
34: ; preds = %29
%35 = load i32*, i32** %3
%36 = load i32, i32* %35
%37 = add nsw i32 %36, 3
store i32 %37, i32* %35
br label %25
38: ; preds = %25
%39 = load i32*, i32** %4
%40 = load i32, i32* %39
ret i32 %40
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32* @alloca(i32 4)
%2 = tail call i32* @alloca(i32 4)
%3 = tail call i32* @alloca(i32 4)
store i32 0, i32* %3
store i32 0, i32* %1
br label %5
4: ; preds = %5
store i32 5, i32* %2
br label %11
5: ; preds = %0, %5
%6 = load i32, i32* %3
%7 = add nsw i32 %6, 1
store i32 %7, i32* %3
%8 = load i32, i32* %1
%9 = add nsw i32 %8, 1
store i32 %9, i32* %1
%10 = icmp slt i32 %8, 99
br i1 %10, label %5, label %4
11: ; preds = %4, %11
%12 = load i32, i32* %3
%13 = add nsw i32 %12, 1
store i32 %13, i32* %3
%14 = load i32, i32* %2
%15 = add nsw i32 %14, 3
store i32 %15, i32* %2
%16 = icmp slt i32 %14, 18
br i1 %16, label %11, label %17
17: ; preds = %11
%18 = load i32, i32* %3
ret i32 %18
}