#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*/ checkArgument(int, int, int);
int /*<<< orphan*/ printMonth(int, int);
int /*<<< orphan*/ printYear(int);
int main(int argc, char *argv[]) {
  int year, month, week;
  if (argc == 2) {
    year = atoi(argv[1]);
    checkArgument(2, year, 1);
    printYear(year);
  } else if (argc == 3) {
    year = atoi(argv[1]);
    month = atoi(argv[2]);
    checkArgument(3, year, month);
    printMonth(year, month);
  }
  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    118f <main+0x4f>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
mov    $0x2,%edi
mov    $0x1,%edx
call   1030 <checkArgument@plt>
mov    -0x14(%rbp),%edi
call   1040 <printYear@plt>
jmp    11d9 <main+0x99>
cmpl   $0x3,-0x8(%rbp)
jne    11d4 <main+0x94>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    $0x3,%edi
call   1030 <checkArgument@plt>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1050 <printMonth@plt>
jmp    11d9 <main+0x99>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
cmp    $0x3,%edi
je     1175 <main+0x35>
cmp    $0x2,%edi
jne    11a2 <main+0x62>
mov    0x8(%rbx),%rdi
call   1060 <atoi@plt>
mov    %eax,%ebx
mov    $0x2,%edi
mov    %eax,%esi
mov    $0x1,%edx
call   1030 <checkArgument@plt>
mov    %ebx,%edi
call   1040 <printYear@plt>
jmp    11a2 <main+0x62>
mov    0x8(%rbx),%rdi
call   1060 <atoi@plt>
mov    %eax,%ebp
mov    0x10(%rbx),%rdi
call   1060 <atoi@plt>
mov    %eax,%ebx
mov    $0x3,%edi
mov    %ebp,%esi
mov    %eax,%edx
call   1030 <checkArgument@plt>
mov    %ebp,%edi
mov    %ebx,%esi
call   1050 <printMonth@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* %4
%10 = icmp eq i32 %9, 2
br i1 %10, label %11, label %20
11: ; preds = %2
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = call i32 @atoi(i8* %14)
store i32 %15, i32* %6
%16 = load i32, i32* %6
%17 = call i32 @checkArgument(i32 2, i32 %16, i32 1)
%18 = load i32, i32* %6
%19 = call i32 @printYear(i32 %18)
br label %39
20: ; preds = %2
%21 = load i32, i32* %4
%22 = icmp eq i32 %21, 3
br i1 %22, label %23, label %38
23: ; preds = %20
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 1
%26 = load i8*, i8** %25
%27 = call i32 @atoi(i8* %26)
store i32 %27, i32* %6
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i64 2
%30 = load i8*, i8** %29
%31 = call i32 @atoi(i8* %30)
store i32 %31, i32* %7
%32 = load i32, i32* %6
%33 = load i32, i32* %7
%34 = call i32 @checkArgument(i32 3, i32 %32, i32 %33)
%35 = load i32, i32* %6
%36 = load i32, i32* %7
%37 = call i32 @printMonth(i32 %35, i32 %36)
br label %38
38: ; preds = %23, %20
br label %39
39: ; preds = %38, %11
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
switch i32 %0, label %18 [
i32 2, label %3
i32 3, label %9
]
3: ; preds = %2
%4 = getelementptr inbounds i8*, i8** %1, i64 1
%5 = load i8*, i8** %4
%6 = tail call i32 @atoi(i8* %5)
%7 = tail call i32 @checkArgument(i32 2, i32 %6, i32 1)
%8 = tail call i32 @printYear(i32 %6)
br label %18
9: ; preds = %2
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = tail call i32 @atoi(i8* %11)
%13 = getelementptr inbounds i8*, i8** %1, i64 2
%14 = load i8*, i8** %13
%15 = tail call i32 @atoi(i8* %14)
%16 = tail call i32 @checkArgument(i32 3, i32 %12, i32 %15)
%17 = tail call i32 @printMonth(i32 %12, i32 %15)
br label %18
18: ; preds = %2, %9, %3
ret i32 0
}