#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*/ test_gethostx();
int /*<<< orphan*/ test_memoire();
int /*<<< orphan*/ test_printf(char *);
int /*<<< orphan*/ test_pthread();
int /*<<< orphan*/ test_scan_1_car(char *);
int api_main() {
  char c;
  test_printf(" 0 pour les test host,\n");
  test_printf(" 1 pour les test memoire,\n");
  test_printf(" 2 pour les test api,\n");
  test_printf(" entrer une valeur : ");
  test_scan_1_car(&c);
  if ('0' == c) {
    test_gethostx();
  }
  if ('1' == c) {
    test_memoire();
  }
  if ('2' == c) {
    test_pthread();
  }
  test_printf("\nFin test api\n");
  return 0;
}


x86 assembly (clang, -O0):
<api_main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xea1(%rip),%rdi
call   1050 <test_printf@plt>
lea    0xead(%rip),%rdi
call   1050 <test_printf@plt>
lea    0xebc(%rip),%rdi
call   1050 <test_printf@plt>
lea    0xec7(%rip),%rdi
call   1050 <test_printf@plt>
lea    -0x1(%rbp),%rdi
call   1060 <test_scan_1_car@plt>
movsbl -0x1(%rbp),%ecx
mov    $0x30,%eax
cmp    %ecx,%eax
jne    11a9 <api_main+0x59>
mov    $0x0,%al
call   1070 <test_gethostx@plt>
movsbl -0x1(%rbp),%ecx
mov    $0x31,%eax
cmp    %ecx,%eax
jne    11c1 <api_main+0x71>
mov    $0x0,%al
call   1040 <test_memoire@plt>
movsbl -0x1(%rbp),%ecx
mov    $0x32,%eax
cmp    %ecx,%eax
jne    11d9 <api_main+0x89>
mov    $0x0,%al
call   1030 <test_pthread@plt>
lea    0xe80(%rip),%rdi
call   1050 <test_printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<api_main>:
push   %rax
lea    0xea8(%rip),%rdi
call   1050 <test_printf@plt>
lea    0xeb4(%rip),%rdi
call   1050 <test_printf@plt>
lea    0xec3(%rip),%rdi
call   1050 <test_printf@plt>
lea    0xece(%rip),%rdi
call   1050 <test_printf@plt>
lea    0x7(%rsp),%rdi
call   1060 <test_scan_1_car@plt>
mov    0x7(%rsp),%al
cmp    $0x30,%al
je     11b2 <api_main+0x62>
cmp    $0x31,%al
je     11c1 <api_main+0x71>
cmp    $0x32,%al
jne    11a2 <api_main+0x52>
xor    %eax,%eax
call   1030 <test_pthread@plt>
lea    0xeb7(%rip),%rdi
call   1050 <test_printf@plt>
xor    %eax,%eax
pop    %rcx
ret
xor    %eax,%eax
call   1070 <test_gethostx@plt>
mov    0x7(%rsp),%al
cmp    $0x31,%al
jne    1197 <api_main+0x47>
xor    %eax,%eax
call   1040 <test_memoire@plt>
mov    0x7(%rsp),%al
cmp    $0x32,%al
je     119b <api_main+0x4b>
jmp    11a2 <api_main+0x52>

LLVM IR (-O0):
@.str = [24 x i8] c" 0 pour les test host,\0A\00"
@.str.1 = [27 x i8] c" 1 pour les test memoire,\0A\00"
@.str.2 = [23 x i8] c" 2 pour les test api,\0A\00"
@.str.3 = [22 x i8] c" entrer une valeur : \00"
@.str.4 = [15 x i8] c"\0AFin test api\0A\00"
define i32 @api_main() {
%1 = alloca i8
%2 = call i32 @test_printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @test_printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 @test_printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
%5 = call i32 @test_printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0))
%6 = call i32 @test_scan_1_car(i8* %1)
%7 = load i8, i8* %1
%8 = sext i8 %7 to i32
%9 = icmp eq i32 48, %8
br i1 %9, label %10, label %12
10: ; preds = %0
%11 = call i32 (...) @test_gethostx()
br label %12
12: ; preds = %10, %0
%13 = load i8, i8* %1
%14 = sext i8 %13 to i32
%15 = icmp eq i32 49, %14
br i1 %15, label %16, label %18
16: ; preds = %12
%17 = call i32 (...) @test_memoire()
br label %18
18: ; preds = %16, %12
%19 = load i8, i8* %1
%20 = sext i8 %19 to i32
%21 = icmp eq i32 50, %20
br i1 %21, label %22, label %24
22: ; preds = %18
%23 = call i32 (...) @test_pthread()
br label %24
24: ; preds = %22, %18
%25 = call i32 @test_printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [24 x i8] c" 0 pour les test host,\0A\00"
@.str.1 = [27 x i8] c" 1 pour les test memoire,\0A\00"
@.str.2 = [23 x i8] c" 2 pour les test api,\0A\00"
@.str.3 = [22 x i8] c" entrer une valeur : \00"
@.str.4 = [15 x i8] c"\0AFin test api\0A\00"
define i32 @api_main() {
%1 = alloca i8
%2 = tail call i32 @test_printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @test_printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 @test_printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
%5 = tail call i32 @test_printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0))
%6 = call i32 @test_scan_1_car(i8* %1)
%7 = load i8, i8* %1
%8 = icmp eq i8 %7, 48
br i1 %8, label %9, label %12
9: ; preds = %0
%10 = call i32 (...) @test_gethostx()
%11 = load i8, i8* %1
br label %12
12: ; preds = %9, %0
%13 = phi i8 [ %11, %9 ], [ %7, %0 ]
%14 = icmp eq i8 %13, 49
br i1 %14, label %15, label %18
15: ; preds = %12
%16 = call i32 (...) @test_memoire()
%17 = load i8, i8* %1
br label %18
18: ; preds = %15, %12
%19 = phi i8 [ %17, %15 ], [ %13, %12 ]
%20 = icmp eq i8 %19, 50
br i1 %20, label %21, label %23
21: ; preds = %18
%22 = call i32 (...) @test_pthread()
br label %23
23: ; preds = %21, %18
%24 = call i32 @test_printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0))
ret i32 0
}