#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 dd = 0, mm = 0, aa = 0;
  printf("Introducir mes (##) y año (####): ");
  scanf("%d %d", &mm, &aa);
  switch (mm) {
  case 1:
  case 3:
  case 5:
  case 7:
  case 8:
  case 10:
  case 12:
    dd = 31;
    break;
  case 4:
  case 6:
  case 9:
  case 11:
    dd = 30;
    break;
  case 2:
    if ((aa % 4 == 0) && (aa % 100 != 0) || (aa % 400 == 0))
      dd = 29;
    else
      dd = 28;
    break;
  default:
    printf("\nEl mes no es válido\n");
    break;
  }
  if (mm >= 1 && mm <= 12)
    printf("\nEl mes %d del año %d tiene %d días\n", mm, aa, dd);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
lea    0xeb5(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xecb(%rip),%rdi
lea    -0xc(%rbp),%rsi
lea    -0x10(%rbp),%rdx
call   1040 <scanf@plt>
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
sub    $0x1,%eax
je     1227 <main+0x107>
jmp    117a <main+0x5a>
mov    -0x14(%rbp),%eax
sub    $0x2,%eax
je     123f <main+0x11f>
jmp    118b <main+0x6b>
mov    -0x14(%rbp),%eax
sub    $0x3,%eax
je     1227 <main+0x107>
jmp    119c <main+0x7c>
mov    -0x14(%rbp),%eax
sub    $0x4,%eax
je     1233 <main+0x113>
jmp    11ad <main+0x8d>
mov    -0x14(%rbp),%eax
sub    $0x5,%eax
je     1227 <main+0x107>
jmp    11be <main+0x9e>
mov    -0x14(%rbp),%eax
sub    $0x6,%eax
je     1233 <main+0x113>
jmp    11cf <main+0xaf>
mov    -0x14(%rbp),%eax
add    $0xfffffff9,%eax
sub    $0x2,%eax
jb     1227 <main+0x107>
jmp    11e3 <main+0xc3>
mov    -0x14(%rbp),%eax
sub    $0x9,%eax
je     1233 <main+0x113>
jmp    11f4 <main+0xd4>
mov    -0x14(%rbp),%eax
sub    $0xa,%eax
je     1227 <main+0x107>
jmp    1205 <main+0xe5>
mov    -0x14(%rbp),%eax
sub    $0xb,%eax
je     1233 <main+0x113>
jmp    1216 <main+0xf6>
mov    -0x14(%rbp),%eax
sub    $0xc,%eax
jne    1293 <main+0x173>
jmp    1227 <main+0x107>
movl   $0x1f,-0x8(%rbp)
jmp    12a1 <main+0x181>
movl   $0x1e,-0x8(%rbp)
jmp    12a1 <main+0x181>
mov    -0x10(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1267 <main+0x147>
mov    -0x10(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    127b <main+0x15b>
mov    -0x10(%rbp),%eax
mov    $0x190,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1287 <main+0x167>
movl   $0x1d,-0x8(%rbp)
jmp    128e <main+0x16e>
movl   $0x1c,-0x8(%rbp)
jmp    12a1 <main+0x181>
lea    0xd90(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x1,-0xc(%rbp)
jl     12cc <main+0x1ac>
cmpl   $0xc,-0xc(%rbp)
jg     12cc <main+0x1ac>
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x8(%rbp),%ecx
lea    0xd7c(%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
movl   $0x0,0xc(%rsp)
movl   $0x0,0x8(%rsp)
lea    0xeb4(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xec8(%rip),%rdi
lea    0xc(%rsp),%rsi
lea    0x8(%rsp),%rdx
call   1050 <scanf@plt>
mov    0xc(%rsp),%esi
cmp    $0xc,%esi
ja     120e <main+0xde>
mov    $0x15aa,%eax
bt     %esi,%eax
jae    1189 <main+0x59>
mov    $0x1f,%ebx
jmp    1198 <main+0x68>
mov    $0xa50,%eax
bt     %esi,%eax
jae    11bc <main+0x8c>
mov    $0x1e,%ebx
lea    -0x1(%rsi),%eax
cmp    $0xb,%eax
ja     11b4 <main+0x84>
mov    0x8(%rsp),%edx
lea    0xe7f(%rip),%rdi
mov    %ebx,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret
cmp    $0x2,%esi
jne    120e <main+0xde>
movslq 0x8(%rsp),%rax
mov    $0x2,%esi
test   $0x3,%al
jne    11f1 <main+0xc1>
imul   $0x51eb851f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x25,%rcx
add    %edx,%ecx
imul   $0x64,%ecx,%ecx
mov    %eax,%edx
mov    $0x1d,%ebx
sub    %ecx,%edx
jne    11a0 <main+0x70>
imul   $0xc28f5c29,%eax,%eax
add    $0x51eb850,%eax
ror    $0x4,%eax
xor    %ebx,%ebx
cmp    $0xa3d70b,%eax
setb   %bl
or     $0x1c,%ebx
jmp    11a0 <main+0x70>
lea    0xe3c(%rip),%rdi
call   1030 <puts@plt>
mov    0xc(%rsp),%esi
jmp    1198 <main+0x68>

LLVM IR (-O0):
@.str = [36 x i8] c"Introducir mes (##) y a\C3\B1o (####): \00"
@.str.1 = [6 x i8] c"%d %d\00"
@.str.2 = [23 x i8] c"\0AEl mes no es v\C3\A1lido\0A\00"
@.str.3 = [39 x i8] c"\0AEl mes %d del a\C3\B1o %d tiene %d d\C3\ADas\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
store i32 0, i32* %4
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %3, i32* %4)
%7 = load i32, i32* %3
switch i32 %7, label %25 [
i32 1, label %8
i32 3, label %8
i32 5, label %8
i32 7, label %8
i32 8, label %8
i32 10, label %8
i32 12, label %8
i32 4, label %9
i32 6, label %9
i32 9, label %9
i32 11, label %9
i32 2, label %10
]
8: ; preds = %0, %0, %0, %0, %0, %0, %0
store i32 31, i32* %2
br label %27
9: ; preds = %0, %0, %0, %0
store i32 30, i32* %2
br label %27
10: ; preds = %0
%11 = load i32, i32* %4
%12 = srem i32 %11, 4
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %18
14: ; preds = %10
%15 = load i32, i32* %4
%16 = srem i32 %15, 100
%17 = icmp ne i32 %16, 0
br i1 %17, label %22, label %18
18: ; preds = %14, %10
%19 = load i32, i32* %4
%20 = srem i32 %19, 400
%21 = icmp eq i32 %20, 0
br i1 %21, label %22, label %23
22: ; preds = %18, %14
store i32 29, i32* %2
br label %24
23: ; preds = %18
store i32 28, i32* %2
br label %24
24: ; preds = %23, %22
br label %27
25: ; preds = %0
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
br label %27
27: ; preds = %25, %24, %9, %8
%28 = load i32, i32* %3
%29 = icmp sge i32 %28, 1
br i1 %29, label %30, label %38
30: ; preds = %27
%31 = load i32, i32* %3
%32 = icmp sle i32 %31, 12
br i1 %32, label %33, label %38
33: ; preds = %30
%34 = load i32, i32* %3
%35 = load i32, i32* %4
%36 = load i32, i32* %2
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0), i32 %34, i32 %35, i32 %36)
br label %38
38: ; preds = %33, %30, %27
%39 = load i32, i32* %1
ret i32 %39
}

LLVM IR (-O2):
@.str = [36 x i8] c"Introducir mes (##) y a\C3\B1o (####): \00"
@.str.1 = [6 x i8] c"%d %d\00"
@.str.3 = [39 x i8] c"\0AEl mes %d del a\C3\B1o %d tiene %d d\C3\ADas\0A\00"
@str = [22 x i8] c"\0AEl mes no es v\C3\A1lido\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%4 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2)
%7 = load i32, i32* %1
switch i32 %7, label %20 [
i32 1, label %23
i32 3, label %23
i32 5, label %23
i32 7, label %23
i32 8, label %23
i32 10, label %23
i32 12, label %23
i32 4, label %8
i32 6, label %8
i32 9, label %8
i32 11, label %8
i32 2, label %9
]
8: ; preds = %0, %0, %0, %0
br label %23
9: ; preds = %0
%10 = load i32, i32* %2
%11 = and i32 %10, 3
%12 = icmp ne i32 %11, 0
%13 = srem i32 %10, 100
%14 = icmp eq i32 %13, 0
%15 = or i1 %12, %14
br i1 %15, label %16, label %28
16: ; preds = %9
%17 = srem i32 %10, 400
%18 = icmp eq i32 %17, 0
%19 = select i1 %18, i32 29, i32 28
br label %28
20: ; preds = %0
%21 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
%22 = load i32, i32* %1
br label %23
23: ; preds = %0, %0, %0, %0, %0, %0, %0, %20, %8
%24 = phi i32 [ %22, %20 ], [ %7, %8 ], [ %7, %0 ], [ %7, %0 ], [ %7, %0 ], [ %7, %0 ], [ %7, %0 ], [ %7, %0 ], [ %7, %0 ]
%25 = phi i32 [ 0, %20 ], [ 30, %8 ], [ 31, %0 ], [ 31, %0 ], [ 31, %0 ], [ 31, %0 ], [ 31, %0 ], [ 31, %0 ], [ 31, %0 ]
%26 = add i32 %24, -1
%27 = icmp ult i32 %26, 12
br i1 %27, label %28, label %33
28: ; preds = %16, %9, %23
%29 = phi i32 [ %25, %23 ], [ %19, %16 ], [ 29, %9 ]
%30 = phi i32 [ %24, %23 ], [ 2, %16 ], [ 2, %9 ]
%31 = load i32, i32* %2
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0), i32 %30, i32 %31, i32 %29)
br label %33
33: ; preds = %28, %23
ret i32 0
}