#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*/ scanf(char *, int *);
int /*<<< orphan*/ system(char *);
main() {
  int ano, div4, div100, div400;
  while (ano != 9999) {
    printf("VERIFICADOR DE ANO BISSEXTO\n\n");
    printf("Insira o ano com 4 digitos (9999 para sair): ");
    scanf("%d", &ano);
    div4 = ano % 4;
    div100 = ano % 100;
    div400 = ano % 400;
    if (div4 == 0) {
      if (div100 != 0) {
        printf("Ano Bissexto");
      } else {
        if (div400 == 0) {
          printf("Ano Bissexto");
        } else {
          printf("O ano NAO e Bissexto");
        }
      }
    } else {
      if (div400 == 0) {
        printf("Ano Bissexto");
      } else {
        printf("O ano NAO e Bissexto");
      }
    }
    printf("\n\n");
    system("PAUSE");
    system("cls");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
cmpl   $0x270f,-0x8(%rbp)
je     1249 <main+0x119>
lea    0xead(%rip),%rdi
call   1040 <printf@plt>
lea    0xebf(%rip),%rdi
call   1040 <printf@plt>
lea    0xee1(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x190,%ecx
cltd
idiv   %ecx
mov    %edx,-0x14(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    11f4 <main+0xc4>
cmpl   $0x0,-0x10(%rbp)
je     11c3 <main+0x93>
lea    0xe96(%rip),%rdi
call   1040 <printf@plt>
jmp    11ef <main+0xbf>
cmpl   $0x0,-0x14(%rbp)
jne    11de <main+0xae>
lea    0xe7b(%rip),%rdi
call   1040 <printf@plt>
jmp    11ea <main+0xba>
lea    0xe77(%rip),%rdi
call   1040 <printf@plt>
jmp    11ef <main+0xbf>
jmp    1220 <main+0xf0>
cmpl   $0x0,-0x14(%rbp)
jne    120f <main+0xdf>
lea    0xe4a(%rip),%rdi
call   1040 <printf@plt>
jmp    121b <main+0xeb>
lea    0xe46(%rip),%rdi
call   1040 <printf@plt>
jmp    1220 <main+0xf0>
lea    0xdf4(%rip),%rdi
call   1040 <printf@plt>
lea    0xe3e(%rip),%rdi
call   1030 <system@plt>
lea    0xe38(%rip),%rdi
call   1030 <system@plt>
jmp    113f <main+0xf>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xedc(%rip),%r12
lea    0x4(%rsp),%r13
lea    0xed3(%rip),%r15
lea    0xf13(%rip),%rbx
lea    0xee7(%rip),%rbp
lea    0xee6(%rip),%r14
jmp    11c1 <main+0x81>
cs nopw 0x0(%rax,%rax,1)
nop
imul   $0xc28f5c29,%ecx,%ecx
add    $0x51eb850,%ecx
ror    $0x2,%ecx
mov    %r15,%rdi
cmp    $0x28f5c28,%ecx
jbe    1210 <main+0xd0>
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %rbp,%rdi
call   1040 <system@plt>
mov    %r14,%rdi
call   1040 <system@plt>
cmpl   $0x270f,0x4(%rsp)
je     1223 <main+0xe3>
lea    0xe95(%rip),%rdi
call   1030 <puts@plt>
lea    0xe2c(%rip),%rdi
call   1050 <printf@plt>
mov    %r12,%rdi
mov    %r13,%rsi
call   1060 <scanf@plt>
movslq 0x4(%rsp),%rcx
imul   $0x51eb851f,%rcx,%rax
mov    %rax,%rdx
shr    $0x3f,%rdx
sar    $0x27,%rax
add    %edx,%eax
imul   $0x190,%eax,%edx
mov    %ecx,%eax
sub    %edx,%eax
test   $0x3,%cl
je     1180 <main+0x40>
mov    %r15,%rdi
test   %eax,%eax
je     119a <main+0x5a>
lea    0xe20(%rip),%rdi
jmp    119a <main+0x5a>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [30 x i8] c"VERIFICADOR DE ANO BISSEXTO\0A\0A\00"
@.str.1 = [46 x i8] c"Insira o ano com 4 digitos (9999 para sair): \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [13 x i8] c"Ano Bissexto\00"
@.str.4 = [21 x i8] c"O ano NAO e Bissexto\00"
@.str.5 = [3 x i8] c"\0A\0A\00"
@.str.6 = [6 x i8] c"PAUSE\00"
@.str.7 = [4 x i8] c"cls\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
br label %6
6: ; preds = %43, %0
%7 = load i32, i32* %2
%8 = icmp ne i32 %7, 9999
br i1 %8, label %9, label %47
9: ; preds = %6
%10 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.1, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%13 = load i32, i32* %2
%14 = srem i32 %13, 4
store i32 %14, i32* %3
%15 = load i32, i32* %2
%16 = srem i32 %15, 100
store i32 %16, i32* %4
%17 = load i32, i32* %2
%18 = srem i32 %17, 400
store i32 %18, i32* %5
%19 = load i32, i32* %3
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %35
21: ; preds = %9
%22 = load i32, i32* %4
%23 = icmp ne i32 %22, 0
br i1 %23, label %24, label %26
24: ; preds = %21
%25 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
br label %34
26: ; preds = %21
%27 = load i32, i32* %5
%28 = icmp eq i32 %27, 0
br i1 %28, label %29, label %31
29: ; preds = %26
%30 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
br label %33
31: ; preds = %26
%32 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
br label %33
33: ; preds = %31, %29
br label %34
34: ; preds = %33, %24
br label %43
35: ; preds = %9
%36 = load i32, i32* %5
%37 = icmp eq i32 %36, 0
br i1 %37, label %38, label %40
38: ; preds = %35
%39 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
br label %42
40: ; preds = %35
%41 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
br label %42
42: ; preds = %40, %38
br label %43
43: ; preds = %42, %34
%44 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
%45 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
%46 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
br label %6
47: ; preds = %6
%48 = load i32, i32* %1
ret i32 %48
}

LLVM IR (-O2):
@.str.1 = [46 x i8] c"Insira o ano com 4 digitos (9999 para sair): \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [13 x i8] c"Ano Bissexto\00"
@.str.4 = [21 x i8] c"O ano NAO e Bissexto\00"
@.str.6 = [6 x i8] c"PAUSE\00"
@.str.7 = [4 x i8] c"cls\00"
@str = [29 x i8] c"VERIFICADOR DE ANO BISSEXTO\0A\00"
@str.8 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
br label %3
3: ; preds = %0, %20
%4 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str, i64 0, i64 0))
%5 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%7 = load i32, i32* %1
%8 = srem i32 %7, 400
%9 = and i32 %7, 3
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %17
11: ; preds = %3
%12 = srem i32 %7, 100
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %20
14: ; preds = %11
%15 = icmp eq i32 %8, 0
%16 = select i1 %15, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0)
br label %20
17: ; preds = %3
%18 = icmp eq i32 %8, 0
%19 = select i1 %18, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0)
br label %20
20: ; preds = %17, %14, %11
%21 = phi i8* [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), %11 ], [ %16, %14 ], [ %19, %17 ]
%22 = call i32 @printf(i8* dereferenceable(1) %21)
%23 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.8, i64 0, i64 0))
%24 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
%25 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
%26 = load i32, i32* %1
%27 = icmp eq i32 %26, 9999
br i1 %27, label %28, label %3
28: ; preds = %20
ret i32 0
}