#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*/ exit(int);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[], char *envp[]) {
  if (argc < 2) {
    printf("I must receive a name to greet!\n");
    exit(1);
  }
  int nTimes;
  if (argc == 3) {
    nTimes = atoi(argv[2]);
  } else {
    nTimes = 1;
  }
  if (nTimes < 1) {
    printf("I can't show a message less than 1 times!\n");
    exit(2);
  }
  int i;
  for (i = 0; i < nTimes; i++) {
    printf("Hello %s!\n", argv[1]);
  }
}


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)
mov    %rdx,-0x18(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    116c <main+0x3c>
lea    0xea5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
cmpl   $0x3,-0x8(%rbp)
jne    118b <main+0x5b>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1040 <atoi@plt>
mov    %eax,-0x1c(%rbp)
jmp    1192 <main+0x62>
movl   $0x1,-0x1c(%rbp)
cmpl   $0x1,-0x1c(%rbp)
jge    11b4 <main+0x84>
lea    0xe7e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x2,%edi
call   1050 <exit@plt>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    11eb <main+0xbb>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xe76(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11bb <main+0x8b>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
cmp    $0x1,%edi
jle    118a <main+0x4a>
mov    %rsi,%rbx
mov    $0x1,%ebp
cmp    $0x3,%edi
jne    1165 <main+0x25>
mov    0x10(%rbx),%rdi
call   1050 <atoi@plt>
mov    %eax,%ebp
test   %eax,%eax
jle    11a0 <main+0x60>
lea    0xe94(%rip),%r14
nopl   0x0(%rax)
mov    0x8(%rbx),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0xffffffff,%ebp
jne    1170 <main+0x30>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret
lea    0xea4(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
lea    0xe64(%rip),%rdi
call   1030 <puts@plt>
mov    $0x2,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [33 x i8] c"I must receive a name to greet!\0A\00"
@.str.1 = [43 x i8] c"I can't show a message less than 1 times!\0A\00"
@.str.2 = [11 x i8] c"Hello %s!\0A\00"
define i32 @main(i32 %0, i8** %1, i8** %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8**
%7 = alloca i8**
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %4
store i32 %0, i32* %5
store i8** %1, i8*** %6
store i8** %2, i8*** %7
%10 = load i32, i32* %5
%11 = icmp slt i32 %10, 2
br i1 %11, label %12, label %15
12: ; preds = %3
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%14 = call i32 @exit(i32 1)
unreachable
15: ; preds = %3
%16 = load i32, i32* %5
%17 = icmp eq i32 %16, 3
br i1 %17, label %18, label %23
18: ; preds = %15
%19 = load i8**, i8*** %6
%20 = getelementptr inbounds i8*, i8** %19, i64 2
%21 = load i8*, i8** %20
%22 = call i32 @atoi(i8* %21)
store i32 %22, i32* %8
br label %24
23: ; preds = %15
store i32 1, i32* %8
br label %24
24: ; preds = %23, %18
%25 = load i32, i32* %8
%26 = icmp slt i32 %25, 1
br i1 %26, label %27, label %30
27: ; preds = %24
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0))
%29 = call i32 @exit(i32 2)
unreachable
30: ; preds = %24
store i32 0, i32* %9
br label %31
31: ; preds = %40, %30
%32 = load i32, i32* %9
%33 = load i32, i32* %8
%34 = icmp slt i32 %32, %33
br i1 %34, label %35, label %43
35: ; preds = %31
%36 = load i8**, i8*** %6
%37 = getelementptr inbounds i8*, i8** %36, i64 1
%38 = load i8*, i8** %37
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* %38)
br label %40
40: ; preds = %35
%41 = load i32, i32* %9
%42 = add nsw i32 %41, 1
store i32 %42, i32* %9
br label %31
43: ; preds = %31
%44 = load i32, i32* %4
ret i32 %44
}

LLVM IR (-O2):
@.str.2 = [11 x i8] c"Hello %s!\0A\00"
@str = [42 x i8] c"I can't show a message less than 1 times!\00"
@str.3 = [32 x i8] c"I must receive a name to greet!\00"
define i32 @main(i32 %0, i8** nocapture %1, i8** nocapture readnone %2) {
%4 = icmp slt i32 %0, 2
br i1 %4, label %5, label %8
5: ; preds = %3
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.3, i64 0, i64 0))
%7 = tail call i32 @exit(i32 1)
unreachable
8: ; preds = %3
%9 = icmp eq i32 %0, 3
br i1 %9, label %10, label %15
10: ; preds = %8
%11 = getelementptr inbounds i8*, i8** %1, i64 2
%12 = load i8*, i8** %11
%13 = tail call i32 @atoi(i8* %12)
%14 = icmp slt i32 %13, 1
br i1 %14, label %18, label %15
15: ; preds = %8, %10
%16 = phi i32 [ %13, %10 ], [ 1, %8 ]
%17 = getelementptr inbounds i8*, i8** %1, i64 1
br label %21
18: ; preds = %10
%19 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str, i64 0, i64 0))
%20 = tail call i32 @exit(i32 2)
unreachable
21: ; preds = %15, %21
%22 = phi i32 [ 0, %15 ], [ %25, %21 ]
%23 = load i8*, i8** %17
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* %23)
%25 = add nuw nsw i32 %22, 1
%26 = icmp eq i32 %25, %16
br i1 %26, label %27, label %21
27: ; preds = %21
ret i32 0
}