#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*/ LC_ALL;
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ setlocale(int /*<<< orphan*/, char *);
main() {
  setlocale(LC_ALL, "");
  int data, dia, mes, ano;
  printf("\n [ ------------------- Valida DATA ------------------- ] \n");
  printf("\n   Por favor, digite o dia: ");
  scanf("%d", &dia);
  printf("   Por favor, digite o mês: ");
  scanf("%d", &mes);
  printf("   Por favor, digite o ano: ");
  scanf("%d", &ano);
  if (dia <= 0 || dia > 31) {
    printf("\n   Erro: dia inválido \n");
  } else if (mes <= 0 || mes > 12) {
    printf("\n   Erro: mês inválido \n");
  } else if (ano < 1900) {
    printf("\n   Erro: ano inválido \n");
  } else {
    printf("\n   Data correta: %d/%d/%d \n", dia, mes, ano);
  }
  printf("\n [ --------------------------------------------------- ] \n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e9a(%rip),%rax
mov    (%rax),%edi
lea    0xeec(%rip),%rsi
call   1040 <setlocale@plt>
lea    0xea5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee3(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1050 <scanf@plt>
lea    0xed6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec5(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1050 <scanf@plt>
lea    0xed6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea7(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1050 <scanf@plt>
cmpl   $0x0,-0xc(%rbp)
jle    11d0 <main+0xa0>
cmpl   $0x1f,-0xc(%rbp)
jle    11e3 <main+0xb3>
lea    0xec1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    124b <main+0x11b>
cmpl   $0x0,-0x10(%rbp)
jle    11f7 <main+0xc7>
cmpl   $0xc,-0x10(%rbp)
jle    120a <main+0xda>
lea    0xeb4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1246 <main+0x116>
cmpl   $0x76c,-0x14(%rbp)
jge    122a <main+0xfa>
lea    0xeaf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1241 <main+0x111>
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
lea    0xead(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1246 <main+0x116>
jmp    124b <main+0x11b>
lea    0xeb2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
mov    0x2e94(%rip),%rax
mov    (%rax),%edi
lea    0xf23(%rip),%rsi
call   1050 <setlocale@plt>
lea    0xf18(%rip),%rdi
call   1030 <puts@plt>
lea    0xe93(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xea3(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
lea    0xe92(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
lea    0xe95(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
mov    0xc(%rsp),%esi
lea    -0x20(%rsi),%eax
cmp    $0xffffffe0,%eax
ja     11d8 <main+0x98>
lea    0xf51(%rip),%rdi
call   1030 <puts@plt>
jmp    121a <main+0xda>
mov    0x8(%rsp),%edx
lea    -0xd(%rdx),%eax
cmp    $0xfffffff3,%eax
ja     11f2 <main+0xb2>
lea    0xf1d(%rip),%rdi
call   1030 <puts@plt>
jmp    121a <main+0xda>
mov    0x4(%rsp),%ecx
cmp    $0x76b,%ecx
jg     120c <main+0xcc>
lea    0xeea(%rip),%rdi
call   1030 <puts@plt>
jmp    121a <main+0xda>
lea    0xe49(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe93(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@LC_ALL = global i32 0
@.str = [1 x i8] zeroinitializer
@.str.1 = [60 x i8] c"\0A [ ------------------- Valida DATA ------------------- ] \0A\00"
@.str.2 = [30 x i8] c"\0A Por favor, digite o dia: \00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [30 x i8] c" Por favor, digite o m\C3\AAs: \00"
@.str.5 = [29 x i8] c" Por favor, digite o ano: \00"
@.str.6 = [26 x i8] c"\0A Erro: dia inv\C3\A1lido \0A\00"
@.str.7 = [27 x i8] c"\0A Erro: m\C3\AAs inv\C3\A1lido \0A\00"
@.str.8 = [26 x i8] c"\0A Erro: ano inv\C3\A1lido \0A\00"
@.str.9 = [29 x i8] c"\0A Data correta: %d/%d/%d \0A\00"
@.str.10 = [60 x i8] c"\0A [ --------------------------------------------------- ] \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = load i32, i32* @LC_ALL
%7 = call i32 @setlocale(i32 %6, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %3)
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %4)
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.5, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %5)
%15 = load i32, i32* %3
%16 = icmp sle i32 %15, 0
br i1 %16, label %20, label %17
17: ; preds = %0
%18 = load i32, i32* %3
%19 = icmp sgt i32 %18, 31
br i1 %19, label %20, label %22
20: ; preds = %17, %0
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0))
br label %42
22: ; preds = %17
%23 = load i32, i32* %4
%24 = icmp sle i32 %23, 0
br i1 %24, label %28, label %25
25: ; preds = %22
%26 = load i32, i32* %4
%27 = icmp sgt i32 %26, 12
br i1 %27, label %28, label %30
28: ; preds = %25, %22
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.7, i64 0, i64 0))
br label %41
30: ; preds = %25
%31 = load i32, i32* %5
%32 = icmp slt i32 %31, 1900
br i1 %32, label %33, label %35
33: ; preds = %30
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.8, i64 0, i64 0))
br label %40
35: ; preds = %30
%36 = load i32, i32* %3
%37 = load i32, i32* %4
%38 = load i32, i32* %5
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.9, i64 0, i64 0), i32 %36, i32 %37, i32 %38)
br label %40
40: ; preds = %35, %33
br label %41
41: ; preds = %40, %28
br label %42
42: ; preds = %41, %20
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.10, i64 0, i64 0))
%44 = load i32, i32* %1
ret i32 %44
}

LLVM IR (-O2):
@LC_ALL = global i32 0
@.str = [1 x i8] zeroinitializer
@.str.2 = [30 x i8] c"\0A Por favor, digite o dia: \00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [30 x i8] c" Por favor, digite o m\C3\AAs: \00"
@.str.5 = [29 x i8] c" Por favor, digite o ano: \00"
@.str.9 = [29 x i8] c"\0A Data correta: %d/%d/%d \0A\00"
@str = [59 x i8] c"\0A [ ------------------- Valida DATA ------------------- ] \00"
@str.11 = [59 x i8] c"\0A [ --------------------------------------------------- ] \00"
@str.12 = [25 x i8] c"\0A Erro: ano inv\C3\A1lido \00"
@str.13 = [26 x i8] c"\0A Erro: m\C3\AAs inv\C3\A1lido \00"
@str.14 = [25 x i8] c"\0A Erro: dia inv\C3\A1lido \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = load i32, i32* @LC_ALL
%5 = tail call i32 @setlocale(i32 %4, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%6 = bitcast i32* %1 to i8*
%7 = bitcast i32* %2 to i8*
%8 = bitcast i32* %3 to i8*
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @str, i64 0, i64 0))
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %1)
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %2)
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.5, i64 0, i64 0))
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %3)
%16 = load i32, i32* %1
%17 = add i32 %16, -32
%18 = icmp ult i32 %17, -31
br i1 %18, label %19, label %21
19: ; preds = %0
%20 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.14, i64 0, i64 0))
br label %34
21: ; preds = %0
%22 = load i32, i32* %2
%23 = add i32 %22, -13
%24 = icmp ult i32 %23, -12
br i1 %24, label %25, label %27
25: ; preds = %21
%26 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.13, i64 0, i64 0))
br label %34
27: ; preds = %21
%28 = load i32, i32* %3
%29 = icmp slt i32 %28, 1900
br i1 %29, label %30, label %32
30: ; preds = %27
%31 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.12, i64 0, i64 0))
br label %34
32: ; preds = %27
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.9, i64 0, i64 0), i32 %16, i32 %22, i32 %28)
br label %34
34: ; preds = %25, %32, %30, %19
%35 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @str.11, i64 0, i64 0))
ret i32 0
}