#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*/ close_mmap();
int /*<<< orphan*/ exec_shell();
int /*<<< orphan*/ exec_shell2();
int /*<<< orphan*/ mp_example0();
int /*<<< orphan*/ mp_example1();
int /*<<< orphan*/ mp_example2();
int /*<<< orphan*/ mp_example3();
int /*<<< orphan*/ mp_example4();
int /*<<< orphan*/ mp_example5();
int open_anony_mmap();
int open_mmap();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ pthread_test();
int /*<<< orphan*/ pthread_test2();
int /*<<< orphan*/ pthread_test3();
int /*<<< orphan*/ read_file(char *);
int /*<<< orphan*/ read_mem();
int /*<<< orphan*/ shmem_test();
int /*<<< orphan*/ sig_test1();
int /*<<< orphan*/ sig_test2();
int /*<<< orphan*/ sig_test3();
int tcp_client_setup();
int /*<<< orphan*/ tcp_client_work();
int tcp_server_setup();
int /*<<< orphan*/ tcp_server_work();
int /*<<< orphan*/ write_file(char *);
int /*<<< orphan*/ write_mem();
int main(int argc, char *argv[]) {
  if (argc != 2) {
    printf("usage: xx yy\nyy=0 file test\n=1 tcp server\n=2 tcp client\n"
           "=3 udp server\n=4 udp client\n=5 mem test\n=6 multi process\n"
           "=7 multi thread\n=8 sys/procfs\n=9 share mem(api)\n");
    return 0;
  }
  int method = atoi(argv[1]);
  switch (method) {
  case 0:
    printf("write-read file\n");
    write_file("./testfile");
    read_file("./testfile");
    break;
  case 1:
    printf("tcp server\n");
    int sret = tcp_server_setup();
    if (!sret)
      tcp_server_work();
    printf("tcp server err %d\n", sret);
    printf("done\n");
    break;
  case 2:
    printf("f tcp client\n");
    int cret = tcp_client_setup();
    if (!cret)
      tcp_client_work();
    printf("tcp client  err %d\n", cret);
    break;
  case 3:
    printf("udp server\n");
    break;
  case 4:
    printf("udp client\n");
    break;
  case 5:
    printf("mem\n");
    int mret = open_mmap();
    if (!mret) {
      read_mem();
      write_mem();
      read_mem();
      close_mmap();
    }
    printf("anonymous map\n");
    mret = open_anony_mmap();
    if (!mret) {
      read_mem();
      write_mem();
      read_mem();
      close_mmap();
    }
    break;
  case 6:
    printf("multi process\n");
    printf("test 0\n");
    mp_example0();
    printf("test 1\n");
    mp_example1();
    printf("test 2\n");
    mp_example2();
    printf("test 3\n");
    mp_example3();
    printf("test 4\n");
    mp_example4();
    printf("test 5\n");
    mp_example5();
    break;
  case 7:
    printf("multi thread\n10\n");
    printf("test 0\n");
    pthread_test();
    printf("test 1\n");
    pthread_test2();
    printf("test 2\n");
    pthread_test3();
    break;
  case 8:
    printf("sys test\n");
    printf("shell exec\n");
    printf("test 0\n");
    exec_shell();
    printf("test 1\n");
    exec_shell2();
  case 9:
    printf("sharing memory\n");
    shmem_test();
    break;
  case 10:
    printf("signal\n");
    sig_test1();
    sig_test2();
    sig_test3();
    break;
  default:
    break;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     12fa <main+0x3a>
lea    0xd45(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1604 <main+0x344>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   11a0 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %rax,-0x28(%rbp)
sub    $0xa,%rax
ja     15f8 <main+0x338>
mov    -0x28(%rbp),%rax
lea    0xcda(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xd98(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xd9b(%rip),%rdi
call   1070 <write_file@plt>
lea    0xd8f(%rip),%rdi
call   1110 <read_file@plt>
jmp    15fd <main+0x33d>
lea    0xd89(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x0,%al
call   10a0 <tcp_server_setup@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jne    1383 <main+0xc3>
mov    $0x0,%al
call   1120 <tcp_server_work@plt>
mov    -0x18(%rbp),%esi
lea    0xd69(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xd6e(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    15fd <main+0x33d>
lea    0xd61(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x0,%al
call   10c0 <tcp_client_setup@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jne    13d0 <main+0x110>
mov    $0x0,%al
call   10f0 <tcp_client_work@plt>
mov    -0x1c(%rbp),%esi
lea    0xd43(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    15fd <main+0x33d>
lea    0xd44(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    15fd <main+0x33d>
lea    0xd3d(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    15fd <main+0x33d>
lea    0xd36(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x0,%al
call   1030 <open_mmap@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
jne    144a <main+0x18a>
mov    $0x0,%al
call   1180 <read_mem@plt>
mov    $0x0,%al
call   11b0 <write_mem@plt>
mov    $0x0,%al
call   1180 <read_mem@plt>
mov    $0x0,%al
call   1040 <close_mmap@plt>
lea    0xcfd(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x0,%al
call   1100 <open_anony_mmap@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
jne    1488 <main+0x1c8>
mov    $0x0,%al
call   1180 <read_mem@plt>
mov    $0x0,%al
call   11b0 <write_mem@plt>
mov    $0x0,%al
call   1180 <read_mem@plt>
mov    $0x0,%al
call   1040 <close_mmap@plt>
jmp    15fd <main+0x33d>
lea    0xcc9(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xcca(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x0,%al
call   11c0 <mp_example0@plt>
lea    0xcbd(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x0,%al
call   10b0 <mp_example1@plt>
lea    0xcb0(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x0,%al
call   11d0 <mp_example2@plt>
lea    0xca3(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x0,%al
call   10e0 <mp_example3@plt>
lea    0xc96(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x0,%al
call   11e0 <mp_example4@plt>
lea    0xc89(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x0,%al
call   10d0 <mp_example5@plt>
jmp    15fd <main+0x33d>
lea    0xc77(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xc39(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x0,%al
call   1140 <pthread_test@plt>
lea    0xc2c(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x0,%al
call   1050 <pthread_test2@plt>
lea    0xc1f(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x0,%al
call   1130 <pthread_test3@plt>
jmp    15fd <main+0x33d>
lea    0xc36(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xc32(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xbd9(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x0,%al
call   1170 <exec_shell@plt>
lea    0xbcc(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x0,%al
call   1160 <exec_shell2@plt>
lea    0xc06(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x0,%al
call   1150 <shmem_test@plt>
jmp    15fd <main+0x33d>
lea    0xbfc(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x0,%al
call   1090 <sig_test1@plt>
mov    $0x0,%al
call   1190 <sig_test2@plt>
mov    $0x0,%al
call   1080 <sig_test3@plt>
jmp    15fd <main+0x33d>
jmp    15fd <main+0x33d>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
cmp    $0x2,%edi
jne    131b <main+0x4b>
mov    0x8(%rsi),%rdi
call   11b0 <atoi@plt>
cmp    $0xa,%eax
ja     1327 <main+0x57>
mov    %eax,%eax
lea    0xd13(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xe18(%rip),%rdi
call   1050 <puts@plt>
lea    0xd23(%rip),%rbx
mov    %rbx,%rdi
call   1080 <write_file@plt>
mov    %rbx,%rdi
call   1120 <read_file@plt>
jmp    1327 <main+0x57>
lea    0xe03(%rip),%rdi
call   1050 <puts@plt>
xor    %eax,%eax
pop    %rbx
ret
lea    0xdd3(%rip),%rdi
call   1050 <puts@plt>
xor    %eax,%eax
call   10b0 <tcp_server_setup@plt>
mov    %eax,%ebx
test   %eax,%eax
jne    134b <main+0x7b>
xor    %eax,%eax
call   1130 <tcp_server_work@plt>
lea    0xce5(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xdae(%rip),%rdi
jmp    1322 <main+0x52>
lea    0xd8d(%rip),%rdi
call   1050 <puts@plt>
xor    %eax,%eax
call   10d0 <tcp_client_setup@plt>
mov    %eax,%ebx
test   %eax,%eax
jne    1384 <main+0xb4>
xor    %eax,%eax
call   1100 <tcp_client_work@plt>
lea    0xcbf(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1070 <printf@plt>
jmp    1327 <main+0x57>
lea    0xd50(%rip),%rdi
jmp    1322 <main+0x52>
lea    0xd3c(%rip),%rdi
jmp    1322 <main+0x52>
lea    0xd1e(%rip),%rdi
call   1050 <puts@plt>
xor    %eax,%eax
call   1030 <open_mmap@plt>
test   %eax,%eax
jne    13de <main+0x10e>
xor    %eax,%eax
call   1190 <read_mem@plt>
xor    %eax,%eax
call   11c0 <write_mem@plt>
xor    %eax,%eax
call   1190 <read_mem@plt>
xor    %eax,%eax
call   1040 <close_mmap@plt>
lea    0xcef(%rip),%rdi
call   1050 <puts@plt>
xor    %eax,%eax
call   1110 <open_anony_mmap@plt>
test   %eax,%eax
jne    1327 <main+0x57>
xor    %eax,%eax
call   1190 <read_mem@plt>
xor    %eax,%eax
call   11c0 <write_mem@plt>
xor    %eax,%eax
call   1190 <read_mem@plt>
xor    %eax,%eax
call   1040 <close_mmap@plt>
jmp    1327 <main+0x57>
lea    0xc77(%rip),%rdi
call   1050 <puts@plt>
lea    0xc79(%rip),%rdi
call   1050 <puts@plt>
xor    %eax,%eax
call   11d0 <mp_example0@plt>
lea    0xc6d(%rip),%rdi
call   1050 <puts@plt>
xor    %eax,%eax
call   10c0 <mp_example1@plt>
lea    0xc61(%rip),%rdi
call   1050 <puts@plt>
xor    %eax,%eax
call   11e0 <mp_example2@plt>
lea    0xc55(%rip),%rdi
call   1050 <puts@plt>
xor    %eax,%eax
call   10f0 <mp_example3@plt>
lea    0xc49(%rip),%rdi
call   1050 <puts@plt>
xor    %eax,%eax
call   11f0 <mp_example4@plt>
lea    0xc3d(%rip),%rdi
call   1050 <puts@plt>
xor    %eax,%eax
call   10e0 <mp_example5@plt>
jmp    1327 <main+0x57>
lea    0xbe4(%rip),%rdi
call   1050 <puts@plt>
lea    0xbf6(%rip),%rdi
call   1050 <puts@plt>
xor    %eax,%eax
call   1150 <pthread_test@plt>
lea    0xbea(%rip),%rdi
call   1050 <puts@plt>
xor    %eax,%eax
call   1060 <pthread_test2@plt>
lea    0xbde(%rip),%rdi
call   1050 <puts@plt>
xor    %eax,%eax
call   1140 <pthread_test3@plt>
jmp    1327 <main+0x57>
lea    0xb86(%rip),%rdi
call   1050 <puts@plt>
lea    0xb83(%rip),%rdi
call   1050 <puts@plt>
lea    0xba0(%rip),%rdi
call   1050 <puts@plt>
xor    %eax,%eax
call   1180 <exec_shell@plt>
lea    0xb94(%rip),%rdi
call   1050 <puts@plt>
xor    %eax,%eax
call   1170 <exec_shell2@plt>
lea    0xb39(%rip),%rdi
call   1050 <puts@plt>
xor    %eax,%eax
call   1160 <shmem_test@plt>
jmp    1327 <main+0x57>
lea    0xb1a(%rip),%rdi
call   1050 <puts@plt>
xor    %eax,%eax
call   10a0 <sig_test1@plt>
xor    %eax,%eax
call   11a0 <sig_test2@plt>
xor    %eax,%eax
call   1090 <sig_test3@plt>
jmp    1327 <main+0x57>

LLVM IR (-O0):
@.str = [162 x i8] c"usage: xx yy\0Ayy=0 file test\0A=1 tcp server\0A=2 tcp client\0A=3 udp server\0A=4 udp client\0A=5 mem test\0A=6 multi process\0A=7 multi thread\0A=8 sys/procfs\0A=9 share mem(api)\0A\00"
@.str.1 = [17 x i8] c"write-read file\0A\00"
@.str.2 = [11 x i8] c"./testfile\00"
@.str.3 = [12 x i8] c"tcp server\0A\00"
@.str.4 = [19 x i8] c"tcp server err %d\0A\00"
@.str.5 = [6 x i8] c"done\0A\00"
@.str.6 = [14 x i8] c"f tcp client\0A\00"
@.str.7 = [20 x i8] c"tcp client err %d\0A\00"
@.str.8 = [12 x i8] c"udp server\0A\00"
@.str.9 = [12 x i8] c"udp client\0A\00"
@.str.10 = [5 x i8] c"mem\0A\00"
@.str.11 = [15 x i8] c"anonymous map\0A\00"
@.str.12 = [15 x i8] c"multi process\0A\00"
@.str.13 = [8 x i8] c"test 0\0A\00"
@.str.14 = [8 x i8] c"test 1\0A\00"
@.str.15 = [8 x i8] c"test 2\0A\00"
@.str.16 = [8 x i8] c"test 3\0A\00"
@.str.17 = [8 x i8] c"test 4\0A\00"
@.str.18 = [8 x i8] c"test 5\0A\00"
@.str.19 = [17 x i8] c"multi thread\0A10\0A\00"
@.str.20 = [10 x i8] c"sys test\0A\00"
@.str.21 = [12 x i8] c"shell exec\0A\00"
@.str.22 = [16 x i8] c"sharing memory\0A\00"
@.str.23 = [8 x i8] c"signal\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i32, i32* %4
%11 = icmp ne i32 %10, 2
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([162 x i8], [162 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %109
14: ; preds = %2
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 1
%17 = load i8*, i8** %16
%18 = call i32 @atoi(i8* %17)
store i32 %18, i32* %6
%19 = load i32, i32* %6
switch i32 %19, label %107 [
i32 0, label %20
i32 1, label %24
i32 2, label %35
i32 3, label %45
i32 4, label %47
i32 5, label %49
i32 6, label %70
i32 7, label %84
i32 8, label %92
i32 9, label %99
i32 10, label %102
]
20: ; preds = %14
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%22 = call i32 @write_file(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%23 = call i32 @read_file(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
br label %108
24: ; preds = %14
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
%26 = call i32 (...) @tcp_server_setup()
store i32 %26, i32* %7
%27 = load i32, i32* %7
%28 = icmp ne i32 %27, 0
br i1 %28, label %31, label %29
29: ; preds = %24
%30 = call i32 (...) @tcp_server_work()
br label %31
31: ; preds = %29, %24
%32 = load i32, i32* %7
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i32 %32)
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
br label %108
35: ; preds = %14
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0))
%37 = call i32 (...) @tcp_client_setup()
store i32 %37, i32* %8
%38 = load i32, i32* %8
%39 = icmp ne i32 %38, 0
br i1 %39, label %42, label %40
40: ; preds = %35
%41 = call i32 (...) @tcp_client_work()
br label %42
42: ; preds = %40, %35
%43 = load i32, i32* %8
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.7, i64 0, i64 0), i32 %43)
br label %108
45: ; preds = %14
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0))
br label %108
47: ; preds = %14
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.9, i64 0, i64 0))
br label %108
49: ; preds = %14
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0))
%51 = call i32 (...) @open_mmap()
store i32 %51, i32* %9
%52 = load i32, i32* %9
%53 = icmp ne i32 %52, 0
br i1 %53, label %59, label %54
54: ; preds = %49
%55 = call i32 (...) @read_mem()
%56 = call i32 (...) @write_mem()
%57 = call i32 (...) @read_mem()
%58 = call i32 (...) @close_mmap()
br label %59
59: ; preds = %54, %49
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.11, i64 0, i64 0))
%61 = call i32 (...) @open_anony_mmap()
store i32 %61, i32* %9
%62 = load i32, i32* %9
%63 = icmp ne i32 %62, 0
br i1 %63, label %69, label %64
64: ; preds = %59
%65 = call i32 (...) @read_mem()
%66 = call i32 (...) @write_mem()
%67 = call i32 (...) @read_mem()
%68 = call i32 (...) @close_mmap()
br label %69
69: ; preds = %64, %59
br label %108
70: ; preds = %14
%71 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.12, i64 0, i64 0))
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.13, i64 0, i64 0))
%73 = call i32 (...) @mp_example0()
%74 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.14, i64 0, i64 0))
%75 = call i32 (...) @mp_example1()
%76 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.15, i64 0, i64 0))
%77 = call i32 (...) @mp_example2()
%78 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.16, i64 0, i64 0))
%79 = call i32 (...) @mp_example3()
%80 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.17, i64 0, i64 0))
%81 = call i32 (...) @mp_example4()
%82 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.18, i64 0, i64 0))
%83 = call i32 (...) @mp_example5()
br label %108
84: ; preds = %14
%85 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.19, i64 0, i64 0))
%86 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.13, i64 0, i64 0))
%87 = call i32 (...) @pthread_test()
%88 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.14, i64 0, i64 0))
%89 = call i32 (...) @pthread_test2()
%90 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.15, i64 0, i64 0))
%91 = call i32 (...) @pthread_test3()
br label %108
92: ; preds = %14
%93 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.20, i64 0, i64 0))
%94 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.21, i64 0, i64 0))
%95 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.13, i64 0, i64 0))
%96 = call i32 (...) @exec_shell()
%97 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.14, i64 0, i64 0))
%98 = call i32 (...) @exec_shell2()
br label %99
99: ; preds = %14, %92
%100 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.22, i64 0, i64 0))
%101 = call i32 (...) @shmem_test()
br label %108
102: ; preds = %14
%103 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.23, i64 0, i64 0))
%104 = call i32 (...) @sig_test1()
%105 = call i32 (...) @sig_test2()
%106 = call i32 (...) @sig_test3()
br label %108
107: ; preds = %14
br label %108
108: ; preds = %107, %102, %99, %84, %70, %69, %47, %45, %42, %31, %20
store i32 0, i32* %3
br label %109
109: ; preds = %108, %12
%110 = load i32, i32* %3
ret i32 %110
}

LLVM IR (-O2):
@.str.2 = [11 x i8] c"./testfile\00"
@.str.4 = [19 x i8] c"tcp server err %d\0A\00"
@.str.7 = [20 x i8] c"tcp client err %d\0A\00"
@str = [7 x i8] c"signal\00"
@str.24 = [15 x i8] c"sharing memory\00"
@str.25 = [9 x i8] c"sys test\00"
@str.26 = [11 x i8] c"shell exec\00"
@str.29 = [16 x i8] c"multi thread\0A10\00"
@str.33 = [14 x i8] c"multi process\00"
@str.34 = [7 x i8] c"test 0\00"
@str.35 = [7 x i8] c"test 1\00"
@str.36 = [7 x i8] c"test 2\00"
@str.37 = [7 x i8] c"test 3\00"
@str.38 = [7 x i8] c"test 4\00"
@str.39 = [7 x i8] c"test 5\00"
@str.40 = [4 x i8] c"mem\00"
@str.41 = [14 x i8] c"anonymous map\00"
@str.42 = [11 x i8] c"udp client\00"
@str.43 = [11 x i8] c"udp server\00"
@str.44 = [13 x i8] c"f tcp client\00"
@str.45 = [11 x i8] c"tcp server\00"
@str.46 = [5 x i8] c"done\00"
@str.47 = [16 x i8] c"write-read file\00"
@str.48 = [161 x i8] c"usage: xx yy\0Ayy=0 file test\0A=1 tcp server\0A=2 tcp client\0A=3 udp server\0A=4 udp client\0A=5 mem test\0A=6 multi process\0A=7 multi thread\0A=8 sys/procfs\0A=9 share mem(api)\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([161 x i8], [161 x i8]* @str.48, i64 0, i64 0))
br label %90
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i32 @atoi(i8* %8)
switch i32 %9, label %90 [
i32 0, label %10
i32 1, label %14
i32 2, label %23
i32 3, label %31
i32 4, label %33
i32 5, label %35
i32 6, label %53
i32 7, label %67
i32 8, label %75
i32 9, label %82
i32 10, label %85
]
10: ; preds = %6
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.47, i64 0, i64 0))
%12 = tail call i32 @write_file(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%13 = tail call i32 @read_file(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
br label %90
14: ; preds = %6
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.45, i64 0, i64 0))
%16 = tail call i32 (...) @tcp_server_setup()
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %14
%19 = tail call i32 (...) @tcp_server_work()
br label %20
20: ; preds = %18, %14
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i32 %16)
%22 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str.46, i64 0, i64 0))
br label %90
23: ; preds = %6
%24 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.44, i64 0, i64 0))
%25 = tail call i32 (...) @tcp_client_setup()
%26 = icmp eq i32 %25, 0
br i1 %26, label %27, label %29
27: ; preds = %23
%28 = tail call i32 (...) @tcp_client_work()
br label %29
29: ; preds = %27, %23
%30 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.7, i64 0, i64 0), i32 %25)
br label %90
31: ; preds = %6
%32 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.43, i64 0, i64 0))
br label %90
33: ; preds = %6
%34 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.42, i64 0, i64 0))
br label %90
35: ; preds = %6
%36 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str.40, i64 0, i64 0))
%37 = tail call i32 (...) @open_mmap()
%38 = icmp eq i32 %37, 0
br i1 %38, label %39, label %44
39: ; preds = %35
%40 = tail call i32 (...) @read_mem()
%41 = tail call i32 (...) @write_mem()
%42 = tail call i32 (...) @read_mem()
%43 = tail call i32 (...) @close_mmap()
br label %44
44: ; preds = %39, %35
%45 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.41, i64 0, i64 0))
%46 = tail call i32 (...) @open_anony_mmap()
%47 = icmp eq i32 %46, 0
br i1 %47, label %48, label %90
48: ; preds = %44
%49 = tail call i32 (...) @read_mem()
%50 = tail call i32 (...) @write_mem()
%51 = tail call i32 (...) @read_mem()
%52 = tail call i32 (...) @close_mmap()
br label %90
53: ; preds = %6
%54 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.33, i64 0, i64 0))
%55 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.34, i64 0, i64 0))
%56 = tail call i32 (...) @mp_example0()
%57 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.35, i64 0, i64 0))
%58 = tail call i32 (...) @mp_example1()
%59 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.36, i64 0, i64 0))
%60 = tail call i32 (...) @mp_example2()
%61 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.37, i64 0, i64 0))
%62 = tail call i32 (...) @mp_example3()
%63 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.38, i64 0, i64 0))
%64 = tail call i32 (...) @mp_example4()
%65 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.39, i64 0, i64 0))
%66 = tail call i32 (...) @mp_example5()
br label %90
67: ; preds = %6
%68 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.29, i64 0, i64 0))
%69 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.34, i64 0, i64 0))
%70 = tail call i32 (...) @pthread_test()
%71 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.35, i64 0, i64 0))
%72 = tail call i32 (...) @pthread_test2()
%73 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.36, i64 0, i64 0))
%74 = tail call i32 (...) @pthread_test3()
br label %90
75: ; preds = %6
%76 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.25, i64 0, i64 0))
%77 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.26, i64 0, i64 0))
%78 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.34, i64 0, i64 0))
%79 = tail call i32 (...) @exec_shell()
%80 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.35, i64 0, i64 0))
%81 = tail call i32 (...) @exec_shell2()
br label %82
82: ; preds = %6, %75
%83 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.24, i64 0, i64 0))
%84 = tail call i32 (...) @shmem_test()
br label %90
85: ; preds = %6
%86 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
%87 = tail call i32 (...) @sig_test1()
%88 = tail call i32 (...) @sig_test2()
%89 = tail call i32 (...) @sig_test3()
br label %90
90: ; preds = %10, %20, %29, %31, %33, %53, %67, %82, %85, %48, %44, %6, %4
ret i32 0
}