#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 main() {
  int dia, mes, ano;
  printf("Digita o Dia: ");
  scanf("%d", &dia);
  printf("Digite o mês: ");
  scanf("%d", &mes);
  printf("Digite o ano: ");
  scanf("%d", &ano);
  if (ano >= 2008) {
    if (mes < 1 && mes > 12) {
      printf("Mês inválido/Data Inválida!");
      return 0;
    } else {
      if (ano % 4 == 0 || ano % 400 == 0 && ano % 100 != 0) {
        if (mes == 2 && dia > 29) {
          printf("Dia inválido/Data inválida!");
        } else {
          printf("Data Inválida!");
        }
      } else {
        if (mes == 2 && dia > 28) {
          printf("Dia inválido/Data inválida!");
        } else {
          printf("Data Inválida!");
        }
      }
    }
  } else {
    printf("Data Inválida!");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
lea    0xecd(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xec0(%rip),%rdi
call   1030 <printf@plt>
lea    0xeb1(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xeb4(%rip),%rdi
call   1030 <printf@plt>
lea    0xe95(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x7d8,-0x10(%rbp)
jl     126e <main+0x14e>
cmpl   $0x1,-0xc(%rbp)
jge    11bc <main+0x9c>
cmpl   $0xc,-0xc(%rbp)
jle    11bc <main+0x9c>
lea    0xe86(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1281 <main+0x161>
mov    -0x10(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     11f8 <main+0xd8>
mov    -0x10(%rbp),%eax
mov    $0x190,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    122e <main+0x10e>
mov    -0x10(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     122e <main+0x10e>
cmpl   $0x2,-0xc(%rbp)
jne    121d <main+0xfd>
cmpl   $0x1d,-0x8(%rbp)
jle    121d <main+0xfd>
lea    0xe3d(%rip),%rdi
call   1030 <printf@plt>
jmp    1229 <main+0x109>
lea    0xe1c(%rip),%rdi
call   1030 <printf@plt>
jmp    1264 <main+0x144>
cmpl   $0x2,-0xc(%rbp)
jne    1253 <main+0x133>
cmpl   $0x1c,-0x8(%rbp)
jle    1253 <main+0x133>
lea    0xe07(%rip),%rdi
call   1030 <printf@plt>
jmp    125f <main+0x13f>
lea    0xde6(%rip),%rdi
call   1030 <printf@plt>
jmp    1264 <main+0x144>
jmp    1269 <main+0x149>
jmp    127a <main+0x15a>
lea    0xdcb(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xed4(%rip),%rdi
call   1030 <printf@plt>
lea    0xed7(%rip),%rbx
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0xec6(%rip),%rdi
call   1030 <printf@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0xebd(%rip),%rdi
call   1030 <printf@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
mov    0xc(%rsp),%eax
cmp    $0x7d8,%eax
jl     11b2 <main+0x92>
test   $0x3,%al
je     11ab <main+0x8b>
imul   $0xc28f5c29,%eax,%ecx
ror    $0x4,%ecx
cmp    $0xa3d70a,%ecx
ja     11bb <main+0x9b>
mov    %eax,%ecx
imul   $0x51eb851f,%rcx,%rcx
shr    $0x25,%rcx
imul   $0x64,%ecx,%ecx
sub    %ecx,%eax
je     11bb <main+0x9b>
cmpl   $0x1e,0x8(%rsp)
jmp    11c0 <main+0xa0>
lea    0xe96(%rip),%rdi
jmp    11db <main+0xbb>
cmpl   $0x1d,0x8(%rsp)
lea    0xe6a(%rip),%rdi
lea    0xe81(%rip),%rax
cmovl  %rax,%rdi
cmpl   $0x2,0x4(%rsp)
cmovne %rax,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [15 x i8] c"Digita o Dia: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [16 x i8] c"Digite o m\C3\AAs: \00"
@.str.3 = [15 x i8] c"Digite o ano: \00"
@.str.4 = [31 x i8] c"M\C3\AAs inv\C3\A1lido/Data Inv\C3\A1lida!\00"
@.str.5 = [30 x i8] c"Dia inv\C3\A1lido/Data inv\C3\A1lida!\00"
@.str.6 = [16 x i8] c"Data Inv\C3\A1lida!\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%7 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%9 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%11 = load i32, i32* %4
%12 = icmp sge i32 %11, 2008
br i1 %12, label %13, label %57
13: ; preds = %0
%14 = load i32, i32* %3
%15 = icmp slt i32 %14, 1
br i1 %15, label %16, label %21
16: ; preds = %13
%17 = load i32, i32* %3
%18 = icmp sgt i32 %17, 12
br i1 %18, label %19, label %21
19: ; preds = %16
%20 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0))
store i32 0, i32* %1
br label %60
21: ; preds = %16, %13
%22 = load i32, i32* %4
%23 = srem i32 %22, 4
%24 = icmp eq i32 %23, 0
br i1 %24, label %33, label %25
25: ; preds = %21
%26 = load i32, i32* %4
%27 = srem i32 %26, 400
%28 = icmp eq i32 %27, 0
br i1 %28, label %29, label %44
29: ; preds = %25
%30 = load i32, i32* %4
%31 = srem i32 %30, 100
%32 = icmp ne i32 %31, 0
br i1 %32, label %33, label %44
33: ; preds = %29, %21
%34 = load i32, i32* %3
%35 = icmp eq i32 %34, 2
br i1 %35, label %36, label %41
36: ; preds = %33
%37 = load i32, i32* %2
%38 = icmp sgt i32 %37, 29
br i1 %38, label %39, label %41
39: ; preds = %36
%40 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0))
br label %43
41: ; preds = %36, %33
%42 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0))
br label %43
43: ; preds = %41, %39
br label %55
44: ; preds = %29, %25
%45 = load i32, i32* %3
%46 = icmp eq i32 %45, 2
br i1 %46, label %47, label %52
47: ; preds = %44
%48 = load i32, i32* %2
%49 = icmp sgt i32 %48, 28
br i1 %49, label %50, label %52
50: ; preds = %47
%51 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0))
br label %54
52: ; preds = %47, %44
%53 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0))
br label %54
54: ; preds = %52, %50
br label %55
55: ; preds = %54, %43
br label %56
56: ; preds = %55
br label %59
57: ; preds = %0
%58 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0))
br label %59
59: ; preds = %57, %56
store i32 0, i32* %1
br label %60
60: ; preds = %59, %19
%61 = load i32, i32* %1
ret i32 %61
}

LLVM IR (-O2):
@.str = [15 x i8] c"Digita o Dia: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [16 x i8] c"Digite o m\C3\AAs: \00"
@.str.3 = [15 x i8] c"Digite o ano: \00"
@.str.5 = [30 x i8] c"Dia inv\C3\A1lido/Data inv\C3\A1lida!\00"
@.str.6 = [16 x i8] c"Data Inv\C3\A1lida!\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%9 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%11 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%13 = load i32, i32* %3
%14 = icmp sgt i32 %13, 2007
br i1 %14, label %15, label %38
15: ; preds = %0
%16 = and i32 %13, 3
%17 = icmp eq i32 %16, 0
br i1 %17, label %24, label %18
18: ; preds = %15
%19 = urem i32 %13, 400
%20 = icmp ne i32 %19, 0
%21 = urem i32 %13, 100
%22 = icmp eq i32 %21, 0
%23 = or i1 %20, %22
br i1 %23, label %31, label %24
24: ; preds = %18, %15
%25 = load i32, i32* %2
%26 = icmp eq i32 %25, 2
%27 = load i32, i32* %1
%28 = icmp sgt i32 %27, 29
%29 = select i1 %26, i1 %28, i1 false
%30 = select i1 %29, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0)
br label %38
31: ; preds = %18
%32 = load i32, i32* %2
%33 = icmp eq i32 %32, 2
%34 = load i32, i32* %1
%35 = icmp sgt i32 %34, 28
%36 = select i1 %33, i1 %35, i1 false
%37 = select i1 %36, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0)
br label %38
38: ; preds = %0, %31, %24
%39 = phi i8* [ %30, %24 ], [ %37, %31 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0), %0 ]
%40 = call i32 @printf(i8* dereferenceable(1) %39)
ret i32 0
}