#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 check(int, int *);
int /*<<< orphan*/ clear();
int /*<<< orphan*/ greet();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ show(int, int *);
int main(int argc, char *argv[]) {
  if (argc != 2) {
    printf("Usage: %s n\n", argv[0]);
    return 1;
  }
  int n = atoi(argv[1]);
  int f = 0;
  printf("%u", n);
  greet();
  while (!f) {
    clear();
    show(n, &n);
    f = check(n, &n);
  }
  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     11a1 <main+0x41>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe72(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1214 <main+0xb4>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1070 <atoi@plt>
mov    %eax,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x14(%rbp),%esi
lea    0xe4b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1050 <greet@plt>
cmpl   $0x0,-0x18(%rbp)
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    11e6 <main+0x86>
jmp    120d <main+0xad>
mov    $0x0,%al
call   1080 <clear@plt>
mov    -0x14(%rbp),%edi
lea    -0x14(%rbp),%rsi
call   1040 <show@plt>
mov    -0x14(%rbp),%edi
lea    -0x14(%rbp),%rsi
call   1060 <check@plt>
mov    %eax,-0x18(%rbp)
jmp    11d0 <main+0x70>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
cmp    $0x2,%edi
jne    11c7 <main+0x67>
mov    0x8(%rsi),%rdi
call   1070 <atoi@plt>
mov    %eax,0xc(%rsp)
lea    0xe8f(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
call   1050 <greet@plt>
lea    0xc(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %eax,%eax
call   1080 <clear@plt>
mov    0xc(%rsp),%edi
mov    %rbx,%rsi
call   1040 <show@plt>
mov    0xc(%rsp),%edi
mov    %rbx,%rsi
call   1060 <check@plt>
test   %eax,%eax
je     11a0 <main+0x40>
xor    %eax,%eax
jmp    11dd <main+0x7d>
mov    (%rsi),%rsi
lea    0xe2f(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"Usage: %s n\0A\00"
@.str.1 = [3 x i8] c"%u\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = icmp ne i32 %8, 2
br i1 %9, label %10, label %15
10: ; preds = %2
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 0
%13 = load i8*, i8** %12
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %13)
store i32 1, i32* %3
br label %34
15: ; preds = %2
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 1
%18 = load i8*, i8** %17
%19 = call i32 @atoi(i8* %18)
store i32 %19, i32* %6
store i32 0, i32* %7
%20 = load i32, i32* %6
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %20)
%22 = call i32 (...) @greet()
br label %23
23: ; preds = %27, %15
%24 = load i32, i32* %7
%25 = icmp ne i32 %24, 0
%26 = xor i1 %25, true
br i1 %26, label %27, label %33
27: ; preds = %23
%28 = call i32 (...) @clear()
%29 = load i32, i32* %6
%30 = call i32 @show(i32 %29, i32* %6)
%31 = load i32, i32* %6
%32 = call i32 @check(i32 %31, i32* %6)
store i32 %32, i32* %7
br label %23
33: ; preds = %23
store i32 0, i32* %3
br label %34
34: ; preds = %33, %10
%35 = load i32, i32* %3
ret i32 %35
}

LLVM IR (-O2):
@.str = [13 x i8] c"Usage: %s n\0A\00"
@.str.1 = [3 x i8] c"%u\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = icmp eq i32 %0, 2
br i1 %4, label %8, label %5
5: ; preds = %2
%6 = load i8*, i8** %1
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %6)
br label %23
8: ; preds = %2
%9 = bitcast i32* %3 to i8*
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = tail call i32 @atoi(i8* %11)
store i32 %12, i32* %3
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %12)
%14 = tail call i32 (...) @greet()
br label %15
15: ; preds = %8, %15
%16 = call i32 (...) @clear()
%17 = load i32, i32* %3
%18 = call i32 @show(i32 %17, i32* %3)
%19 = load i32, i32* %3
%20 = call i32 @check(i32 %19, i32* %3)
%21 = icmp eq i32 %20, 0
br i1 %21, label %15, label %22
22: ; preds = %15
br label %23
23: ; preds = %22, %5
%24 = phi i32 [ 1, %5 ], [ 0, %22 ]
ret i32 %24
}