#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 atoi(char *);
int /*<<< orphan*/ fizzbuzz(int);
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char *argv[]) {
  if (argc != 2) {
    printf("1 argument required, got %d\n", (argc - 1));
    return 2;
  }
  int i = atoi(argv[1]);
  if (i < 0) {
    printf("%d is less than 0, exiting\n", i);
    return 2;
  }
  fizzbuzz(i);
  return 0;
}


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)
je     116e <main+0x3e>
mov    -0x8(%rbp),%esi
sub    $0x1,%esi
lea    0xea3(%rip),%rdi
call   1040 <printf@plt>
movl   $0x2,-0x4(%rbp)
jmp    11b2 <main+0x82>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    11a3 <main+0x73>
mov    -0x14(%rbp),%esi
lea    0xe8b(%rip),%rdi
call   1040 <printf@plt>
movl   $0x2,-0x4(%rbp)
jmp    11b2 <main+0x82>
mov    -0x14(%rbp),%edi
call   1030 <fizzbuzz@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x2,%edi
jne    114e <main+0x1e>
mov    0x8(%rsi),%rdi
call   1050 <atoi@plt>
test   %eax,%eax
js     115c <main+0x2c>
mov    %eax,%edi
call   1030 <fizzbuzz@plt>
xor    %eax,%eax
pop    %rcx
ret
mov    %edi,%eax
add    $0xffffffff,%eax
lea    0xea6(%rip),%rdi
jmp    1163 <main+0x33>
lea    0xeba(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    $0x2,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [29 x i8] c"1 argument required, got %d\0A\00"
@.str.1 = [28 x i8] c"%d is less than 0, exiting\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp ne i32 %7, 2
br i1 %8, label %9, label %13
9: ; preds = %2
%10 = load i32, i32* %4
%11 = sub nsw i32 %10, 1
%12 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 %11)
store i32 2, i32* %3
br label %26
13: ; preds = %2
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = call i32 @atoi(i8* %16)
store i32 %17, i32* %6
%18 = load i32, i32* %6
%19 = icmp slt i32 %18, 0
br i1 %19, label %20, label %23
20: ; preds = %13
%21 = load i32, i32* %6
%22 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i32 %21)
store i32 2, i32* %3
br label %26
23: ; preds = %13
%24 = load i32, i32* %6
%25 = call i32 @fizzbuzz(i32 %24)
store i32 0, i32* %3
br label %26
26: ; preds = %23, %20, %9
%27 = load i32, i32* %3
ret i32 %27
}

LLVM IR (-O2):
@.str = [29 x i8] c"1 argument required, got %d\0A\00"
@.str.1 = [28 x i8] c"%d is less than 0, exiting\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %7, label %4
4: ; preds = %2
%5 = add nsw i32 %0, -1
%6 = tail call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 %5)
br label %16
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = tail call i32 @atoi(i8* %9)
%11 = icmp slt i32 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %7
%13 = tail call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i32 %10)
br label %16
14: ; preds = %7
%15 = tail call i32 @fizzbuzz(i32 %10)
br label %16
16: ; preds = %12, %14, %4
%17 = phi i32 [ 2, %4 ], [ 2, %12 ], [ 0, %14 ]
ret i32 %17
}