#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 /*<<< orphan*/ puts(char *);
int main(int argc, char *argv[]) {
  if (argc <= 2)
    puts("\nNot enough arguments\n");
  else {
    printf("\nSo you had %d arguments\n\n", argc);
    if (argc == 3 || argc == 4) {
      printf("I shall now work on %d and %d arguments..", 2, 3);
      printf("That being %s and %s", argv[2], argv[3]);
    } else {
      printf("I shall now work on %d and %d arguments..\n", 2, argc - 1);
      printf("That being %s and %s", argv[2], argv[argc - 1]);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jg     1151 <main+0x31>
lea    0xeb9(%rip),%rdi
call   1030 <puts@plt>
jmp    11f6 <main+0xd6>
mov    -0x8(%rbp),%esi
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpl   $0x3,-0x8(%rbp)
je     1176 <main+0x56>
cmpl   $0x4,-0x8(%rbp)
jne    11b1 <main+0x91>
lea    0xeb5(%rip),%rdi
mov    $0x2,%esi
mov    $0x3,%edx
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdx
lea    0xeb7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11f1 <main+0xd1>
mov    -0x8(%rbp),%edx
sub    $0x1,%edx
lea    0xeb3(%rip),%rdi
mov    $0x2,%esi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xe72(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11f6 <main+0xd6>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
cmp    $0x2,%edi
jg     1137 <main+0x17>
lea    0xed0(%rip),%rdi
call   1030 <puts@plt>
jmp    11a4 <main+0x84>
mov    %rsi,%r14
mov    %edi,%ebx
lea    0xed4(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    -0x3(%rbx),%eax
cmp    $0x1,%eax
ja     1176 <main+0x56>
lea    0xed7(%rip),%rdi
mov    $0x2,%esi
mov    $0x3,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x10(%r14),%rsi
mov    0x18(%r14),%rdx
jmp    1196 <main+0x76>
add    $0xffffffff,%ebx
lea    0xef1(%rip),%rdi
mov    $0x2,%esi
mov    %ebx,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x10(%r14),%rsi
mov    (%r14,%rbx,8),%rdx
lea    0xebf(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [23 x i8] c"\0ANot enough arguments\0A\00"
@.str.1 = [27 x i8] c"\0ASo you had %d arguments\0A\0A\00"
@.str.2 = [42 x i8] c"I shall now work on %d and %d arguments..\00"
@.str.3 = [21 x i8] c"That being %s and %s\00"
@.str.4 = [43 x i8] c"I shall now work on %d and %d arguments..\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
%6 = load i32, i32* %4
%7 = icmp sle i32 %6, 2
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = call i32 @puts(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
br label %42
10: ; preds = %2
%11 = load i32, i32* %4
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i32 %11)
%13 = load i32, i32* %4
%14 = icmp eq i32 %13, 3
br i1 %14, label %18, label %15
15: ; preds = %10
%16 = load i32, i32* %4
%17 = icmp eq i32 %16, 4
br i1 %17, label %18, label %27
18: ; preds = %15, %10
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0), i32 2, i32 3)
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 2
%22 = load i8*, i8** %21
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 3
%25 = load i8*, i8** %24
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i8* %22, i8* %25)
br label %41
27: ; preds = %15
%28 = load i32, i32* %4
%29 = sub nsw i32 %28, 1
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.4, i64 0, i64 0), i32 2, i32 %29)
%31 = load i8**, i8*** %5
%32 = getelementptr inbounds i8*, i8** %31, i64 2
%33 = load i8*, i8** %32
%34 = load i8**, i8*** %5
%35 = load i32, i32* %4
%36 = sub nsw i32 %35, 1
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds i8*, i8** %34, i64 %37
%39 = load i8*, i8** %38
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i8* %33, i8* %39)
br label %41
41: ; preds = %27, %18
br label %42
42: ; preds = %41, %8
ret i32 0
}

LLVM IR (-O2):
@.str = [23 x i8] c"\0ANot enough arguments\0A\00"
@.str.1 = [27 x i8] c"\0ASo you had %d arguments\0A\0A\00"
@.str.2 = [42 x i8] c"I shall now work on %d and %d arguments..\00"
@.str.3 = [21 x i8] c"That being %s and %s\00"
@.str.4 = [43 x i8] c"I shall now work on %d and %d arguments..\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 3
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
br label %26
6: ; preds = %2
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i32 %0)
%8 = add nsw i32 %0, -3
%9 = icmp ult i32 %8, 2
br i1 %9, label %10, label %17
10: ; preds = %6
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0), i32 2, i32 3)
%12 = getelementptr inbounds i8*, i8** %1, i64 2
%13 = load i8*, i8** %12
%14 = getelementptr inbounds i8*, i8** %1, i64 3
%15 = load i8*, i8** %14
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i8* %13, i8* %15)
br label %26
17: ; preds = %6
%18 = add nsw i32 %0, -1
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.4, i64 0, i64 0), i32 2, i32 %18)
%20 = getelementptr inbounds i8*, i8** %1, i64 2
%21 = load i8*, i8** %20
%22 = zext i32 %18 to i64
%23 = getelementptr inbounds i8*, i8** %1, i64 %22
%24 = load i8*, i8** %23
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i8* %21, i8* %24)
br label %26
26: ; preds = %10, %17, %4
ret i32 0
}