#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*/ getchar();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, long *);
main() {
  long int data, dia, mes, ano;
  printf("\n\t\t\tExercicio 19 - Lista 02\n\n");
  printf("\nInforme um dia para consistir: ");
  scanf("%li", &dia);
  printf("\nInforme um mes para consistir: ");
  scanf("%li", &mes);
  printf("\nInforme um mes para consistir: ");
  scanf("%li", &ano);
  if (dia <= 0 || dia > 31 || mes < 01 || mes > 12 || ano < 0 || ano > 10000) {
    printf("\n\n\tData Invalida!!!\n\n");
  } else
    printf("\n\n\tA data %.0li/%.0li/%0li é valida!\n\n", dia, mes, ano);
  getchar();
  getchar();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xedd(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1050 <scanf@plt>
lea    0xed1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xebf(%rip),%rdi
lea    -0x20(%rbp),%rsi
call   1050 <scanf@plt>
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea1(%rip),%rdi
lea    -0x28(%rbp),%rsi
call   1050 <scanf@plt>
cmpq   $0x0,-0x18(%rbp)
jle    11ec <main+0xbc>
cmpq   $0x1f,-0x18(%rbp)
jg     11ec <main+0xbc>
cmpq   $0x1,-0x20(%rbp)
jl     11ec <main+0xbc>
cmpq   $0xc,-0x20(%rbp)
jg     11ec <main+0xbc>
cmpq   $0x0,-0x28(%rbp)
jl     11ec <main+0xbc>
cmpq   $0x2710,-0x28(%rbp)
jle    11ff <main+0xcf>
lea    0xe71(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1219 <main+0xe9>
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
lea    0xe68(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0xf20(%rip),%rdi
call   1030 <puts@plt>
lea    0xea6(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeb9(%rip),%r14
lea    0x10(%rsp),%rsi
mov    %r14,%rdi
call   1060 <scanf@plt>
lea    0xea9(%rip),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %r14,%rdi
call   1060 <scanf@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rsp,%rsi
mov    %r14,%rdi
call   1060 <scanf@plt>
mov    0x10(%rsp),%rsi
lea    -0x20(%rsi),%rax
cmp    $0xffffffffffffffe1,%rax
jb     11e9 <main+0xa9>
mov    0x8(%rsp),%rdx
test   %rdx,%rdx
jle    11e9 <main+0xa9>
cmp    $0xc,%rdx
jg     11e9 <main+0xa9>
mov    (%rsp),%rcx
test   %rcx,%rcx
js     11e9 <main+0xa9>
cmp    $0x2711,%rcx
jge    11e9 <main+0xa9>
lea    0xe66(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11f5 <main+0xb5>
lea    0xe9b(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [30 x i8] c"\0A\09\09\09Exercicio 19 - Lista 02\0A\0A\00"
@.str.1 = [33 x i8] c"\0AInforme um dia para consistir: \00"
@.str.2 = [4 x i8] c"%li\00"
@.str.3 = [33 x i8] c"\0AInforme um mes para consistir: \00"
@.str.4 = [22 x i8] c"\0A\0A\09Data Invalida!!!\0A\0A\00"
@.str.5 = [40 x i8] c"\0A\0A\09A data %.0li/%.0li/%0li \C3\A9 valida!\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
store i32 0, i32* %1
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i64* %3)
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i64* %4)
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i64* %5)
%13 = load i64, i64* %3
%14 = icmp sle i64 %13, 0
br i1 %14, label %30, label %15
15: ; preds = %0
%16 = load i64, i64* %3
%17 = icmp sgt i64 %16, 31
br i1 %17, label %30, label %18
18: ; preds = %15
%19 = load i64, i64* %4
%20 = icmp slt i64 %19, 1
br i1 %20, label %30, label %21
21: ; preds = %18
%22 = load i64, i64* %4
%23 = icmp sgt i64 %22, 12
br i1 %23, label %30, label %24
24: ; preds = %21
%25 = load i64, i64* %5
%26 = icmp slt i64 %25, 0
br i1 %26, label %30, label %27
27: ; preds = %24
%28 = load i64, i64* %5
%29 = icmp sgt i64 %28, 10000
br i1 %29, label %30, label %32
30: ; preds = %27, %24, %21, %18, %15, %0
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0))
br label %37
32: ; preds = %27
%33 = load i64, i64* %3
%34 = load i64, i64* %4
%35 = load i64, i64* %5
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.5, i64 0, i64 0), i64 %33, i64 %34, i64 %35)
br label %37
37: ; preds = %32, %30
%38 = call i32 (...) @getchar()
%39 = call i32 (...) @getchar()
%40 = load i32, i32* %1
ret i32 %40
}

LLVM IR (-O2):
@.str.1 = [33 x i8] c"\0AInforme um dia para consistir: \00"
@.str.2 = [4 x i8] c"%li\00"
@.str.3 = [33 x i8] c"\0AInforme um mes para consistir: \00"
@.str.5 = [40 x i8] c"\0A\0A\09A data %.0li/%.0li/%0li \C3\A9 valida!\0A\0A\00"
@str = [29 x i8] c"\0A\09\09\09Exercicio 19 - Lista 02\0A\00"
@str.6 = [21 x i8] c"\0A\0A\09Data Invalida!!!\0A\00"
define i32 @main() {
%1 = alloca i64
%2 = alloca i64
%3 = alloca i64
%4 = bitcast i64* %1 to i8*
%5 = bitcast i64* %2 to i8*
%6 = bitcast i64* %3 to i8*
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str, i64 0, i64 0))
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i64* %1)
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i64* %2)
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i64* %3)
%14 = load i64, i64* %1
%15 = add i64 %14, -32
%16 = icmp ult i64 %15, -31
%17 = load i64, i64* %2
%18 = icmp slt i64 %17, 1
%19 = select i1 %16, i1 true, i1 %18
%20 = icmp sgt i64 %17, 12
%21 = select i1 %19, i1 true, i1 %20
%22 = load i64, i64* %3
%23 = icmp slt i64 %22, 0
%24 = select i1 %21, i1 true, i1 %23
%25 = icmp sgt i64 %22, 10000
%26 = select i1 %24, i1 true, i1 %25
br i1 %26, label %27, label %29
27: ; preds = %0
%28 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.6, i64 0, i64 0))
br label %31
29: ; preds = %0
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.5, i64 0, i64 0), i64 %14, i64 %17, i64 %22)
br label %31
31: ; preds = %29, %27
%32 = call i32 (...) @getchar()
%33 = call i32 (...) @getchar()
ret i32 0
}