#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 *);
int main() {
  int dia, mes, ano;
  int ultimo_dia[] = {-1, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
  for (;;) {
    printf("Entre com dia [DD]..: ");
    scanf("%d", &dia);
    printf("Entre com mes [MM]..: ");
    scanf("%d", &mes);
    printf("Entre com ano [AAAA]: ");
    scanf("%d", &ano);
    if (dia <= 0 || mes < 0 || mes > 12 || ano <= 0) {
      printf("Data Invalida!\nFavor digitar novamente!\n");
      continue;
      system("pause");
    }
    if (ano % 4 == 0 && (ano % 400 == 0 || ano % 100 != 0))
      ultimo_dia[2] = 29;
    else
      ultimo_dia[2] = 28;
    if (dia > ultimo_dia[mes]) {
      printf("DATA INVALIDA!\nFavor digitar novamente!\n");
      continue;
      system("pause");
    }
    if (ano % 4 == 0 && (ano % 400 == 0 || ano % 100 != 0)) {
      printf("Ano Bissexto\n\n");
    }
    printf("Data informada %d/%d/%d é válida!\n", dia, mes, ano);
    break;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x50(%rbp),%rdi
lea    0xeb6(%rip),%rsi
mov    $0x34,%edx
call   1040 <memcpy@plt>
lea    0xed9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee2(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
lea    0xed5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec4(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1050 <scanf@plt>
lea    0xece(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea6(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1050 <scanf@plt>
cmpl   $0x0,-0x8(%rbp)
jle    11d6 <main+0xa6>
cmpl   $0x0,-0xc(%rbp)
jl     11d6 <main+0xa6>
cmpl   $0xc,-0xc(%rbp)
jg     11d6 <main+0xa6>
cmpl   $0x0,-0x10(%rbp)
jg     11e9 <main+0xb9>
lea    0xe9f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1154 <main+0x24>
mov    -0x10(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1231 <main+0x101>
mov    -0x10(%rbp),%eax
mov    $0x190,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     1225 <main+0xf5>
mov    -0x10(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     1231 <main+0x101>
movl   $0x1d,-0x48(%rbp)
jmp    1238 <main+0x108>
movl   $0x1c,-0x48(%rbp)
mov    -0x8(%rbp),%eax
movslq -0xc(%rbp),%rcx
cmp    -0x50(%rbp,%rcx,4),%eax
jle    125c <main+0x12c>
lea    0xe55(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1154 <main+0x24>
mov    -0x10(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    12a6 <main+0x176>
mov    -0x10(%rbp),%eax
mov    $0x190,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     1298 <main+0x168>
mov    -0x10(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     12a6 <main+0x176>
lea    0xe2f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
lea    0xe27(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    0xeec(%rip),%eax
mov    %eax,0x40(%rsp)
movaps 0xed1(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xeb5(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xe99(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
lea    0xed8(%rip),%rbx
lea    0xed4(%rip),%r12
lea    0x8(%rsp),%r13
lea    0xedf(%rip),%rbp
lea    0x4(%rsp),%r14
lea    0xf45(%rip),%r15
jmp    11be <main+0x8e>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movl   $0x1c,0x18(%rsp)
lea    0xf00(%rip),%rdi
cmp    0x10(%rsp,%rdx,4),%esi
jle    1290 <main+0x160>
call   1030 <puts@plt>
lea    0xe6f(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    %r12,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
call   1050 <scanf@plt>
mov    %rbp,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%esi
mov    %r15,%rdi
test   %esi,%esi
jle    11b9 <main+0x89>
mov    0x8(%rsp),%edx
mov    %r15,%rdi
test   %edx,%edx
js     11b9 <main+0x89>
mov    %r15,%rdi
cmp    $0xc,%edx
jg     11b9 <main+0x89>
mov    0x4(%rsp),%ecx
mov    %r15,%rdi
test   %ecx,%ecx
jle    11b9 <main+0x89>
test   $0x3,%cl
jne    11a0 <main+0x70>
imul   $0xc28f5c29,%ecx,%eax
ror    $0x4,%eax
cmp    $0xa3d70b,%eax
jb     125f <main+0x12f>
mov    %ecx,%eax
imul   $0x51eb851f,%rax,%rax
shr    $0x25,%rax
imul   $0x64,%eax,%eax
mov    %ecx,%edi
sub    %eax,%edi
je     11a0 <main+0x70>
movl   $0x1d,0x18(%rsp)
lea    0xe41(%rip),%rdi
cmp    0x10(%rsp,%rdx,4),%esi
jg     11b9 <main+0x89>
lea    0xe22(%rip),%rdi
call   1030 <puts@plt>
mov    0xc(%rsp),%esi
mov    0x8(%rsp),%edx
mov    0x4(%rsp),%ecx
lea    0xde5(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.main.ultimo_dia = [13 x i32] [i32 -1, i32 31, i32 28, i32 31, i32 30, i32 31, i32 30, i32 31, i32 31, i32 30, i32 31, i32 30, i32 31]
@.str = [23 x i8] c"Entre com dia [DD]..: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [23 x i8] c"Entre com mes [MM]..: \00"
@.str.3 = [23 x i8] c"Entre com ano [AAAA]: \00"
@.str.4 = [41 x i8] c"Data Invalida!\0AFavor digitar novamente!\0A\00"
@.str.5 = [41 x i8] c"DATA INVALIDA!\0AFavor digitar novamente!\0A\00"
@.str.6 = [15 x i8] c"Ano Bissexto\0A\0A\00"
@.str.7 = [37 x i8] c"Data informada %d/%d/%d \C3\A9 v\C3\A1lida!\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca [13 x i32]
store i32 0, i32* %1
%6 = bitcast [13 x i32]* %5 to i8*
br label %7
7: ; preds = %50, %25, %0
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%14 = load i32, i32* %2
%15 = icmp sle i32 %14, 0
br i1 %15, label %25, label %16
16: ; preds = %7
%17 = load i32, i32* %3
%18 = icmp slt i32 %17, 0
br i1 %18, label %25, label %19
19: ; preds = %16
%20 = load i32, i32* %3
%21 = icmp sgt i32 %20, 12
br i1 %21, label %25, label %22
22: ; preds = %19
%23 = load i32, i32* %4
%24 = icmp sle i32 %23, 0
br i1 %24, label %25, label %27
25: ; preds = %22, %19, %16, %7
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.4, i64 0, i64 0))
br label %7
27: ; preds = %22
%28 = load i32, i32* %4
%29 = srem i32 %28, 4
%30 = icmp eq i32 %29, 0
br i1 %30, label %31, label %41
31: ; preds = %27
%32 = load i32, i32* %4
%33 = srem i32 %32, 400
%34 = icmp eq i32 %33, 0
br i1 %34, label %39, label %35
35: ; preds = %31
%36 = load i32, i32* %4
%37 = srem i32 %36, 100
%38 = icmp ne i32 %37, 0
br i1 %38, label %39, label %41
39: ; preds = %35, %31
%40 = getelementptr inbounds [13 x i32], [13 x i32]* %5, i64 0, i64 2
store i32 29, i32* %40
br label %43
41: ; preds = %35, %27
%42 = getelementptr inbounds [13 x i32], [13 x i32]* %5, i64 0, i64 2
store i32 28, i32* %42
br label %43
43: ; preds = %41, %39
%44 = load i32, i32* %2
%45 = load i32, i32* %3
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds [13 x i32], [13 x i32]* %5, i64 0, i64 %46
%48 = load i32, i32* %47
%49 = icmp sgt i32 %44, %48
br i1 %49, label %50, label %52
50: ; preds = %43
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.5, i64 0, i64 0))
br label %7
52: ; preds = %43
%53 = load i32, i32* %4
%54 = srem i32 %53, 4
%55 = icmp eq i32 %54, 0
br i1 %55, label %56, label %66
56: ; preds = %52
%57 = load i32, i32* %4
%58 = srem i32 %57, 400
%59 = icmp eq i32 %58, 0
br i1 %59, label %64, label %60
60: ; preds = %56
%61 = load i32, i32* %4
%62 = srem i32 %61, 100
%63 = icmp ne i32 %62, 0
br i1 %63, label %64, label %66
64: ; preds = %60, %56
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0))
br label %66
66: ; preds = %64, %60, %52
%67 = load i32, i32* %2
%68 = load i32, i32* %3
%69 = load i32, i32* %4
%70 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.7, i64 0, i64 0), i32 %67, i32 %68, i32 %69)
br label %71
71: ; preds = %66
ret i32 0
}

LLVM IR (-O2):
@__const.main.ultimo_dia = [13 x i32] [i32 -1, i32 31, i32 28, i32 31, i32 30, i32 31, i32 30, i32 31, i32 31, i32 30, i32 31, i32 30, i32 31]
@.str = [23 x i8] c"Entre com dia [DD]..: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [23 x i8] c"Entre com mes [MM]..: \00"
@.str.3 = [23 x i8] c"Entre com ano [AAAA]: \00"
@.str.7 = [37 x i8] c"Data informada %d/%d/%d \C3\A9 v\C3\A1lida!\0A\00"
@str = [14 x i8] c"Ano Bissexto\0A\00"
@str.8 = [40 x i8] c"DATA INVALIDA!\0AFavor digitar novamente!\00"
@str.9 = [40 x i8] c"Data Invalida!\0AFavor digitar novamente!\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [13 x i32]
%5 = bitcast i32* %1 to i8*
%6 = bitcast i32* %2 to i8*
%7 = bitcast i32* %3 to i8*
%8 = bitcast [13 x i32]* %4 to i8*
%9 = getelementptr inbounds [13 x i32], [13 x i32]* %4, i64 0, i64 2
br label %10
10: ; preds = %27, %0
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0))
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%17 = load i32, i32* %1
%18 = icmp slt i32 %17, 1
%19 = load i32, i32* %2
%20 = icmp slt i32 %19, 0
%21 = select i1 %18, i1 true, i1 %20
%22 = icmp sgt i32 %19, 12
%23 = select i1 %21, i1 true, i1 %22
%24 = load i32, i32* %3
%25 = icmp slt i32 %24, 1
%26 = select i1 %23, i1 true, i1 %25
br i1 %26, label %27, label %30
27: ; preds = %10, %39, %49, %44
%28 = phi i8* [ getelementptr inbounds ([40 x i8], [40 x i8]* @str.8, i64 0, i64 0), %44 ], [ getelementptr inbounds ([40 x i8], [40 x i8]* @str.8, i64 0, i64 0), %49 ], [ getelementptr inbounds ([40 x i8], [40 x i8]* @str.8, i64 0, i64 0), %39 ], [ getelementptr inbounds ([40 x i8], [40 x i8]* @str.9, i64 0, i64 0), %10 ]
%29 = call i32 @puts(i8* dereferenceable(1) %28)
br label %10
30: ; preds = %10
%31 = and i32 %24, 3
%32 = icmp eq i32 %31, 0
br i1 %32, label %33, label %44
33: ; preds = %30
%34 = urem i32 %24, 400
%35 = icmp ne i32 %34, 0
%36 = urem i32 %24, 100
%37 = icmp eq i32 %36, 0
%38 = and i1 %35, %37
br i1 %38, label %39, label %49
39: ; preds = %33
store i32 28, i32* %9
%40 = zext i32 %19 to i64
%41 = getelementptr inbounds [13 x i32], [13 x i32]* %4, i64 0, i64 %40
%42 = load i32, i32* %41
%43 = icmp sgt i32 %17, %42
br i1 %43, label %27, label %59
44: ; preds = %30
store i32 28, i32* %9
%45 = zext i32 %19 to i64
%46 = getelementptr inbounds [13 x i32], [13 x i32]* %4, i64 0, i64 %45
%47 = load i32, i32* %46
%48 = icmp sgt i32 %17, %47
br i1 %48, label %27, label %59
49: ; preds = %33
store i32 29, i32* %9
%50 = zext i32 %19 to i64
%51 = getelementptr inbounds [13 x i32], [13 x i32]* %4, i64 0, i64 %50
%52 = load i32, i32* %51
%53 = icmp sgt i32 %17, %52
br i1 %53, label %27, label %54
54: ; preds = %49
%55 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
%56 = load i32, i32* %1
%57 = load i32, i32* %2
%58 = load i32, i32* %3
br label %59
59: ; preds = %39, %44, %54
%60 = phi i32 [ %58, %54 ], [ %24, %44 ], [ %24, %39 ]
%61 = phi i32 [ %57, %54 ], [ %19, %44 ], [ %19, %39 ]
%62 = phi i32 [ %56, %54 ], [ %17, %44 ], [ %17, %39 ]
%63 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.7, i64 0, i64 0), i32 %62, i32 %61, i32 %60)
ret i32 0
}