#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) {
  do {
    switch (argc) {
    case 1:
      printf("No arguments passed\n");
      break;
    case 2:
      printf("One argument passed\n");
      argc--;
      break;
    default:
      printf("More then one argument passed: %d\n", argc);
      argc--;
      break;
    }
  } while (argc != 1);
  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)
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
sub    $0x1,%eax
je     114b <main+0x3b>
jmp    113a <main+0x2a>
mov    -0x14(%rbp),%eax
sub    $0x2,%eax
je     115e <main+0x4e>
jmp    117a <main+0x6a>
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1194 <main+0x84>
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    1194 <main+0x84>
mov    -0x8(%rbp),%esi
lea    0xea6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    1199 <main+0x89>
cmpl   $0x1,-0x8(%rbp)
jne    1126 <main+0x16>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
lea    0xed3(%rip),%r14
cmp    $0x1,%ebx
je     1159 <main+0x39>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
cmp    $0x2,%ebx
je     1162 <main+0x42>
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0xffffffff,%ebx
cmp    $0x1,%ebx
jne    1140 <main+0x20>
lea    0xed7(%rip),%rdi
jmp    1169 <main+0x49>
lea    0xeba(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [21 x i8] c"No arguments passed\0A\00"
@.str.1 = [21 x i8] c"One argument passed\0A\00"
@.str.2 = [35 x i8] c"More then one argument passed: %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
br label %6
6: ; preds = %20, %2
%7 = load i32, i32* %4
switch i32 %7, label %14 [
i32 1, label %8
i32 2, label %10
]
8: ; preds = %6
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
br label %19
10: ; preds = %6
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
%12 = load i32, i32* %4
%13 = add nsw i32 %12, -1
store i32 %13, i32* %4
br label %19
14: ; preds = %6
%15 = load i32, i32* %4
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0), i32 %15)
%17 = load i32, i32* %4
%18 = add nsw i32 %17, -1
store i32 %18, i32* %4
br label %19
19: ; preds = %14, %10, %8
br label %20
20: ; preds = %19
%21 = load i32, i32* %4
%22 = icmp ne i32 %21, 1
br i1 %22, label %6, label %23
23: ; preds = %20
ret i32 0
}

LLVM IR (-O2):
@.str.2 = [35 x i8] c"More then one argument passed: %d\0A\00"
@str = [20 x i8] c"One argument passed\00"
@str.3 = [20 x i8] c"No arguments passed\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
br label %3
3: ; preds = %5, %2
%4 = phi i32 [ %0, %2 ], [ %7, %5 ]
switch i32 %4, label %5 [
i32 1, label %9
i32 2, label %8
]
5: ; preds = %3
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0), i32 %4)
%7 = add nsw i32 %4, -1
br label %3
8: ; preds = %3
br label %9
9: ; preds = %3, %8
%10 = phi i8* [ getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0), %8 ], [ getelementptr inbounds ([20 x i8], [20 x i8]* @str.3, i64 0, i64 0), %3 ]
%11 = tail call i32 @puts(i8* dereferenceable(1) %10)
ret i32 0
}