#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*/ float_eg();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ show_twocomp();
int /*<<< orphan*/ simple_show();
int /*<<< orphan*/ sscanf(char *, char *, int *);
int /*<<< orphan*/ string_eg();
int /*<<< orphan*/ test_show_bytes(int);
int main(int argc, char *argv[]) {
  int val = 12345;
  if (argc > 1) {
    if (argv[1][0] == '0' && argv[1][1] == 'x')
      sscanf(argv[1] + 2, "%x", &val);
    else
      sscanf(argv[1], "%d", &val);
    printf("calling test_show_bytes\n");
    test_show_bytes(val);
  } else {
    printf("calling show_twocomp\n");
    show_twocomp();
    printf("Calling simple_show\n");
    simple_show();
    printf("Calling float_eg\n");
    float_eg();
    printf("Calling string_eg\n");
    string_eg();
  }
  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)
movl   $0x3039,-0x14(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    1212 <main+0xa2>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movsbl (%rax),%eax
cmp    $0x30,%eax
jne    11e1 <main+0x71>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movsbl 0x1(%rax),%eax
cmp    $0x78,%eax
jne    11e1 <main+0x71>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
add    $0x2,%rdi
lea    0xe2d(%rip),%rsi
lea    -0x14(%rbp),%rdx
call   1070 <sscanf@plt>
jmp    11f9 <main+0x89>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe13(%rip),%rsi
lea    -0x14(%rbp),%rdx
call   1070 <sscanf@plt>
lea    0xe06(%rip),%rdi
call   1040 <printf@plt>
mov    -0x14(%rbp),%edi
call   1090 <test_show_bytes@plt>
jmp    125e <main+0xee>
lea    0xe06(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1080 <show_twocomp@plt>
lea    0xe09(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <simple_show@plt>
lea    0xe0b(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <float_eg@plt>
lea    0xe0a(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1060 <string_eg@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movl   $0x3039,0x4(%rsp)
cmp    $0x2,%edi
jl     119a <main+0x2a>
mov    0x8(%rsi),%rdi
cmpb   $0x30,(%rdi)
jne    11e8 <main+0x78>
cmpb   $0x78,0x1(%rdi)
jne    11e8 <main+0x78>
add    $0x2,%rdi
lea    0xe68(%rip),%rsi
jmp    11ef <main+0x7f>
lea    0xe65(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1080 <show_twocomp@plt>
lea    0xe67(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <simple_show@plt>
lea    0xe68(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1040 <float_eg@plt>
lea    0xe66(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1060 <string_eg@plt>
jmp    120e <main+0x9e>
lea    0xe14(%rip),%rsi
lea    0x4(%rsp),%rdx
call   1070 <sscanf@plt>
lea    0xe52(%rip),%rdi
call   1030 <puts@plt>
mov    0x4(%rsp),%edi
call   1090 <test_show_bytes@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%x\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [25 x i8] c"calling test_show_bytes\0A\00"
@.str.3 = [22 x i8] c"calling show_twocomp\0A\00"
@.str.4 = [21 x i8] c"Calling simple_show\0A\00"
@.str.5 = [18 x i8] c"Calling float_eg\0A\00"
@.str.6 = [19 x i8] c"Calling string_eg\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
store i32 12345, i32* %6
%7 = load i32, i32* %4
%8 = icmp sgt i32 %7, 1
br i1 %8, label %9, label %40
9: ; preds = %2
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 1
%12 = load i8*, i8** %11
%13 = getelementptr inbounds i8, i8* %12, i64 0
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %15, 48
br i1 %16, label %17, label %31
17: ; preds = %9
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 1
%20 = load i8*, i8** %19
%21 = getelementptr inbounds i8, i8* %20, i64 1
%22 = load i8, i8* %21
%23 = sext i8 %22 to i32
%24 = icmp eq i32 %23, 120
br i1 %24, label %25, label %31
25: ; preds = %17
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds i8*, i8** %26, i64 1
%28 = load i8*, i8** %27
%29 = getelementptr inbounds i8, i8* %28, i64 2
%30 = call i32 @sscanf(i8* %29, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %6)
br label %36
31: ; preds = %17, %9
%32 = load i8**, i8*** %5
%33 = getelementptr inbounds i8*, i8** %32, i64 1
%34 = load i8*, i8** %33
%35 = call i32 @sscanf(i8* %34, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
br label %36
36: ; preds = %31, %25
%37 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
%38 = load i32, i32* %6
%39 = call i32 @test_show_bytes(i32 %38)
br label %49
40: ; preds = %2
%41 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0))
%42 = call i32 (...) @show_twocomp()
%43 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
%44 = call i32 (...) @simple_show()
%45 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0))
%46 = call i32 (...) @float_eg()
%47 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0))
%48 = call i32 (...) @string_eg()
br label %49
49: ; preds = %40, %36
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%x\00"
@.str.1 = [3 x i8] c"%d\00"
@str = [21 x i8] c"calling show_twocomp\00"
@str.7 = [20 x i8] c"Calling simple_show\00"
@str.8 = [17 x i8] c"Calling float_eg\00"
@str.9 = [18 x i8] c"Calling string_eg\00"
@str.10 = [24 x i8] c"calling test_show_bytes\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
store i32 12345, i32* %3
%5 = icmp sgt i32 %0, 1
br i1 %5, label %6, label %24
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 48
br i1 %10, label %11, label %18
11: ; preds = %6
%12 = getelementptr inbounds i8, i8* %8, i64 1
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 120
br i1 %14, label %15, label %18
15: ; preds = %11
%16 = getelementptr inbounds i8, i8* %8, i64 2
%17 = call i32 @sscanf(i8* %16, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
br label %20
18: ; preds = %11, %6
%19 = call i32 @sscanf(i8* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
br label %20
20: ; preds = %18, %15
%21 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.10, i64 0, i64 0))
%22 = load i32, i32* %3
%23 = call i32 @test_show_bytes(i32 %22)
br label %33
24: ; preds = %2
%25 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
%26 = tail call i32 (...) @show_twocomp()
%27 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.7, i64 0, i64 0))
%28 = tail call i32 (...) @simple_show()
%29 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.8, i64 0, i64 0))
%30 = tail call i32 (...) @float_eg()
%31 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.9, i64 0, i64 0))
%32 = tail call i32 (...) @string_eg()
br label %33
33: ; preds = %24, %20
ret i32 0
}