#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*/ printf(char *);
void hello(int a) {
  while (a-- > 0) {
    if (a == 1) {
      printf("Hello World\n");
    } else if (a == 2) {
      printf("To C or not to C, that is the question!!\n");
    } else {
      printf("Invalid Argument\n");
      return;
    }
  }
}


x86 assembly (clang, -O0):
<hello>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x4(%rbp)
cmp    $0x0,%eax
jle    1180 <hello+0x70>
cmpl   $0x1,-0x4(%rbp)
jne    114a <hello+0x3a>
lea    0xec0(%rip),%rdi
call   1030 <printf@plt>
jmp    117b <hello+0x6b>
cmpl   $0x2,-0x4(%rbp)
jne    1165 <hello+0x55>
lea    0xeb2(%rip),%rdi
call   1030 <printf@plt>
jmp    1176 <hello+0x66>
lea    0xecb(%rip),%rdi
call   1030 <printf@plt>
jmp    1180 <hello+0x70>
jmp    117b <hello+0x6b>
jmp    111b <hello+0xb>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hello>:
test   %edi,%edi
jle    1159 <hello+0x49>
push   %r15
push   %r14
push   %rbx
mov    %edi,%ebx
lea    0xf18(%rip),%r14
lea    0xee8(%rip),%r15
jmp    113b <hello+0x2b>
nopl   0x0(%rax,%rax,1)
mov    %r15,%rdi
call   1030 <puts@plt>
add    $0xffffffff,%ebx
mov    %r14,%rdi
cmp    $0x2,%ebx
je     1133 <hello+0x23>
cmp    $0x3,%ebx
je     1130 <hello+0x20>
lea    0xeb1(%rip),%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <puts@plt>
ret

LLVM IR (-O0):
@.str = [13 x i8] c"Hello World\0A\00"
@.str.1 = [42 x i8] c"To C or not to C, that is the question!!\0A\00"
@.str.2 = [18 x i8] c"Invalid Argument\0A\00"
define void @hello(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
br label %3
3: ; preds = %20, %1
%4 = load i32, i32* %2
%5 = add nsw i32 %4, -1
store i32 %5, i32* %2
%6 = icmp sgt i32 %4, 0
br i1 %6, label %7, label %21
7: ; preds = %3
%8 = load i32, i32* %2
%9 = icmp eq i32 %8, 1
br i1 %9, label %10, label %12
10: ; preds = %7
%11 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
br label %20
12: ; preds = %7
%13 = load i32, i32* %2
%14 = icmp eq i32 %13, 2
br i1 %14, label %15, label %17
15: ; preds = %12
%16 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0))
br label %19
17: ; preds = %12
%18 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
br label %21
19: ; preds = %15
br label %20
20: ; preds = %19, %10
br label %3
21: ; preds = %17, %3
ret void
}

LLVM IR (-O2):
@str = [17 x i8] c"Invalid Argument\00"
@str.3 = [41 x i8] c"To C or not to C, that is the question!!\00"
@str.4 = [12 x i8] c"Hello World\00"
define void @hello(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %3, label %12
3: ; preds = %1, %9
%4 = phi i32 [ %5, %9 ], [ %0, %1 ]
%5 = add nsw i32 %4, -1
switch i32 %4, label %7 [
i32 2, label %9
i32 3, label %6
]
6: ; preds = %3
br label %9
7: ; preds = %3
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
br label %12
9: ; preds = %3, %6
%10 = phi i8* [ getelementptr inbounds ([41 x i8], [41 x i8]* @str.3, i64 0, i64 0), %6 ], [ getelementptr inbounds ([12 x i8], [12 x i8]* @str.4, i64 0, i64 0), %3 ]
%11 = tail call i32 @puts(i8* dereferenceable(1) %10)
br label %3
12: ; preds = %1, %7
ret void
}