#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 < 10; (*i)++) {
    for (*j = 3; *j < 12; *j += 2) {
      *j -= 1;
      *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   $0xa,(%rax)
jge    11bc <main+0xac>
mov    -0x18(%rbp),%rax
movl   $0x3,(%rax)
mov    -0x18(%rbp),%rax
cmpl   $0xc,(%rax)
jge    11a7 <main+0x97>
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
sub    $0x1,%ecx
mov    %ecx,(%rax)
mov    -0x20(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
add    $0x2,%ecx
mov    %ecx,(%rax)
jmp    1174 <main+0x64>
jmp    11ac <main+0x9c>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
jmp    115d <main+0x4d>
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,%r14
mov    $0x4,%edi
call   1030 <alloca@plt>
mov    %rax,%rbx
mov    $0x4,%edi
call   1030 <alloca@plt>
movl   $0x0,(%rax)
movl   $0x0,(%r14)
mov    $0x3,%ecx
nopw   0x0(%rax,%rax,1)
add    $0xffffffff,%ecx
mov    %ecx,(%rbx)
addl   $0x1,(%rax)
mov    (%rbx),%edx
lea    0x2(%rdx),%ecx
mov    %ecx,(%rbx)
cmp    $0xa,%edx
jl     1150 <main+0x40>
mov    (%r14),%edx
lea    0x1(%rdx),%ecx
mov    %ecx,(%r14)
mov    $0x3,%ecx
cmp    $0x9,%edx
jl     1150 <main+0x40>
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 = %32, %0
%11 = load i32*, i32** %2
%12 = load i32, i32* %11
%13 = icmp slt i32 %12, 10
br i1 %13, label %14, label %36
14: ; preds = %10
%15 = load i32*, i32** %3
store i32 3, i32* %15
br label %16
16: ; preds = %27, %14
%17 = load i32*, i32** %3
%18 = load i32, i32* %17
%19 = icmp slt i32 %18, 12
br i1 %19, label %20, label %31
20: ; preds = %16
%21 = load i32*, i32** %3
%22 = load i32, i32* %21
%23 = sub nsw i32 %22, 1
store i32 %23, i32* %21
%24 = load i32*, i32** %4
%25 = load i32, i32* %24
%26 = add nsw i32 %25, 1
store i32 %26, i32* %24
br label %27
27: ; preds = %20
%28 = load i32*, i32** %3
%29 = load i32, i32* %28
%30 = add nsw i32 %29, 2
store i32 %30, i32* %28
br label %16
31: ; preds = %16
br label %32
32: ; preds = %31
%33 = load i32*, i32** %2
%34 = load i32, i32* %33
%35 = add nsw i32 %34, 1
store i32 %35, i32* %33
br label %10
36: ; preds = %10
%37 = load i32*, i32** %4
%38 = load i32, i32* %37
ret i32 %38
}

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 %4
4: ; preds = %12, %0
%5 = phi i32 [ 3, %0 ], [ %13, %12 ]
%6 = add nsw i32 %5, -1
store i32 %6, i32* %2
%7 = load i32, i32* %3
%8 = add nsw i32 %7, 1
store i32 %8, i32* %3
%9 = load i32, i32* %2
%10 = add nsw i32 %9, 2
store i32 %10, i32* %2
%11 = icmp slt i32 %9, 10
br i1 %11, label %12, label %14
12: ; preds = %4, %14
%13 = phi i32 [ %10, %4 ], [ 3, %14 ]
br label %4
14: ; preds = %4
%15 = load i32, i32* %1
%16 = add nsw i32 %15, 1
store i32 %16, i32* %1
%17 = icmp slt i32 %15, 9
br i1 %17, label %12, label %18
18: ; preds = %14
%19 = load i32, i32* %3
ret i32 %19
}