#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 test1();
int test2();
int main(int argc, char **argv) {
  char test_no = '0';
  int result = 0;
  if (argc > 1) {
    test_no = argv[1][0];
    switch (test_no) {
    case '1':
      result = test1();
      break;
    case '2':
      result = test2();
      break;
    }
  } else {
    result = test1() || test2();
  }
  return result;
}


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)
movb   $0x30,-0x11(%rbp)
movl   $0x0,-0x18(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    119c <main+0x7c>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    (%rax),%al
mov    %al,-0x11(%rbp)
movsbl -0x11(%rbp),%eax
mov    %eax,-0x1c(%rbp)
sub    $0x31,%eax
je     117e <main+0x5e>
jmp    116d <main+0x4d>
mov    -0x1c(%rbp),%eax
sub    $0x32,%eax
je     118d <main+0x6d>
jmp    1197 <main+0x77>
mov    $0x0,%al
call   1030 <test1@plt>
mov    %eax,-0x18(%rbp)
jmp    1197 <main+0x77>
mov    $0x0,%al
call   1040 <test2@plt>
mov    %eax,-0x18(%rbp)
jmp    11ce <main+0xae>
mov    $0x0,%al
call   1030 <test1@plt>
mov    %eax,%ecx
mov    $0x1,%al
cmp    $0x0,%ecx
mov    %al,-0x1d(%rbp)
jne    11c3 <main+0xa3>
mov    $0x0,%al
call   1040 <test2@plt>
cmp    $0x0,%eax
setne  %al
mov    %al,-0x1d(%rbp)
mov    -0x1d(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x2,%edi
jl     1141 <main+0x21>
mov    0x8(%rsi),%rax
movsbl (%rax),%ecx
cmp    $0x32,%ecx
je     1155 <main+0x35>
xor    %eax,%eax
cmp    $0x31,%ecx
jne    1153 <main+0x33>
xor    %eax,%eax
pop    %rcx
jmp    1030 <test1@plt>
xor    %eax,%eax
call   1030 <test1@plt>
mov    %eax,%ecx
mov    $0x1,%eax
test   %ecx,%ecx
je     115d <main+0x3d>
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
jmp    1040 <test2@plt>
xor    %eax,%eax
call   1040 <test2@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
setne  %al
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8 48, i8* %6
store i32 0, i32* %7
%8 = load i32, i32* %4
%9 = icmp sgt i32 %8, 1
br i1 %9, label %10, label %23
10: ; preds = %2
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
%14 = getelementptr inbounds i8, i8* %13, i64 0
%15 = load i8, i8* %14
store i8 %15, i8* %6
%16 = load i8, i8* %6
%17 = sext i8 %16 to i32
switch i32 %17, label %22 [
i32 49, label %18
i32 50, label %20
]
18: ; preds = %10
%19 = call i32 (...) @test1()
store i32 %19, i32* %7
br label %22
20: ; preds = %10
%21 = call i32 (...) @test2()
store i32 %21, i32* %7
br label %22
22: ; preds = %10, %20, %18
br label %32
23: ; preds = %2
%24 = call i32 (...) @test1()
%25 = icmp ne i32 %24, 0
br i1 %25, label %29, label %26
26: ; preds = %23
%27 = call i32 (...) @test2()
%28 = icmp ne i32 %27, 0
br label %29
29: ; preds = %26, %23
%30 = phi i1 [ true, %23 ], [ %28, %26 ]
%31 = zext i1 %30 to i32
store i32 %31, i32* %7
br label %32
32: ; preds = %29, %22
%33 = load i32, i32* %7
ret i32 %33
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
switch i32 %8, label %20 [
i32 49, label %9
i32 50, label %11
]
9: ; preds = %4
%10 = tail call i32 (...) @test1()
br label %20
11: ; preds = %4
%12 = tail call i32 (...) @test2()
br label %20
13: ; preds = %2
%14 = tail call i32 (...) @test1()
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %20
16: ; preds = %13
%17 = tail call i32 (...) @test2()
%18 = icmp ne i32 %17, 0
%19 = zext i1 %18 to i32
br label %20
20: ; preds = %13, %16, %9, %11, %4
%21 = phi i32 [ 0, %4 ], [ %12, %11 ], [ %10, %9 ], [ 1, %13 ], [ %19, %16 ]
ret i32 %21
}