#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 EXIT_SUCCESS;
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main(int argc, char **argv) {
  int _numMes;
  printf("Introdueix el numero del mes que vols comprovar els dies: ");
  scanf("%d", &_numMes);
  while (_numMes < 1 || _numMes > 12) {
    printf("Mes incorrecte. Introdueix un nº correcte de mes (1-12)");
    scanf("%d", &_numMes);
  }
  switch (_numMes) {
  case 4:
  case 6:
  case 9:
  case 11:
    printf("El mes %d té 30 dies\n", _numMes);
    break;
  case 2:
    printf("\nEl mes %d té 29 dies\n", _numMes);
    break;
  default:
    printf("\nEl més %d té 31 dies\n", _numMes);
  }
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xef0(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
mov    $0x1,%al
cmpl   $0x1,-0x14(%rbp)
mov    %al,-0x15(%rbp)
jl     116d <main+0x4d>
cmpl   $0xc,-0x14(%rbp)
setg   %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
test   $0x1,%al
jne    117d <main+0x5d>
jmp    11a0 <main+0x80>
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea9(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
jmp    1154 <main+0x34>
mov    -0x14(%rbp),%eax
mov    %eax,-0x1c(%rbp)
sub    $0x2,%eax
je     120e <main+0xee>
jmp    11b4 <main+0x94>
mov    -0x1c(%rbp),%eax
sub    $0x4,%eax
je     11f8 <main+0xd8>
jmp    11c5 <main+0xa5>
mov    -0x1c(%rbp),%eax
sub    $0x6,%eax
je     11f8 <main+0xd8>
jmp    11d6 <main+0xb6>
mov    -0x1c(%rbp),%eax
sub    $0x9,%eax
je     11f8 <main+0xd8>
jmp    11e7 <main+0xc7>
mov    -0x1c(%rbp),%eax
sub    $0xb,%eax
jne    1224 <main+0x104>
jmp    11f8 <main+0xd8>
mov    -0x14(%rbp),%esi
lea    0xe75(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1235 <main+0x115>
mov    -0x14(%rbp),%esi
lea    0xe76(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1235 <main+0x115>
mov    -0x14(%rbp),%esi
lea    0xe78(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2da4(%rip),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xed0(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xefd(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%esi
lea    -0xd(%rsi),%eax
cmp    $0xfffffff3,%eax
ja     1191 <main+0x71>
lea    0xee3(%rip),%r14
lea    0xed9(%rip),%r15
lea    0xc(%rsp),%rbx
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%esi
lea    -0xd(%rsi),%eax
cmp    $0xfffffff4,%eax
jb     1170 <main+0x50>
cmp    $0xb,%esi
ja     11d4 <main+0xb4>
mov    $0xa50,%eax
bt     %esi,%eax
jae    11c1 <main+0xa1>
lea    0xed0(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x2e2b(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret
cmp    $0x2,%esi
jne    11d4 <main+0xb4>
lea    0xec1(%rip),%rdi
mov    $0x2,%esi
jmp    11a7 <main+0x87>
lea    0xecb(%rip),%rdi
jmp    11a7 <main+0x87>

LLVM IR (-O0):
@.str = [59 x i8] c"Introdueix el numero del mes que vols comprovar els dies: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [57 x i8] c"Mes incorrecte. Introdueix un n\C2\BA correcte de mes (1-12)\00"
@.str.3 = [23 x i8] c"El mes %d t\C3\A9 30 dies\0A\00"
@.str.4 = [24 x i8] c"\0AEl mes %d t\C3\A9 29 dies\0A\00"
@.str.5 = [25 x i8] c"\0AEl m\C3\A9s %d t\C3\A9 31 dies\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
br label %9
9: ; preds = %17, %2
%10 = load i32, i32* %6
%11 = icmp slt i32 %10, 1
br i1 %11, label %15, label %12
12: ; preds = %9
%13 = load i32, i32* %6
%14 = icmp sgt i32 %13, 12
br label %15
15: ; preds = %12, %9
%16 = phi i1 [ true, %9 ], [ %14, %12 ]
br i1 %16, label %17, label %20
17: ; preds = %15
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.2, i64 0, i64 0))
%19 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
br label %9
20: ; preds = %15
%21 = load i32, i32* %6
switch i32 %21, label %28 [
i32 4, label %22
i32 6, label %22
i32 9, label %22
i32 11, label %22
i32 2, label %25
]
22: ; preds = %20, %20, %20, %20
%23 = load i32, i32* %6
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i32 %23)
br label %31
25: ; preds = %20
%26 = load i32, i32* %6
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i32 %26)
br label %31
28: ; preds = %20
%29 = load i32, i32* %6
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0), i32 %29)
br label %31
31: ; preds = %28, %25, %22
%32 = load i32, i32* @EXIT_SUCCESS
ret i32 %32
}

LLVM IR (-O2):
@.str = [59 x i8] c"Introdueix el numero del mes que vols comprovar els dies: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [57 x i8] c"Mes incorrecte. Introdueix un n\C2\BA correcte de mes (1-12)\00"
@.str.3 = [23 x i8] c"El mes %d t\C3\A9 30 dies\0A\00"
@.str.4 = [24 x i8] c"\0AEl mes %d t\C3\A9 29 dies\0A\00"
@.str.5 = [25 x i8] c"\0AEl m\C3\A9s %d t\C3\A9 31 dies\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%7 = load i32, i32* %3
%8 = add i32 %7, -13
%9 = icmp ult i32 %8, -12
br i1 %9, label %10, label %16
10: ; preds = %2, %10
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @.str.2, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%13 = load i32, i32* %3
%14 = add i32 %13, -13
%15 = icmp ult i32 %14, -12
br i1 %15, label %10, label %16
16: ; preds = %10, %2
%17 = phi i32 [ %7, %2 ], [ %13, %10 ]
switch i32 %17, label %22 [
i32 4, label %18
i32 6, label %18
i32 9, label %18
i32 11, label %18
i32 2, label %20
]
18: ; preds = %16, %16, %16, %16
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i32 %17)
br label %24
20: ; preds = %16
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i32 2)
br label %24
22: ; preds = %16
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0), i32 %17)
br label %24
24: ; preds = %22, %20, %18
%25 = load i32, i32* @EXIT_SUCCESS
ret i32 %25
}