#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[]) {
  int i = 0;
  if (argc == 1) {
    printf("You only have zero arguments. Try adding another.\n");
  } else if (argc == 2) {
    printf("You only have one argument. Try adding another.\n");
  } else if (argc > 2 && argc < 5) {
    printf("Here are your arguments:\n");
    for (i = 0; i < argc; i++) {
      printf("%s ", argv[i]);
    }
    printf("\n");
  } else {
    printf("You have too many arguments. Try removing some.\n");
  }
  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)
movl   $0x0,-0x14(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    114a <main+0x3a>
lea    0xec2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11ef <main+0xdf>
cmpl   $0x2,-0x8(%rbp)
jne    1167 <main+0x57>
lea    0xed8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11ea <main+0xda>
cmpl   $0x2,-0x8(%rbp)
jle    11d7 <main+0xc7>
cmpl   $0x5,-0x8(%rbp)
jge    11d7 <main+0xc7>
lea    0xee2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11c4 <main+0xb4>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xecf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1190 <main+0x80>
lea    0xee6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11e5 <main+0xd5>
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11ea <main+0xda>
jmp    11ef <main+0xdf>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
cmp    $0x2,%edi
je     114e <main+0x1e>
mov    %edi,%r14d
cmp    $0x1,%edi
jne    1157 <main+0x27>
lea    0xf31(%rip),%rdi
jmp    11aa <main+0x7a>
lea    0xef8(%rip),%rdi
jmp    11aa <main+0x7a>
lea    -0x3(%r14),%eax
cmp    $0x1,%eax
ja     11a3 <main+0x73>
mov    %rsi,%r15
lea    0xeca(%rip),%rdi
call   1040 <puts@plt>
mov    %r14d,%r12d
lea    0xe87(%rip),%r14
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,8),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1180 <main+0x50>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    11af <main+0x7f>
lea    0xe5a(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [51 x i8] c"You only have zero arguments. Try adding another.\0A\00"
@.str.1 = [49 x i8] c"You only have one argument. Try adding another.\0A\00"
@.str.2 = [26 x i8] c"Here are your arguments:\0A\00"
@.str.3 = [4 x i8] c"%s \00"
@.str.4 = [2 x i8] c"\0A\00"
@.str.5 = [49 x i8] c"You have too many arguments. Try removing some.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
%7 = load i32, i32* %4
%8 = icmp eq i32 %7, 1
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0))
br label %44
11: ; preds = %2
%12 = load i32, i32* %4
%13 = icmp eq i32 %12, 2
br i1 %13, label %14, label %16
14: ; preds = %11
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.1, i64 0, i64 0))
br label %43
16: ; preds = %11
%17 = load i32, i32* %4
%18 = icmp sgt i32 %17, 2
br i1 %18, label %19, label %40
19: ; preds = %16
%20 = load i32, i32* %4
%21 = icmp slt i32 %20, 5
br i1 %21, label %22, label %40
22: ; preds = %19
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %6
br label %24
24: ; preds = %35, %22
%25 = load i32, i32* %6
%26 = load i32, i32* %4
%27 = icmp slt i32 %25, %26
br i1 %27, label %28, label %38
28: ; preds = %24
%29 = load i8**, i8*** %5
%30 = load i32, i32* %6
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i8*, i8** %29, i64 %31
%33 = load i8*, i8** %32
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %33)
br label %35
35: ; preds = %28
%36 = load i32, i32* %6
%37 = add nsw i32 %36, 1
store i32 %37, i32* %6
br label %24
38: ; preds = %24
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %42
40: ; preds = %19, %16
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.5, i64 0, i64 0))
br label %42
42: ; preds = %40, %38
br label %43
43: ; preds = %42, %14
br label %44
44: ; preds = %43, %9
ret i32 0
}

LLVM IR (-O2):
@.str.3 = [4 x i8] c"%s \00"
@str = [48 x i8] c"You have too many arguments. Try removing some.\00"
@str.6 = [25 x i8] c"Here are your arguments:\00"
@str.7 = [48 x i8] c"You only have one argument. Try adding another.\00"
@str.8 = [50 x i8] c"You only have zero arguments. Try adding another.\00"
define i32 @main(i32 %0, i8** nocapture %1) {
switch i32 %0, label %7 [
i32 1, label %3
i32 2, label %5
]
3: ; preds = %2
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @str.8, i64 0, i64 0))
br label %24
5: ; preds = %2
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str.7, i64 0, i64 0))
br label %24
7: ; preds = %2
%8 = add i32 %0, -3
%9 = icmp ult i32 %8, 2
br i1 %9, label %10, label %22
10: ; preds = %7
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.6, i64 0, i64 0))
%12 = zext i32 %0 to i64
br label %13
13: ; preds = %10, %13
%14 = phi i64 [ 0, %10 ], [ %18, %13 ]
%15 = getelementptr inbounds i8*, i8** %1, i64 %14
%16 = load i8*, i8** %15
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %16)
%18 = add nuw nsw i64 %14, 1
%19 = icmp eq i64 %18, %12
br i1 %19, label %20, label %13
20: ; preds = %13
%21 = tail call i32 @putchar(i32 10)
br label %24
22: ; preds = %7
%23 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str, i64 0, i64 0))
br label %24
24: ; preds = %5, %22, %20, %3
ret i32 0
}