#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 EXIT_SUCCESS;
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ shutdown();
scalar_t__ startup(int);
int main(int argc, char *argv[]) {
  int ctr;
  puts("Greetings, user.");
  puts("Checking...  please wait...");
  if (startup(argc)) {
    for (ctr = 1; ctr < argc; ctr++) {
      puts(argv[ctr]);
    }
  }
  shutdown();
  puts("Goodbye, user.");
  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)
lea    0xeb3(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb8(%rip),%rdi
call   1030 <puts@plt>
mov    -0x8(%rbp),%edi
call   1050 <startup@plt>
cmp    $0x0,%rax
je     11a7 <main+0x77>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11a2 <main+0x72>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <puts@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1177 <main+0x47>
jmp    11a7 <main+0x77>
mov    $0x0,%al
call   1040 <shutdown@plt>
lea    0xe78(%rip),%rdi
call   1030 <puts@plt>
mov    0x2e1f(%rip),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %edi,%ebp
lea    0xec0(%rip),%rdi
call   1030 <puts@plt>
lea    0xec5(%rip),%rdi
call   1030 <puts@plt>
mov    %ebp,%edi
call   1050 <startup@plt>
test   %rax,%rax
je     1182 <main+0x52>
cmp    $0x2,%ebp
jl     1182 <main+0x52>
mov    %ebp,%ebp
mov    $0x1,%ebx
nopl   0x0(%rax)
mov    (%r14,%rbx,8),%rdi
call   1030 <puts@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1170 <main+0x40>
xor    %eax,%eax
call   1040 <shutdown@plt>
lea    0xe9d(%rip),%rdi
call   1030 <puts@plt>
mov    0x2e44(%rip),%rax
mov    (%rax),%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [17 x i8] c"Greetings, user.\00"
@.str.1 = [28 x i8] c"Checking... please wait...\00"
@.str.2 = [15 x i8] c"Goodbye, user.\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
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32 @puts(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @puts(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
%9 = load i32, i32* %4
%10 = call i64 @startup(i32 %9)
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %28
12: ; preds = %2
store i32 1, i32* %6
br label %13
13: ; preds = %24, %12
%14 = load i32, i32* %6
%15 = load i32, i32* %4
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %27
17: ; preds = %13
%18 = load i8**, i8*** %5
%19 = load i32, i32* %6
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8*, i8** %18, i64 %20
%22 = load i8*, i8** %21
%23 = call i32 @puts(i8* %22)
br label %24
24: ; preds = %17
%25 = load i32, i32* %6
%26 = add nsw i32 %25, 1
store i32 %26, i32* %6
br label %13
27: ; preds = %13
br label %28
28: ; preds = %27, %2
%29 = call i32 (...) @shutdown()
%30 = call i32 @puts(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
%31 = load i32, i32* @EXIT_SUCCESS
ret i32 %31
}

LLVM IR (-O2):
@.str = [17 x i8] c"Greetings, user.\00"
@.str.1 = [28 x i8] c"Checking... please wait...\00"
@.str.2 = [15 x i8] c"Goodbye, user.\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i64 @startup(i32 %0)
%6 = icmp ne i64 %5, 0
%7 = icmp sgt i32 %0, 1
%8 = and i1 %6, %7
br i1 %8, label %9, label %18
9: ; preds = %2
%10 = zext i32 %0 to i64
br label %11
11: ; preds = %9, %11
%12 = phi i64 [ 1, %9 ], [ %16, %11 ]
%13 = getelementptr inbounds i8*, i8** %1, i64 %12
%14 = load i8*, i8** %13
%15 = tail call i32 @puts(i8* dereferenceable(1) %14)
%16 = add nuw nsw i64 %12, 1
%17 = icmp eq i64 %16, %10
br i1 %17, label %18, label %11
18: ; preds = %11, %2
%19 = tail call i32 (...) @shutdown()
%20 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
%21 = load i32, i32* @EXIT_SUCCESS
ret i32 %21
}