#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*/ fflush(int /*<<< orphan*/);
char *nombre_mes(unsigned int);
int /*<<< orphan*/ printf(char *, ...);
unsigned int scanf(char *, unsigned int *, unsigned int *, unsigned int *);
int /*<<< orphan*/ stdin;
main() {
  unsigned int dia, mes, anyo, r;
  char *m;
  printf("Introducir una fecha (dd-mm-aaaa): ");
  do {
    r = scanf("%u-%u-%u", &dia, &mes, &anyo);
    if (r != 3)
      printf("formato: dd-mm-aaaa\n");
    fflush(stdin);
  } while (r != 3);
  m = nombre_mes(mes);
  printf("\nMes: %s\n", m);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec0(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
call   1060 <scanf@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x3,-0x14(%rbp)
je     1190 <main+0x50>
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2e51(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
cmpl   $0x3,-0x14(%rbp)
jne    115d <main+0x1d>
mov    -0xc(%rbp),%edi
call   1050 <nombre_mes@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rsi
lea    0xe83(%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   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xe9b(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeb1(%rip),%rdi
lea    0x14(%rsp),%rsi
lea    0xc(%rsp),%rdx
lea    0x10(%rsp),%rcx
call   1070 <scanf@plt>
cmp    $0x3,%eax
je     11d6 <main+0x86>
lea    0xea4(%rip),%r14
mov    0x2e4e(%rip),%rbp
lea    0xe83(%rip),%r15
lea    0x14(%rsp),%r12
lea    0xc(%rsp),%r13
lea    0x10(%rsp),%rbx
mov    %r14,%rdi
call   1030 <puts@plt>
mov    0x0(%rbp),%edi
call   1050 <fflush@plt>
mov    %r15,%rdi
mov    %r12,%rsi
mov    %r13,%rdx
mov    %rbx,%rcx
call   1070 <scanf@plt>
cmp    $0x3,%eax
jne    11b0 <main+0x60>
mov    0x2e0b(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
mov    0xc(%rsp),%edi
call   1060 <nombre_mes@plt>
lea    0xe39(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [36 x i8] c"Introducir una fecha (dd-mm-aaaa): \00"
@.str.1 = [9 x i8] c"%u-%u-%u\00"
@.str.2 = [21 x i8] c"formato: dd-mm-aaaa\0A\00"
@stdin = global i32 0
@.str.3 = [10 x i8] c"\0AMes: %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
store i32 0, i32* %1
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %17, %0
%9 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %3, i32* %4)
store i32 %9, i32* %5
%10 = load i32, i32* %5
%11 = icmp ne i32 %10, 3
br i1 %11, label %12, label %14
12: ; preds = %8
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
br label %14
14: ; preds = %12, %8
%15 = load i32, i32* @stdin
%16 = call i32 @fflush(i32 %15)
br label %17
17: ; preds = %14
%18 = load i32, i32* %5
%19 = icmp ne i32 %18, 3
br i1 %19, label %8, label %20
20: ; preds = %17
%21 = load i32, i32* %3
%22 = call i8* @nombre_mes(i32 %21)
store i8* %22, i8** %6
%23 = load i8*, i8** %6
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8* %23)
%25 = load i32, i32* %1
ret i32 %25
}

LLVM IR (-O2):
@.str = [36 x i8] c"Introducir una fecha (dd-mm-aaaa): \00"
@.str.1 = [9 x i8] c"%u-%u-%u\00"
@stdin = global i32 0
@.str.3 = [10 x i8] c"\0AMes: %s\0A\00"
@str = [20 x i8] c"formato: dd-mm-aaaa\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 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2, i32* %3)
%9 = icmp eq i32 %8, 3
br i1 %9, label %16, label %10
10: ; preds = %0, %10
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
%12 = load i32, i32* @stdin
%13 = call i32 @fflush(i32 %12)
%14 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2, i32* %3)
%15 = icmp eq i32 %14, 3
br i1 %15, label %16, label %10
16: ; preds = %10, %0
%17 = load i32, i32* @stdin
%18 = call i32 @fflush(i32 %17)
%19 = load i32, i32* %2
%20 = call i8* @nombre_mes(i32 %19)
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8* %20)
ret i32 0
}