#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*/ FUNC();
int /*<<< orphan*/ FUNC0();
int /*<<< orphan*/ OOB();
int atoi(char *);
int main(int argc, char **argv) {
  int X = argc == 2 ? atoi(argv[1]) : 10;
  FUNC0();
  for (int i = 0; i < X; ++i)
    FUNC();
  OOB();
  OOB();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jne    1175 <main+0x35>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x1c(%rbp)
jmp    1182 <main+0x42>
mov    $0xa,%eax
mov    %eax,-0x1c(%rbp)
jmp    1182 <main+0x42>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1040 <FUNC0@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11b7 <main+0x77>
mov    $0x0,%al
call   1030 <FUNC@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1196 <main+0x56>
mov    $0x0,%al
call   1050 <OOB@plt>
mov    $0x0,%al
call   1050 <OOB@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
cmp    $0x2,%edi
jne    115e <main+0x1e>
mov    0x8(%rsi),%rdi
call   1060 <atoi@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1040 <FUNC0@plt>
test   %ebx,%ebx
jg     1170 <main+0x30>
jmp    117c <main+0x3c>
xor    %eax,%eax
call   1040 <FUNC0@plt>
mov    $0xa,%ebx
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <FUNC@plt>
add    $0xffffffff,%ebx
jne    1170 <main+0x30>
xor    %eax,%eax
call   1050 <OOB@plt>
xor    %eax,%eax
call   1050 <OOB@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = icmp eq i32 %8, 2
br i1 %9, label %10, label %15
10: ; preds = %2
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
%14 = call i32 @atoi(i8* %13)
br label %16
15: ; preds = %2
br label %16
16: ; preds = %15, %10
%17 = phi i32 [ %14, %10 ], [ 10, %15 ]
store i32 %17, i32* %6
%18 = call i32 (...) @FUNC0()
store i32 0, i32* %7
br label %19
19: ; preds = %25, %16
%20 = load i32, i32* %7
%21 = load i32, i32* %6
%22 = icmp slt i32 %20, %21
br i1 %22, label %23, label %28
23: ; preds = %19
%24 = call i32 (...) @FUNC()
br label %25
25: ; preds = %23
%26 = load i32, i32* %7
%27 = add nsw i32 %26, 1
store i32 %27, i32* %7
br label %19
28: ; preds = %19
%29 = call i32 (...) @OOB()
%30 = call i32 (...) @OOB()
%31 = load i32, i32* %3
ret i32 %31
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 (...) @FUNC0()
br label %12
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i32 @atoi(i8* %8)
%10 = tail call i32 (...) @FUNC0()
%11 = icmp sgt i32 %9, 0
br i1 %11, label %12, label %14
12: ; preds = %4, %6
%13 = phi i32 [ 10, %4 ], [ %9, %6 ]
br label %17
14: ; preds = %17, %6
%15 = tail call i32 (...) @OOB()
%16 = tail call i32 (...) @OOB()
ret i32 0
17: ; preds = %12, %17
%18 = phi i32 [ %20, %17 ], [ 0, %12 ]
%19 = tail call i32 (...) @FUNC()
%20 = add nuw nsw i32 %18, 1
%21 = icmp eq i32 %20, %13
br i1 %21, label %14, label %17
}