#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*/ EXIT_FAILURE;
int /*<<< orphan*/ EXIT_SUCCESS;
int atoi(char *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ stderr;
int main(int argc, char *argv[]) {
  if (argc != 2) {
    fprintf(stderr,
            "%s Expected 1 argument, but instead received %d arguments\n",
            argv[0], argc - 1);
    exit(EXIT_FAILURE);
  } else {
    int year = atoi(argv[1]);
    if (year % 400 == 0 || (year % 4 == 0 && year % 100 != 0)) {
      printf("%d is a leap year", year);
    } else {
      printf("%d is NOT a leap year", year);
    }
    exit(EXIT_SUCCESS);
  }
  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)
je     1190 <main+0x50>
mov    0x2e79(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
lea    0xe83(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e4f(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    $0x190,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     11dc <main+0x9c>
mov    -0x14(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11f0 <main+0xb0>
mov    -0x14(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     11f0 <main+0xb0>
mov    -0x14(%rbp),%esi
lea    0xe55(%rip),%rdi
call   1030 <printf@plt>
jmp    11ff <main+0xbf>
mov    -0x14(%rbp),%esi
lea    0xe53(%rip),%rdi
call   1030 <printf@plt>
mov    0x2dca(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x2,%edi
jne    1171 <main+0x31>
mov    0x8(%rsi),%rdi
call   1050 <atoi@plt>
imul   $0xc28f5c29,%eax,%ecx
add    $0x51eb850,%ecx
mov    %ecx,%edx
ror    $0x4,%edx
cmp    $0xa3d70b,%edx
jae    119c <main+0x5c>
lea    0xecc(%rip),%rdi
jmp    11bd <main+0x7d>
mov    %edi,%ecx
mov    0x2e66(%rip),%rax
mov    (%rax),%edi
mov    (%rsi),%rdx
add    $0xffffffff,%ecx
lea    0xe77(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e43(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
ror    $0x2,%ecx
cmp    $0x28f5c29,%ecx
lea    0xea1(%rip),%rcx
lea    0xe88(%rip),%rdi
cmovb  %rcx,%rdi
test   $0x3,%al
cmovne %rcx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    0x2e05(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [59 x i8] c"%s Expected 1 argument, but instead received %d arguments\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [18 x i8] c"%d is a leap year\00"
@.str.2 = [22 x i8] c"%d is NOT a leap year\00"
@EXIT_SUCCESS = global i32 0
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
%7 = load i32, i32* %4
%8 = icmp ne i32 %7, 2
br i1 %8, label %9, label %19
9: ; preds = %2
%10 = load i32, i32* @stderr
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 0
%13 = load i8*, i8** %12
%14 = load i32, i32* %4
%15 = sub nsw i32 %14, 1
%16 = call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str, i64 0, i64 0), i8* %13, i32 %15)
%17 = load i32, i32* @EXIT_FAILURE
%18 = call i32 @exit(i32 %17)
unreachable
19: ; preds = %2
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 1
%22 = load i8*, i8** %21
%23 = call i32 @atoi(i8* %22)
store i32 %23, i32* %6
%24 = load i32, i32* %6
%25 = srem i32 %24, 400
%26 = icmp eq i32 %25, 0
br i1 %26, label %35, label %27
27: ; preds = %19
%28 = load i32, i32* %6
%29 = srem i32 %28, 4
%30 = icmp eq i32 %29, 0
br i1 %30, label %31, label %38
31: ; preds = %27
%32 = load i32, i32* %6
%33 = srem i32 %32, 100
%34 = icmp ne i32 %33, 0
br i1 %34, label %35, label %38
35: ; preds = %31, %19
%36 = load i32, i32* %6
%37 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %36)
br label %41
38: ; preds = %31, %27
%39 = load i32, i32* %6
%40 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 %39)
br label %41
41: ; preds = %38, %35
%42 = load i32, i32* @EXIT_SUCCESS
%43 = call i32 @exit(i32 %42)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [59 x i8] c"%s Expected 1 argument, but instead received %d arguments\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [18 x i8] c"%d is a leap year\00"
@.str.2 = [22 x i8] c"%d is NOT a leap year\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %11, label %4
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = load i8*, i8** %1
%7 = add nsw i32 %0, -1
%8 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str, i64 0, i64 0), i8* %6, i32 %7)
%9 = load i32, i32* @EXIT_FAILURE
%10 = tail call i32 @exit(i32 %9)
unreachable
11: ; preds = %2
%12 = getelementptr inbounds i8*, i8** %1, i64 1
%13 = load i8*, i8** %12
%14 = tail call i32 @atoi(i8* %13)
%15 = srem i32 %14, 400
%16 = icmp eq i32 %15, 0
br i1 %16, label %24, label %17
17: ; preds = %11
%18 = and i32 %14, 3
%19 = icmp ne i32 %18, 0
%20 = srem i32 %14, 100
%21 = icmp eq i32 %20, 0
%22 = or i1 %19, %21
%23 = select i1 %22, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0)
br label %24
24: ; preds = %17, %11
%25 = phi i8* [ getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), %11 ], [ %23, %17 ]
%26 = tail call i32 @printf(i8* %25, i32 %14)
%27 = load i32, i32* @EXIT_SUCCESS
%28 = tail call i32 @exit(i32 %27)
unreachable
}