#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 mes;
  int diesMes[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
  do {
    printf("Introdueix un numero de mes: ");
    scanf("%d", &mes);
  } while (mes < 1 && mes > 12);
  printf("El mes %d té %d dies", mes, diesMes[mes - 1]);
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x50(%rbp),%rdi
lea    0xeaf(%rip),%rsi
mov    $0x30,%edx
call   1040 <memcpy@plt>
lea    0xece(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xede(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1050 <scanf@plt>
xor    %eax,%eax
cmpl   $0x1,-0x14(%rbp)
mov    %al,-0x51(%rbp)
jge    1192 <main+0x62>
cmpl   $0xc,-0x14(%rbp)
setg   %al
mov    %al,-0x51(%rbp)
mov    -0x51(%rbp),%al
test   $0x1,%al
jne    115b <main+0x2b>
mov    -0x14(%rbp),%esi
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
cltq
mov    -0x50(%rbp,%rax,4),%edx
lea    0xe9e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2e1f(%rip),%rax
mov    (%rax),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xf08(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf18(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
movslq 0x4(%rsp),%rsi
lea    0xeb4(%rip),%rax
mov    -0x4(%rax,%rsi,4),%edx
lea    0xefa(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x2e7b(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret

LLVM IR (-O0):
@__const.main.diesMes = [12 x i32] [i32 31, i32 28, i32 31, i32 30, i32 31, i32 30, i32 31, i32 31, i32 30, i32 31, i32 30, i32 31]
@.str = [30 x i8] c"Introdueix un numero de mes: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [22 x i8] c"El mes %d t\C3\A9 %d dies\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
%7 = alloca [12 x i32]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = bitcast [12 x i32]* %7 to i8*
br label %9
9: ; preds = %18, %2
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
br label %12
12: ; preds = %9
%13 = load i32, i32* %6
%14 = icmp slt i32 %13, 1
br i1 %14, label %15, label %18
15: ; preds = %12
%16 = load i32, i32* %6
%17 = icmp sgt i32 %16, 12
br label %18
18: ; preds = %15, %12
%19 = phi i1 [ false, %12 ], [ %17, %15 ]
br i1 %19, label %9, label %20
20: ; preds = %18
%21 = load i32, i32* %6
%22 = load i32, i32* %6
%23 = sub nsw i32 %22, 1
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [12 x i32], [12 x i32]* %7, i64 0, i64 %24
%26 = load i32, i32* %25
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 %21, i32 %26)
%28 = load i32, i32* @EXIT_SUCCESS
ret i32 %28
}

LLVM IR (-O2):
@__const.main.diesMes = [12 x i32] [i32 31, i32 28, i32 31, i32 30, i32 31, i32 30, i32 31, i32 31, i32 30, i32 31, i32 30, i32 31]
@.str = [30 x i8] c"Introdueix un numero de mes: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [22 x i8] c"El mes %d t\C3\A9 %d dies\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 ([30 x i8], [30 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 nsw i32 %7, -1
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds [12 x i32], [12 x i32]* @__const.main.diesMes, i64 0, i64 %9
%11 = load i32, i32* %10
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 %7, i32 %11)
%13 = load i32, i32* @EXIT_SUCCESS
ret i32 %13
}