#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 */
typedef int /*<<< orphan*/ lineFich;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
char *getNombreMes(int);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
void mostrarCalendarioMes(FILE *calendar, char doctor[], int mes, char anio[]) {
  char lineFich[200];
  char nomFich[20];
  strcpy(nomFich, getNombreMes(mes));
  strcat(nomFich, anio);
  strcat(nomFich, ".txt");
  calendar = fopen(nomFich, "r");
  if (calendar == NULL) {
    printf("CALENDARIO NO ENCONTRADO.\n");
  } else {
    printf("\n\n\t******************** CALENDARIO %s DEL DOCTOR %s "
           "********************\n\n",
           getNombreMes(mes), doctor);
    while (!feof(calendar)) {
      fgets(lineFich, 200, calendar);
      printf("%s", lineFich);
      memset(lineFich, 0, sizeof(lineFich));
    }
  }
  fclose(calendar);
}


x86 assembly (clang, -O0):
<mostrarCalendarioMes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
lea    -0x110(%rbp),%rax
mov    %rax,-0x118(%rbp)
mov    -0x14(%rbp),%edi
call   1050 <getNombreMes@plt>
mov    -0x118(%rbp),%rdi
mov    %rax,%rsi
call   1030 <strcpy@plt>
lea    -0x110(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   10b0 <strcat@plt>
lea    -0x110(%rbp),%rdi
lea    0xe13(%rip),%rsi
call   10b0 <strcat@plt>
lea    -0x110(%rbp),%rdi
lea    0xe05(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1227 <mostrarCalendarioMes+0x97>
lea    0xdec(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    12a9 <mostrarCalendarioMes+0x119>
mov    -0x14(%rbp),%edi
call   1050 <getNombreMes@plt>
mov    %rax,%rsi
mov    -0x10(%rbp),%rdx
lea    0xde5(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1090 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1262 <mostrarCalendarioMes+0xd2>
jmp    12a4 <mostrarCalendarioMes+0x114>
lea    -0xf0(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    $0xc8,%esi
call   1080 <fgets@plt>
lea    -0xf0(%rbp),%rsi
lea    0xde8(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    -0xf0(%rbp),%rdi
xor    %esi,%esi
mov    $0xc8,%edx
call   1070 <memset@plt>
jmp    1244 <mostrarCalendarioMes+0xb4>
jmp    12a9 <mostrarCalendarioMes+0x119>
mov    -0x8(%rbp),%rdi
call   1040 <fclose@plt>
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mostrarCalendarioMes>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0xe8,%rsp
mov    %rcx,%rbx
mov    %edx,%r15d
mov    %rsi,%r14
mov    %edx,%edi
call   1060 <getNombreMes@plt>
mov    %rsp,%rbp
mov    %rbp,%rdi
mov    %rax,%rsi
call   1030 <strcpy@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
call   10c0 <strcat@plt>
lea    0xe23(%rip),%rsi
mov    %rbp,%rdi
call   10c0 <strcat@plt>
lea    0xe19(%rip),%rsi
mov    %rbp,%rdi
call   10b0 <fopen@plt>
mov    %rax,%rbx
test   %rax,%rax
je     126a <mostrarCalendarioMes+0xca>
mov    %r15d,%edi
call   1060 <getNombreMes@plt>
lea    0xdfc(%rip),%rdi
mov    %rax,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1070 <printf@plt>
mov    %rbx,%rdi
call   10a0 <feof@plt>
test   %eax,%eax
jne    1276 <mostrarCalendarioMes+0xd6>
lea    0x20(%rsp),%rbp
lea    0xe22(%rip),%r14
mov    %rbp,%rdi
mov    $0xc8,%esi
mov    %rbx,%rdx
call   1090 <fgets@plt>
mov    %r14,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %rbp,%rdi
xor    %esi,%esi
mov    $0xc8,%edx
call   1080 <memset@plt>
mov    %rbx,%rdi
call   10a0 <feof@plt>
test   %eax,%eax
je     1230 <mostrarCalendarioMes+0x90>
jmp    1276 <mostrarCalendarioMes+0xd6>
lea    0xde4(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1050 <fclose@plt>
add    $0xe8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c".txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [27 x i8] c"CALENDARIO NO ENCONTRADO.\0A\00"
@.str.3 = [75 x i8] c"\0A\0A\09******************** CALENDARIO %s DEL DOCTOR %s ********************\0A\0A\00"
@.str.4 = [3 x i8] c"%s\00"
define void @mostrarCalendarioMes(i32* %0, i8* %1, i32 %2, i8* %3) {
%5 = alloca i32*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8*
%9 = alloca [200 x i8]
%10 = alloca [20 x i8]
store i32* %0, i32** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
store i8* %3, i8** %8
%11 = getelementptr inbounds [20 x i8], [20 x i8]* %10, i64 0, i64 0
%12 = load i32, i32* %7
%13 = call i8* @getNombreMes(i32 %12)
%14 = call i32 @strcpy(i8* %11, i8* %13)
%15 = getelementptr inbounds [20 x i8], [20 x i8]* %10, i64 0, i64 0
%16 = load i8*, i8** %8
%17 = call i32 @strcat(i8* %15, i8* %16)
%18 = getelementptr inbounds [20 x i8], [20 x i8]* %10, i64 0, i64 0
%19 = call i32 @strcat(i8* %18, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%20 = getelementptr inbounds [20 x i8], [20 x i8]* %10, i64 0, i64 0
%21 = call i32* @fopen(i8* %20, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %21, i32** %5
%22 = load i32*, i32** %5
%23 = icmp eq i32* %22, null
br i1 %23, label %24, label %26
24: ; preds = %4
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
br label %45
26: ; preds = %4
%27 = load i32, i32* %7
%28 = call i8* @getNombreMes(i32 %27)
%29 = load i8*, i8** %6
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([75 x i8], [75 x i8]* @.str.3, i64 0, i64 0), i8* %28, i8* %29)
br label %31
31: ; preds = %36, %26
%32 = load i32*, i32** %5
%33 = call i32 @feof(i32* %32)
%34 = icmp ne i32 %33, 0
%35 = xor i1 %34, true
br i1 %35, label %36, label %44
36: ; preds = %31
%37 = getelementptr inbounds [200 x i8], [200 x i8]* %9, i64 0, i64 0
%38 = load i32*, i32** %5
%39 = call i32 @fgets(i8* %37, i32 200, i32* %38)
%40 = getelementptr inbounds [200 x i8], [200 x i8]* %9, i64 0, i64 0
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %40)
%42 = getelementptr inbounds [200 x i8], [200 x i8]* %9, i64 0, i64 0
%43 = call i32 @memset(i8* %42, i32 0, i32 200)
br label %31
44: ; preds = %31
br label %45
45: ; preds = %44, %24
%46 = load i32*, i32** %5
%47 = call i32 @fclose(i32* %46)
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c".txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.3 = [75 x i8] c"\0A\0A\09******************** CALENDARIO %s DEL DOCTOR %s ********************\0A\0A\00"
@.str.4 = [3 x i8] c"%s\00"
@str = [26 x i8] c"CALENDARIO NO ENCONTRADO.\00"
define void @mostrarCalendarioMes(i32* nocapture readnone %0, i8* %1, i32 %2, i8* %3) {
%5 = alloca [200 x i8]
%6 = alloca [20 x i8]
%7 = getelementptr inbounds [200 x i8], [200 x i8]* %5, i64 0, i64 0
%8 = getelementptr inbounds [20 x i8], [20 x i8]* %6, i64 0, i64 0
%9 = tail call i8* @getNombreMes(i32 %2)
%10 = call i32 @strcpy(i8* %8, i8* %9)
%11 = call i32 @strcat(i8* %8, i8* %3)
%12 = call i32 @strcat(i8* %8, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%13 = call i32* @fopen(i8* %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%14 = icmp eq i32* %13, null
br i1 %14, label %15, label %17
15: ; preds = %4
%16 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0))
br label %28
17: ; preds = %4
%18 = call i8* @getNombreMes(i32 %2)
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([75 x i8], [75 x i8]* @.str.3, i64 0, i64 0), i8* %18, i8* %1)
%20 = call i32 @feof(i32* %13)
%21 = icmp eq i32 %20, 0
br i1 %21, label %22, label %28
22: ; preds = %17, %22
%23 = call i32 @fgets(i8* %7, i32 200, i32* %13)
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %7)
%25 = call i32 @memset(i8* %7, i32 0, i32 200)
%26 = call i32 @feof(i32* %13)
%27 = icmp eq i32 %26, 0
br i1 %27, label %22, label %28
28: ; preds = %22, %17, %15
%29 = call i32 @fclose(i32* %13)
ret void
}