#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*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  printf("-----------test2 with DEBUG macro = 0----------\n");
  printf("argc:%d\n", argc);
  char *num;
  switch (argc - 1) {
  case 0:
    num = "zero";
    if (0) {
    case 1:
      num = "one";
      ;
    }
    if (0) {
    case 2:
      num = "two";
      ;
    }
    if (0) {
    case 3:
      num = "three";
      ;
    }
    if (0) {
    default:
      num = "many";
      ;
    }
    while (--argc)
      printf("%s ", argv[argc]);
    printf("\nArgument count: %s\n", num);
    break;
  }
  printf("-----------------------------------------------\n");
  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)
lea    0xee3(%rip),%rdi
xor    %eax,%eax
mov    %al,-0x21(%rbp)
call   1030 <printf@plt>
mov    -0x21(%rbp),%al
mov    -0x8(%rbp),%esi
lea    0xefd(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x20(%rbp)
sub    $0x3,%eax
ja     11ee <main+0xde>
mov    -0x20(%rbp),%rax
lea    0xe97(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xed1(%rip),%rax
mov    %rax,-0x18(%rbp)
xor    %eax,%eax
test   $0x1,%al
jne    118c <main+0x7c>
jmp    119c <main+0x8c>
jmp    1191 <main+0x81>
lea    0xeb7(%rip),%rax
mov    %rax,-0x18(%rbp)
xor    %eax,%eax
test   $0x1,%al
jne    11ab <main+0x9b>
jmp    11bb <main+0xab>
jmp    11b0 <main+0xa0>
lea    0xe9c(%rip),%rax
mov    %rax,-0x18(%rbp)
xor    %eax,%eax
test   $0x1,%al
jne    11ca <main+0xba>
jmp    11da <main+0xca>
jmp    11cf <main+0xbf>
lea    0xe81(%rip),%rax
mov    %rax,-0x18(%rbp)
xor    %eax,%eax
test   $0x1,%al
jne    11e9 <main+0xd9>
jmp    11f9 <main+0xe9>
jmp    11ee <main+0xde>
lea    0xe68(%rip),%rax
mov    %rax,-0x18(%rbp)
jmp    11fe <main+0xee>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
je     122f <main+0x11f>
mov    -0x10(%rbp),%rax
movslq -0x8(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xe3f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11fe <main+0xee>
mov    -0x18(%rbp),%rsi
lea    0xe2c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe33(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %edi,%r12d
lea    0xf12(%rip),%rdi
call   1030 <puts@plt>
lea    0xecc(%rip),%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    -0x1(%r12),%eax
cmp    $0x3,%eax
ja     117f <main+0x5f>
lea    0xebf(%rip),%r15
lea    0xeb3(%rip),%rsi
lea    0xe93(%rip),%rcx
movslq (%rcx,%rax,4),%rdx
add    %rcx,%rdx
jmp    *%rdx
lea    0xea5(%rip),%r15
jmp    118f <main+0x6f>
lea    0xea6(%rip),%r15
jmp    118f <main+0x6f>
lea    0xe97(%rip),%r15
cltq
lea    (%r14,%rax,8),%r13
mov    $0x1,%ebp
sub    %r12d,%ebp
lea    0xe8d(%rip),%r14
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
mov    0x0(%r13,%rbx,8),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0xffffffffffffffff,%rbx
cmp    %ebx,%ebp
jne    11b0 <main+0x90>
mov    %r15,%rsi
lea    0xe64(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe9b(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [49 x i8] c"-----------test2 with DEBUG macro = 0----------\0A\00"
@.str.1 = [9 x i8] c"argc:%d\0A\00"
@.str.2 = [5 x i8] c"zero\00"
@.str.3 = [4 x i8] c"one\00"
@.str.4 = [4 x i8] c"two\00"
@.str.5 = [6 x i8] c"three\00"
@.str.6 = [5 x i8] c"many\00"
@.str.7 = [4 x i8] c"%s \00"
@.str.8 = [21 x i8] c"\0AArgument count: %s\0A\00"
@.str.9 = [49 x i8] c"-----------------------------------------------\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0))
%8 = load i32, i32* %4
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %8)
%10 = load i32, i32* %4
%11 = sub nsw i32 %10, 1
switch i32 %11, label %23 [
i32 0, label %12
i32 1, label %14
i32 2, label %17
i32 3, label %20
]
12: ; preds = %2
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8** %6
br i1 false, label %13, label %15
13: ; preds = %12
br label %14
14: ; preds = %2, %13
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8** %6
br label %15
15: ; preds = %14, %12
br i1 false, label %16, label %18
16: ; preds = %15
br label %17
17: ; preds = %2, %16
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8** %6
br label %18
18: ; preds = %17, %15
br i1 false, label %19, label %21
19: ; preds = %18
br label %20
20: ; preds = %2, %19
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i8** %6
br label %21
21: ; preds = %20, %18
br i1 false, label %22, label %24
22: ; preds = %21
br label %23
23: ; preds = %2, %22
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i8** %6
br label %24
24: ; preds = %23, %21
br label %25
25: ; preds = %29, %24
%26 = load i32, i32* %4
%27 = add nsw i32 %26, -1
store i32 %27, i32* %4
%28 = icmp ne i32 %27, 0
br i1 %28, label %29, label %36
29: ; preds = %25
%30 = load i8**, i8*** %5
%31 = load i32, i32* %4
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i8*, i8** %30, i64 %32
%34 = load i8*, i8** %33
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i8* %34)
br label %25
36: ; preds = %25
%37 = load i8*, i8** %6
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.8, i64 0, i64 0), i8* %37)
br label %39
39: ; preds = %36
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.9, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [9 x i8] c"argc:%d\0A\00"
@.str.2 = [5 x i8] c"zero\00"
@.str.3 = [4 x i8] c"one\00"
@.str.4 = [4 x i8] c"two\00"
@.str.5 = [6 x i8] c"three\00"
@.str.6 = [5 x i8] c"many\00"
@.str.7 = [4 x i8] c"%s \00"
@.str.8 = [21 x i8] c"\0AArgument count: %s\0A\00"
@str = [48 x i8] c"-----------test2 with DEBUG macro = 0----------\00"
@str.10 = [48 x i8] c"-----------------------------------------------\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %0)
switch i32 %0, label %7 [
i32 1, label %20
i32 2, label %8
i32 3, label %5
i32 4, label %6
]
5: ; preds = %2
br label %8
6: ; preds = %2
br label %8
7: ; preds = %2
br label %8
8: ; preds = %2, %6, %5, %7
%9 = phi i8* [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), %5 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), %6 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), %7 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), %2 ]
%10 = add i32 %0, -1
%11 = sext i32 %10 to i64
br label %12
12: ; preds = %8, %12
%13 = phi i64 [ %11, %8 ], [ %17, %12 ]
%14 = getelementptr inbounds i8*, i8** %1, i64 %13
%15 = load i8*, i8** %14
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i8* %15)
%17 = add nsw i64 %13, -1
%18 = trunc i64 %17 to i32
%19 = icmp eq i32 %18, 0
br i1 %19, label %20, label %12
20: ; preds = %12, %2
%21 = phi i8* [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), %2 ], [ %9, %12 ]
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.8, i64 0, i64 0), i8* %21)
%23 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str.10, i64 0, i64 0))
ret i32 0
}