#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*/ make_head(int);
int /*<<< orphan*/ make_head2(int);
int /*<<< orphan*/ make_tail();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ run(int, int, int);
main(int argc, char *argv[]) {
  int i, m;
  if (argc == 2) {
    m = atoi(argv[1]);
    make_head(m);
    printf("\tswitch (argc) {\n");
    for (i = 1; i <= m; i++)
      run(2, i, 1);
    printf("\t}\n");
    printf("\treturn r;\n");
    printf("}\n\n");
    make_head2(m);
    printf("\tswitch (argc) {\n");
    for (i = 1; i <= m; i++)
      run(2, i, 1);
    printf("\t}\n");
    printf("\treturn r;\n");
    printf("}\n\n");
    make_tail();
  }
  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)
jne    126d <main+0x10d>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1070 <atoi@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%edi
call   1080 <make_head@plt>
lea    0xe61(%rip),%rdi
call   1040 <printf@plt>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jg     11d7 <main+0x77>
mov    -0x14(%rbp),%esi
mov    $0x2,%edi
mov    $0x1,%edx
call   1030 <run@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11ab <main+0x4b>
lea    0xe34(%rip),%rdi
call   1040 <printf@plt>
lea    0xe2c(%rip),%rdi
call   1040 <printf@plt>
lea    0xe2c(%rip),%rdi
call   1040 <printf@plt>
mov    -0x18(%rbp),%edi
call   1050 <make_head2@plt>
lea    0xdf6(%rip),%rdi
call   1040 <printf@plt>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jg     1242 <main+0xe2>
mov    -0x14(%rbp),%esi
mov    $0x2,%edi
mov    $0x1,%edx
call   1030 <run@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1216 <main+0xb6>
lea    0xdc9(%rip),%rdi
call   1040 <printf@plt>
lea    0xdc1(%rip),%rdi
call   1040 <printf@plt>
lea    0xdc1(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1060 <make_tail@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
cmp    $0x2,%edi
jne    129c <main+0x13c>
push   %rbp
push   %r14
push   %rbx
mov    0x8(%rsi),%rdi
call   1070 <atoi@plt>
mov    %eax,%r14d
mov    %eax,%edi
call   1080 <make_head@plt>
lea    0xe79(%rip),%rdi
call   1030 <puts@plt>
test   %r14d,%r14d
jle    1235 <main+0xd5>
mov    %r14d,%ebp
neg    %ebp
mov    $0x1,%ebx
nop
mov    $0x2,%edi
mov    %ebx,%esi
mov    $0x1,%edx
call   1040 <run@plt>
lea    (%rbx,%rbp,1),%eax
add    $0x1,%eax
mov    %ebx,%ecx
add    $0x1,%ecx
mov    %ecx,%ebx
cmp    $0x1,%eax
jne    11a0 <main+0x40>
lea    0xe47(%rip),%rdi
call   1030 <puts@plt>
lea    0xe3e(%rip),%rdi
call   1030 <puts@plt>
lea    0xe3d(%rip),%rdi
call   1030 <puts@plt>
mov    %r14d,%edi
call   1050 <make_head2@plt>
lea    0xe0a(%rip),%rdi
call   1030 <puts@plt>
test   %r14d,%r14d
jle    126d <main+0x10d>
mov    $0x1,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
mov    $0x2,%edi
mov    %ebx,%esi
mov    $0x1,%edx
call   1040 <run@plt>
lea    (%rbx,%rbp,1),%eax
add    $0x1,%eax
mov    %ebx,%ecx
add    $0x1,%ecx
mov    %ecx,%ebx
cmp    $0x1,%eax
jne    1210 <main+0xb0>
jmp    126d <main+0x10d>
lea    0xdd5(%rip),%rdi
call   1030 <puts@plt>
lea    0xdcc(%rip),%rdi
call   1030 <puts@plt>
lea    0xdcb(%rip),%rdi
call   1030 <puts@plt>
mov    %r14d,%edi
call   1050 <make_head2@plt>
lea    0xd98(%rip),%rdi
call   1030 <puts@plt>
lea    0xd9d(%rip),%rdi
call   1030 <puts@plt>
lea    0xd94(%rip),%rdi
call   1030 <puts@plt>
lea    0xd93(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1060 <make_tail@plt>
pop    %rbx
pop    %r14
pop    %rbp
xor    %eax,%eax
ret

LLVM IR (-O0):
@.str = [18 x i8] c"\09switch (argc) {\0A\00"
@.str.1 = [4 x i8] c"\09}\0A\00"
@.str.2 = [12 x i8] c"\09return r;\0A\00"
@.str.3 = [4 x i8] c"}\0A\0A\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 eq i32 %8, 2
br i1 %9, label %10, label %50
10: ; preds = %2
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
%14 = call i32 @atoi(i8* %13)
store i32 %14, i32* %7
%15 = load i32, i32* %7
%16 = call i32 @make_head(i32 %15)
%17 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %6
br label %18
18: ; preds = %25, %10
%19 = load i32, i32* %6
%20 = load i32, i32* %7
%21 = icmp sle i32 %19, %20
br i1 %21, label %22, label %28
22: ; preds = %18
%23 = load i32, i32* %6
%24 = call i32 @run(i32 2, i32 %23, i32 1)
br label %25
25: ; preds = %22
%26 = load i32, i32* %6
%27 = add nsw i32 %26, 1
store i32 %27, i32* %6
br label %18
28: ; preds = %18
%29 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%30 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%31 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%32 = load i32, i32* %7
%33 = call i32 @make_head2(i32 %32)
%34 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %6
br label %35
35: ; preds = %42, %28
%36 = load i32, i32* %6
%37 = load i32, i32* %7
%38 = icmp sle i32 %36, %37
br i1 %38, label %39, label %45
39: ; preds = %35
%40 = load i32, i32* %6
%41 = call i32 @run(i32 2, i32 %40, i32 1)
br label %42
42: ; preds = %39
%43 = load i32, i32* %6
%44 = add nsw i32 %43, 1
store i32 %44, i32* %6
br label %35
45: ; preds = %35
%46 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%47 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%48 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%49 = call i32 (...) @make_tail()
br label %50
50: ; preds = %45, %2
ret i32 0
}

LLVM IR (-O2):
@str.7 = [17 x i8] c"\09switch (argc) {\00"
@str.8 = [3 x i8] c"\09}\00"
@str.9 = [11 x i8] c"\09return r;\00"
@str.10 = [3 x i8] c"}\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %4, label %38
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @atoi(i8* %6)
%8 = tail call i32 @make_head(i32 %7)
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.7, i64 0, i64 0))
%10 = icmp slt i32 %7, 1
br i1 %10, label %27, label %11
11: ; preds = %4, %11
%12 = phi i32 [ %14, %11 ], [ 1, %4 ]
%13 = tail call i32 @run(i32 2, i32 %12, i32 1)
%14 = add nuw i32 %12, 1
%15 = icmp eq i32 %12, %7
br i1 %15, label %16, label %11
16: ; preds = %11
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str.8, i64 0, i64 0))
%18 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.9, i64 0, i64 0))
%19 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str.10, i64 0, i64 0))
%20 = tail call i32 @make_head2(i32 %7)
%21 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.7, i64 0, i64 0))
br i1 %10, label %33, label %22
22: ; preds = %16, %22
%23 = phi i32 [ %25, %22 ], [ 1, %16 ]
%24 = tail call i32 @run(i32 2, i32 %23, i32 1)
%25 = add nuw i32 %23, 1
%26 = icmp eq i32 %23, %7
br i1 %26, label %33, label %22
27: ; preds = %4
%28 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str.8, i64 0, i64 0))
%29 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.9, i64 0, i64 0))
%30 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str.10, i64 0, i64 0))
%31 = tail call i32 @make_head2(i32 %7)
%32 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.7, i64 0, i64 0))
br label %33
33: ; preds = %22, %27, %16
%34 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str.8, i64 0, i64 0))
%35 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.9, i64 0, i64 0))
%36 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str.10, i64 0, i64 0))
%37 = tail call i32 (...) @make_tail()
br label %38
38: ; preds = %33, %2
ret i32 0
}