#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 *, int *);
int main() {
  int dia, any, mes, diesmes;
  int principi = 0;
  int correcte = 0;
  printf("\n\t\t--------------------		\n\t\tES LA DATA "
         "CORRECTE?		\n\t\t--------------------\n\n");
  printf("Entra la data a avaluar(DD/MM/YYYY):");
  scanf("%d/%d/%d", &dia, &mes, &any);
  if (mes < 13 && mes > 0) {
    if (mes <= 7 && mes != 2) {
      principi = 1;
    }
    if (mes % 2 == 0 && mes != 2) {
      diesmes = 31 - principi;
    } else if (mes != 2) {
      diesmes = 30 + principi;
    } else {
      if (any % 4 == 0 && any % 100 == 0 || any % 100 == 0 && any % 400 == 0) {
        diesmes = 29;
      } else {
        diesmes = 28;
      }
    }
    if (diesmes >= dia) {
      correcte = 1;
    }
  }
  if (correcte) {
    printf("%s %i/%i/%i es correcte.\n", "La data ", dia, mes, any);
  } else {
    printf("%s %i/%i/%i es incorrecte.\n", "La data ", dia, mes, any);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xefa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf11(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0x10(%rbp),%rdx
lea    -0xc(%rbp),%rcx
call   1040 <scanf@plt>
cmpl   $0xd,-0x10(%rbp)
jge    126b <main+0x14b>
cmpl   $0x0,-0x10(%rbp)
jle    126b <main+0x14b>
cmpl   $0x7,-0x10(%rbp)
jg     11a0 <main+0x80>
cmpl   $0x2,-0x10(%rbp)
je     11a0 <main+0x80>
movl   $0x1,-0x18(%rbp)
mov    -0x10(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11ce <main+0xae>
cmpl   $0x2,-0x10(%rbp)
je     11ce <main+0xae>
mov    $0x1f,%eax
sub    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    1253 <main+0x133>
cmpl   $0x2,-0x10(%rbp)
je     11e6 <main+0xc6>
mov    -0x18(%rbp),%eax
add    $0x1e,%eax
mov    %eax,-0x14(%rbp)
jmp    124e <main+0x12e>
mov    -0xc(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    120e <main+0xee>
mov    -0xc(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     1236 <main+0x116>
mov    -0xc(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1242 <main+0x122>
mov    -0xc(%rbp),%eax
mov    $0x190,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1242 <main+0x122>
movl   $0x1d,-0x14(%rbp)
jmp    1249 <main+0x129>
movl   $0x1c,-0x14(%rbp)
jmp    124e <main+0x12e>
jmp    1253 <main+0x133>
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jl     1266 <main+0x146>
movl   $0x1,-0x1c(%rbp)
jmp    126b <main+0x14b>
cmpl   $0x0,-0x1c(%rbp)
je     1299 <main+0x179>
mov    -0x8(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    -0xc(%rbp),%r8d
lea    0xdf4(%rip),%rdi
lea    0xe07(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12b8 <main+0x198>
mov    -0x8(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    -0xc(%rbp),%r8d
lea    0xdf3(%rip),%rdi
lea    0xde3(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xf32(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb9(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xed0(%rip),%rdi
lea    0x10(%rsp),%rsi
lea    0x14(%rsp),%rdx
lea    0xc(%rsp),%rcx
call   1050 <scanf@plt>
mov    0x14(%rsp),%ecx
lea    -0x1(%rcx),%eax
cmp    $0xc,%eax
jae    1197 <main+0x67>
cmp    $0x8,%ecx
setb   %al
cmp    $0x2,%ecx
setne  %dl
and    %al,%dl
movzbl %dl,%eax
cmp    $0x2,%ecx
je     119d <main+0x6d>
mov    %ecx,%edx
and    $0x1,%edx
jne    119d <main+0x6d>
xor    $0x1f,%eax
jmp    1200 <main+0xd0>
mov    0x10(%rsp),%edx
jmp    1208 <main+0xd8>
cmp    $0x2,%ecx
je     11a7 <main+0x77>
or     $0x1e,%eax
jmp    1200 <main+0xd0>
movslq 0xc(%rsp),%rdx
mov    %edx,%eax
and    $0x3,%eax
imul   $0x51eb851f,%rdx,%rsi
mov    %rsi,%rdi
shr    $0x3f,%rdi
sar    $0x25,%rsi
add    %edi,%esi
imul   $0x64,%esi,%edi
mov    %edx,%esi
sub    %edi,%esi
or     %esi,%eax
je     11fb <main+0xcb>
movslq %edx,%rax
imul   $0x51eb851f,%rax,%rax
mov    %rax,%rdi
shr    $0x3f,%rdi
sar    $0x27,%rax
add    %edi,%eax
imul   $0x190,%eax,%eax
sub    %eax,%edx
xor    %eax,%eax
or     %edx,%esi
sete   %al
or     $0x1c,%eax
jmp    1200 <main+0xd0>
mov    $0x1d,%eax
mov    0x10(%rsp),%edx
cmp    %edx,%eax
jge    1216 <main+0xe6>
mov    0xc(%rsp),%r8d
lea    0xe3d(%rip),%rdi
jmp    1222 <main+0xf2>
mov    0xc(%rsp),%r8d
lea    0xe0c(%rip),%rdi
lea    0xe1f(%rip),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [76 x i8] c"\0A\09\09--------------------\09\09\0A\09\09ES LA DATA CORRECTE?\09\09\0A\09\09--------------------\0A\0A\00"
@.str.1 = [37 x i8] c"Entra la data a avaluar(DD/MM/YYYY):\00"
@.str.2 = [9 x i8] c"%d/%d/%d\00"
@.str.3 = [26 x i8] c"%s %i/%i/%i es correcte.\0A\00"
@.str.4 = [9 x i8] c"La data \00"
@.str.5 = [28 x i8] c"%s %i/%i/%i es incorrecte.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %6
store i32 0, i32* %7
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str, i64 0, i64 0))
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32* %2, i32* %4, i32* %3)
%11 = load i32, i32* %4
%12 = icmp slt i32 %11, 13
br i1 %12, label %13, label %65
13: ; preds = %0
%14 = load i32, i32* %4
%15 = icmp sgt i32 %14, 0
br i1 %15, label %16, label %65
16: ; preds = %13
%17 = load i32, i32* %4
%18 = icmp sle i32 %17, 7
br i1 %18, label %19, label %23
19: ; preds = %16
%20 = load i32, i32* %4
%21 = icmp ne i32 %20, 2
br i1 %21, label %22, label %23
22: ; preds = %19
store i32 1, i32* %6
br label %23
23: ; preds = %22, %19, %16
%24 = load i32, i32* %4
%25 = srem i32 %24, 2
%26 = icmp eq i32 %25, 0
br i1 %26, label %27, label %33
27: ; preds = %23
%28 = load i32, i32* %4
%29 = icmp ne i32 %28, 2
br i1 %29, label %30, label %33
30: ; preds = %27
%31 = load i32, i32* %6
%32 = sub nsw i32 31, %31
store i32 %32, i32* %5
br label %59
33: ; preds = %27, %23
%34 = load i32, i32* %4
%35 = icmp ne i32 %34, 2
br i1 %35, label %36, label %39
36: ; preds = %33
%37 = load i32, i32* %6
%38 = add nsw i32 30, %37
store i32 %38, i32* %5
br label %58
39: ; preds = %33
%40 = load i32, i32* %3
%41 = srem i32 %40, 4
%42 = icmp eq i32 %41, 0
br i1 %42, label %43, label %47
43: ; preds = %39
%44 = load i32, i32* %3
%45 = srem i32 %44, 100
%46 = icmp eq i32 %45, 0
br i1 %46, label %55, label %47
47: ; preds = %43, %39
%48 = load i32, i32* %3
%49 = srem i32 %48, 100
%50 = icmp eq i32 %49, 0
br i1 %50, label %51, label %56
51: ; preds = %47
%52 = load i32, i32* %3
%53 = srem i32 %52, 400
%54 = icmp eq i32 %53, 0
br i1 %54, label %55, label %56
55: ; preds = %51, %43
store i32 29, i32* %5
br label %57
56: ; preds = %51, %47
store i32 28, i32* %5
br label %57
57: ; preds = %56, %55
br label %58
58: ; preds = %57, %36
br label %59
59: ; preds = %58, %30
%60 = load i32, i32* %5
%61 = load i32, i32* %2
%62 = icmp sge i32 %60, %61
br i1 %62, label %63, label %64
63: ; preds = %59
store i32 1, i32* %7
br label %64
64: ; preds = %63, %59
br label %65
65: ; preds = %64, %13, %0
%66 = load i32, i32* %7
%67 = icmp ne i32 %66, 0
br i1 %67, label %68, label %73
68: ; preds = %65
%69 = load i32, i32* %2
%70 = load i32, i32* %4
%71 = load i32, i32* %3
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i32 %69, i32 %70, i32 %71)
br label %78
73: ; preds = %65
%74 = load i32, i32* %2
%75 = load i32, i32* %4
%76 = load i32, i32* %3
%77 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i32 %74, i32 %75, i32 %76)
br label %78
78: ; preds = %73, %68
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [37 x i8] c"Entra la data a avaluar(DD/MM/YYYY):\00"
@.str.2 = [9 x i8] c"%d/%d/%d\00"
@.str.3 = [26 x i8] c"%s %i/%i/%i es correcte.\0A\00"
@.str.4 = [9 x i8] c"La data \00"
@.str.5 = [28 x i8] c"%s %i/%i/%i es incorrecte.\0A\00"
@str = [75 x i8] c"\0A\09\09--------------------\09\09\0A\09\09ES LA DATA CORRECTE?\09\09\0A\09\09--------------------\0A\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 @puts(i8* dereferenceable(1) getelementptr inbounds ([75 x i8], [75 x i8]* @str, i64 0, i64 0))
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32* %1, i32* %3, i32* %2)
%10 = load i32, i32* %3
%11 = add i32 %10, -1
%12 = icmp ult i32 %11, 12
br i1 %12, label %15, label %13
13: ; preds = %0
%14 = load i32, i32* %1
br label %46
15: ; preds = %0
%16 = icmp ult i32 %10, 8
%17 = icmp ne i32 %10, 2
%18 = and i1 %16, %17
%19 = zext i1 %18 to i32
%20 = and i32 %10, 1
%21 = icmp eq i32 %20, 0
%22 = and i1 %17, %21
br i1 %22, label %23, label %25
23: ; preds = %15
%24 = xor i32 %19, 31
br label %39
25: ; preds = %15
br i1 %17, label %26, label %28
26: ; preds = %25
%27 = or i32 %19, 30
br label %39
28: ; preds = %25
%29 = load i32, i32* %2
%30 = and i32 %29, 3
%31 = srem i32 %29, 100
%32 = or i32 %30, %31
%33 = icmp eq i32 %32, 0
br i1 %33, label %39, label %34
34: ; preds = %28
%35 = srem i32 %29, 400
%36 = or i32 %31, %35
%37 = icmp eq i32 %36, 0
%38 = select i1 %37, i32 29, i32 28
br label %39
39: ; preds = %34, %28, %26, %23
%40 = phi i32 [ %24, %23 ], [ %27, %26 ], [ 29, %28 ], [ %38, %34 ]
%41 = load i32, i32* %1
%42 = icmp slt i32 %40, %41
br i1 %42, label %46, label %43
43: ; preds = %39
%44 = load i32, i32* %2
%45 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i32 %41, i32 %10, i32 %44)
br label %50
46: ; preds = %13, %39
%47 = phi i32 [ %14, %13 ], [ %41, %39 ]
%48 = load i32, i32* %2
%49 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i32 %47, i32 %10, i32 %48)
br label %50
50: ; preds = %46, %43
ret i32 0
}