#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*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, ...);
int /*<<< orphan*/ stdin;
int main() {
  for (;;) {
    int y;
    printf("Enter your year: ");
    scanf("%d", &y);
    if (y % 400 == 0)
      printf("%d is a leap year.\n", y);
    else if (y % 100 == 0)
      printf("%d is not a leap year.\n", y);
    else if (y % 4 == 0)
      printf("%d is a leap year.\n", y);
    else
      printf("%d is not a leap year.\n", y);
    char ch;
    printf("Press 'c' to continue.\n");
    fflush(stdin);
    scanf("%c", &ch);
    printf("\n");
    if (ch != 'c' && ch != 'C')
      break;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xebe(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    $0x190,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1189 <main+0x59>
mov    -0x8(%rbp),%esi
lea    0xe98(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11f8 <main+0xc8>
mov    -0x8(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11b3 <main+0x83>
mov    -0x8(%rbp),%esi
lea    0xe82(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11f3 <main+0xc3>
mov    -0x8(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11dd <main+0xad>
mov    -0x8(%rbp),%esi
lea    0xe44(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11ee <main+0xbe>
mov    -0x8(%rbp),%esi
lea    0xe42(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11f3 <main+0xc3>
jmp    11f8 <main+0xc8>
lea    0xe42(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2ddb(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
lea    0xe3e(%rip),%rdi
lea    -0x9(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
lea    0xe2a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsbl -0x9(%rbp),%eax
cmp    $0x63,%eax
je     1253 <main+0x123>
movsbl -0x9(%rbp),%eax
cmp    $0x43,%eax
je     1253 <main+0x123>
jmp    1258 <main+0x128>
jmp    113f <main+0xf>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xeb3(%rip),%r14
lea    0xedb(%rip),%r13
mov    0x2e78(%rip),%r15
lea    0xeca(%rip),%rbx
lea    0x3(%rsp),%rbp
lea    0xea6(%rip),%r12
jmp    11c9 <main+0x79>
cs nopw 0x0(%rax,%rax,1)
nop
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r13,%rdi
call   1040 <puts@plt>
mov    (%r15),%edi
call   1060 <fflush@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
movzbl 0x3(%rsp),%eax
and    $0xdf,%al
cmp    $0x43,%al
jne    122a <main+0xda>
lea    0xe30(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe34(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
mov    0x4(%rsp),%esi
imul   $0xc28f5c29,%esi,%eax
add    $0x51eb850,%eax
mov    %eax,%ecx
ror    $0x4,%ecx
mov    %r14,%rdi
cmp    $0xa3d70b,%ecx
jb     1190 <main+0x40>
ror    $0x2,%eax
mov    %r12,%rdi
cmp    $0x28f5c29,%eax
jb     1190 <main+0x40>
test   $0x3,%sil
mov    %r12,%rdi
cmove  %r14,%rdi
jmp    1190 <main+0x40>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [18 x i8] c"Enter your year: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [20 x i8] c"%d is a leap year.\0A\00"
@.str.3 = [24 x i8] c"%d is not a leap year.\0A\00"
@.str.4 = [24 x i8] c"Press 'c' to continue.\0A\00"
@stdin = global i32 0
@.str.5 = [3 x i8] c"%c\00"
@.str.6 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8
store i32 0, i32* %1
br label %4
4: ; preds = %46, %0
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%6 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%7 = load i32, i32* %2
%8 = srem i32 %7, 400
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %4
%11 = load i32, i32* %2
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %11)
br label %32
13: ; preds = %4
%14 = load i32, i32* %2
%15 = srem i32 %14, 100
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %20
17: ; preds = %13
%18 = load i32, i32* %2
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i32 %18)
br label %31
20: ; preds = %13
%21 = load i32, i32* %2
%22 = srem i32 %21, 4
%23 = icmp eq i32 %22, 0
br i1 %23, label %24, label %27
24: ; preds = %20
%25 = load i32, i32* %2
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %25)
br label %30
27: ; preds = %20
%28 = load i32, i32* %2
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i32 %28)
br label %30
30: ; preds = %27, %24
br label %31
31: ; preds = %30, %17
br label %32
32: ; preds = %31, %10
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0))
%34 = load i32, i32* @stdin
%35 = call i32 @fflush(i32 %34)
%36 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %3)
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%38 = load i8, i8* %3
%39 = sext i8 %38 to i32
%40 = icmp ne i32 %39, 99
br i1 %40, label %41, label %46
41: ; preds = %32
%42 = load i8, i8* %3
%43 = sext i8 %42 to i32
%44 = icmp ne i32 %43, 67
br i1 %44, label %45, label %46
45: ; preds = %41
br label %47
46: ; preds = %41, %32
br label %4
47: ; preds = %45
ret i32 0
}

LLVM IR (-O2):
@.str = [18 x i8] c"Enter your year: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [20 x i8] c"%d is a leap year.\0A\00"
@.str.3 = [24 x i8] c"%d is not a leap year.\0A\00"
@stdin = global i32 0
@.str.5 = [3 x i8] c"%c\00"
@str = [23 x i8] c"Press 'c' to continue.\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = bitcast i32* %1 to i8*
br label %4
4: ; preds = %17, %0
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%6 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%7 = load i32, i32* %1
%8 = srem i32 %7, 400
%9 = icmp eq i32 %8, 0
br i1 %9, label %17, label %10
10: ; preds = %4
%11 = srem i32 %7, 100
%12 = icmp eq i32 %11, 0
br i1 %12, label %17, label %13
13: ; preds = %10
%14 = and i32 %7, 3
%15 = icmp eq i32 %14, 0
%16 = select i1 %15, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0)
br label %17
17: ; preds = %13, %10, %4
%18 = phi i8* [ getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), %4 ], [ getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), %10 ], [ %16, %13 ]
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %18, i32 %7)
%20 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
%21 = load i32, i32* @stdin
%22 = call i32 @fflush(i32 %21)
%23 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %2)
%24 = call i32 @putchar(i32 10)
%25 = load i8, i8* %2
%26 = and i8 %25, -33
%27 = icmp eq i8 %26, 67
br i1 %27, label %4, label %28
28: ; preds = %17
ret i32 0
}