#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_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ assert(int);
int atoi(char *);
int bar();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int foo(int, int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  int i, l, s, r;
  if (argc != 3) {
    fprintf(stderr, "usage: %s number_of_iterations matrix_size\n", argv[0]);
    exit(EXIT_FAILURE);
  }
  l = atoi(argv[1]);
  s = atoi(argv[2]);
  for (i = 0; i < l; i++) {
    r = foo(s, s);
    assert(r == s + s);
    r = bar();
    assert(r == 42);
  }
  printf("%d\n", l);
  return EXIT_SUCCESS;
}


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   $0x3,-0x8(%rbp)
je     11ba <main+0x4a>
mov    0x2e49(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe59(%rip),%rsi
call   1060 <fprintf@plt>
mov    0x2e25(%rip),%rax
mov    (%rax),%edi
call   1090 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1080 <atoi@plt>
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1080 <atoi@plt>
mov    %eax,-0x1c(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    123c <main+0xcc>
mov    -0x1c(%rbp),%edi
mov    -0x1c(%rbp),%esi
call   1070 <foo@plt>
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    -0x1c(%rbp),%ecx
add    -0x1c(%rbp),%ecx
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    $0x0,%al
call   1030 <bar@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x2a,-0x20(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11e1 <main+0x71>
mov    -0x18(%rbp),%esi
lea    0xde6(%rip),%rdi
call   1040 <printf@plt>
mov    0x2d7e(%rip),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbp
cmp    $0x3,%edi
jne    1204 <main+0x94>
mov    0x8(%rbp),%rdi
call   1080 <atoi@plt>
mov    %eax,%r14d
mov    0x10(%rbp),%rdi
call   1080 <atoi@plt>
test   %r14d,%r14d
jle    11e1 <main+0x71>
mov    %eax,%ebp
mov    %eax,%r15d
add    %ebp,%r15d
mov    %r14d,%ebx
nopl   0x0(%rax,%rax,1)
mov    %ebp,%edi
mov    %ebp,%esi
call   1070 <foo@plt>
xor    %edi,%edi
cmp    %r15d,%eax
sete   %dil
call   1050 <assert@plt>
xor    %eax,%eax
call   1030 <bar@plt>
xor    %edi,%edi
cmp    $0x2a,%eax
sete   %dil
call   1050 <assert@plt>
add    $0xffffffff,%ebx
jne    11b0 <main+0x40>
lea    0xe44(%rip),%rdi
mov    %r14d,%esi
call   1040 <printf@plt>
mov    0x2dd9(%rip),%rax
mov    (%rax),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2dd5(%rip),%rax
mov    (%rax),%edi
mov    0x0(%rbp),%rdx
lea    0xde8(%rip),%rsi
call   1060 <fprintf@plt>
mov    0x2db4(%rip),%rax
mov    (%rax),%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [44 x i8] c"usage: %s number_of_iterations matrix_size\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [4 x i8] c"%d\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i32, i32* %4
%11 = icmp ne i32 %10, 3
br i1 %11, label %12, label %20
12: ; preds = %2
%13 = load i32, i32* @stderr
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 0
%16 = load i8*, i8** %15
%17 = call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i8* %16)
%18 = load i32, i32* @EXIT_FAILURE
%19 = call i32 @exit(i32 %18)
unreachable
20: ; preds = %2
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 1
%23 = load i8*, i8** %22
%24 = call i32 @atoi(i8* %23)
store i32 %24, i32* %7
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 2
%27 = load i8*, i8** %26
%28 = call i32 @atoi(i8* %27)
store i32 %28, i32* %8
store i32 0, i32* %6
br label %29
29: ; preds = %49, %20
%30 = load i32, i32* %6
%31 = load i32, i32* %7
%32 = icmp slt i32 %30, %31
br i1 %32, label %33, label %52
33: ; preds = %29
%34 = load i32, i32* %8
%35 = load i32, i32* %8
%36 = call i32 @foo(i32 %34, i32 %35)
store i32 %36, i32* %9
%37 = load i32, i32* %9
%38 = load i32, i32* %8
%39 = load i32, i32* %8
%40 = add nsw i32 %38, %39
%41 = icmp eq i32 %37, %40
%42 = zext i1 %41 to i32
%43 = call i32 @assert(i32 %42)
%44 = call i32 (...) @bar()
store i32 %44, i32* %9
%45 = load i32, i32* %9
%46 = icmp eq i32 %45, 42
%47 = zext i1 %46 to i32
%48 = call i32 @assert(i32 %47)
br label %49
49: ; preds = %33
%50 = load i32, i32* %6
%51 = add nsw i32 %50, 1
store i32 %51, i32* %6
br label %29
52: ; preds = %29
%53 = load i32, i32* %7
%54 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %53)
%55 = load i32, i32* @EXIT_SUCCESS
ret i32 %55
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [44 x i8] c"usage: %s number_of_iterations matrix_size\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [4 x i8] c"%d\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 3
br i1 %3, label %10, label %4
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = load i8*, i8** %1
%7 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = load i32, i32* @EXIT_FAILURE
%9 = tail call i32 @exit(i32 %8)
unreachable
10: ; preds = %2
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = tail call i32 @atoi(i8* %12)
%14 = getelementptr inbounds i8*, i8** %1, i64 2
%15 = load i8*, i8** %14
%16 = tail call i32 @atoi(i8* %15)
%17 = icmp sgt i32 %13, 0
br i1 %17, label %18, label %32
18: ; preds = %10
%19 = shl nsw i32 %16, 1
br label %20
20: ; preds = %18, %20
%21 = phi i32 [ 0, %18 ], [ %30, %20 ]
%22 = tail call i32 @foo(i32 %16, i32 %16)
%23 = icmp eq i32 %22, %19
%24 = zext i1 %23 to i32
%25 = tail call i32 @assert(i32 %24)
%26 = tail call i32 (...) @bar()
%27 = icmp eq i32 %26, 42
%28 = zext i1 %27 to i32
%29 = tail call i32 @assert(i32 %28)
%30 = add nuw nsw i32 %21, 1
%31 = icmp eq i32 %30, %13
br i1 %31, label %32, label %20
32: ; preds = %20, %10
%33 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %13)
%34 = load i32, i32* @EXIT_SUCCESS
ret i32 %34
}