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

/* Variables and functions */
int buscarHora(int /*<<< orphan*/ *, char *, char *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
scalar_t__ formatoDNI(char *);
int /*<<< orphan*/ formatoHora(char *);
int getDiasMes(int, int);
char *getNombreMes(int);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ modificar(int /*<<< orphan*/ *, char *, int, char *, int,
                             int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, ...);
int /*<<< orphan*/ sprintf(char *, char *, int);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ system(char *);
void modificarCalendario(FILE *ca, int mes, int anio) {
  int correcto = 0, cancel = 0, dia, puntero;
  char ani[4], nomFichero[20], hora[5], camp[10];
  memset(nomFichero, 0, sizeof(nomFichero));
  sprintf(ani, "%d", anio);
  strcat(nomFichero, getNombreMes(mes));
  strcat(nomFichero, ani);
  strcat(nomFichero, ".txt");
  ca = fopen(nomFichero, "r+");
  if (ca == NULL) {
    printf("CALENDARIO NO ENCONTRADO.\n");
  } else {
    do {
      correcto = 0;
      printf("\nIntroduzca el dia: ");
      scanf("%d", &dia);
      if (dia > 0 && dia <= getDiasMes(mes, anio)) {
        correcto++;
        printf("\nIntroduzca la hora (ej: 09:30): ");
        scanf("%s", hora);
        if (!formatoHora(hora)) {
          printf("\n** FORMATO HORA INCORRECTO! **\n");
        } else
          correcto++;
      } else {
        printf("\n\t** Dia NO VALIDO! **\n");
      }
      if (correcto == 2) {
        puntero = buscarHora(ca, hora, nomFichero);
        if (puntero != 0) {
          printf("\nIntroduzca los siguientes datos: \n");
          printf("\n\tEspecialidad: ");
          scanf("%s", camp);
          modificar(ca, nomFichero, 1, camp, puntero, dia);
          printf("\n\tPrimer nombre del paciente: ");
          scanf("%s", camp);
          modificar(ca, nomFichero, 2, camp, puntero, dia);
          printf("\n\tDNI: ");
          scanf("%s", camp);
          if (formatoDNI(camp))
            modificar(ca, nomFichero, 3, camp, puntero, dia);
          else {
            printf("\n\t** DNI NO VALIDO **");
          }
        } else {
          printf("\n\t** NO EXISTEN CITAS PARA ESA HORA **\n");
        }
        printf("\nSeguir(1=si 0=no): ");
        scanf("%d", &cancel);
      } else {
        printf("\nPara volver a intentarlo PULSE 1: ");
        scanf("%d", &cancel);
        system("cls");
      }
    } while (cancel == 1);
  }
  fclose(ca);
}


x86 assembly (clang, -O0):
<modificarCalendario>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x14,%edx
call   1090 <memset@plt>
lea    -0x24(%rbp),%rdi
mov    -0x10(%rbp),%edx
lea    0xde2(%rip),%rsi
call   10e0 <sprintf@plt>
lea    -0x40(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0xc(%rbp),%edi
call   1060 <getNombreMes@plt>
mov    -0x58(%rbp),%rdi
mov    %rax,%rsi
call   10d0 <strcat@plt>
lea    -0x40(%rbp),%rdi
lea    -0x24(%rbp),%rsi
call   10d0 <strcat@plt>
lea    -0x40(%rbp),%rdi
lea    0xdac(%rip),%rsi
call   10d0 <strcat@plt>
lea    -0x40(%rbp),%rdi
lea    0xda1(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    128c <modificarCalendario+0xac>
lea    0xd89(%rip),%rdi
call   1080 <printf@plt>
jmp    14c0 <modificarCalendario+0x2e0>
jmp    1291 <modificarCalendario+0xb1>
movl   $0x0,-0x14(%rbp)
lea    0xd87(%rip),%rdi
call   1080 <printf@plt>
lea    0xd55(%rip),%rdi
lea    -0x1c(%rbp),%rsi
mov    $0x0,%al
call   10a0 <scanf@plt>
cmpl   $0x0,-0x1c(%rbp)
jle    1336 <modificarCalendario+0x156>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x5c(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1100 <getDiasMes@plt>
mov    %eax,%ecx
mov    -0x5c(%rbp),%eax
cmp    %ecx,%eax
jg     1336 <modificarCalendario+0x156>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
lea    0xd4d(%rip),%rdi
call   1080 <printf@plt>
lea    -0x45(%rbp),%rsi
lea    0xd5f(%rip),%rdi
mov    $0x0,%al
call   10a0 <scanf@plt>
lea    -0x45(%rbp),%rdi
call   10f0 <formatoHora@plt>
cmp    $0x0,%eax
jne    1328 <modificarCalendario+0x148>
lea    0xd42(%rip),%rdi
call   1080 <printf@plt>
jmp    1331 <modificarCalendario+0x151>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1342 <modificarCalendario+0x162>
lea    0xd44(%rip),%rdi
call   1080 <printf@plt>
cmpl   $0x2,-0x14(%rbp)
jne    1482 <modificarCalendario+0x2a2>
mov    -0x8(%rbp),%rdi
lea    -0x45(%rbp),%rsi
lea    -0x40(%rbp),%rdx
call   1030 <buscarHora@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
je     1453 <modificarCalendario+0x273>
lea    0xd28(%rip),%rdi
call   1080 <printf@plt>
lea    0xd40(%rip),%rdi
call   1080 <printf@plt>
lea    -0x4f(%rbp),%rsi
lea    0xcd0(%rip),%rdi
mov    $0x0,%al
call   10a0 <scanf@plt>
mov    -0x8(%rbp),%rdi
lea    -0x40(%rbp),%rsi
lea    -0x4f(%rbp),%rcx
mov    -0x20(%rbp),%r8d
mov    -0x1c(%rbp),%r9d
mov    $0x1,%edx
call   10b0 <modificar@plt>
lea    0xd15(%rip),%rdi
call   1080 <printf@plt>
lea    -0x4f(%rbp),%rsi
lea    0xc94(%rip),%rdi
mov    $0x0,%al
call   10a0 <scanf@plt>
mov    -0x8(%rbp),%rdi
lea    -0x40(%rbp),%rsi
lea    -0x4f(%rbp),%rcx
mov    -0x20(%rbp),%r8d
mov    -0x1c(%rbp),%r9d
mov    $0x2,%edx
call   10b0 <modificar@plt>
lea    0xcf8(%rip),%rdi
call   1080 <printf@plt>
lea    -0x4f(%rbp),%rsi
lea    0xc58(%rip),%rdi
mov    $0x0,%al
call   10a0 <scanf@plt>
lea    -0x4f(%rbp),%rdi
call   1050 <formatoDNI@plt>
cmp    $0x0,%rax
je     1442 <modificarCalendario+0x262>
mov    -0x8(%rbp),%rdi
lea    -0x40(%rbp),%rsi
lea    -0x4f(%rbp),%rcx
mov    -0x20(%rbp),%r8d
mov    -0x1c(%rbp),%r9d
mov    $0x3,%edx
call   10b0 <modificar@plt>
jmp    144e <modificarCalendario+0x26e>
lea    0xcac(%rip),%rdi
call   1080 <printf@plt>
jmp    145f <modificarCalendario+0x27f>
lea    0xcb1(%rip),%rdi
call   1080 <printf@plt>
lea    0xccd(%rip),%rdi
call   1080 <printf@plt>
lea    0xb8e(%rip),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x0,%al
call   10a0 <scanf@plt>
jmp    14ac <modificarCalendario+0x2cc>
lea    0xcbf(%rip),%rdi
call   1080 <printf@plt>
lea    0xb6b(%rip),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x0,%al
call   10a0 <scanf@plt>
lea    0xcc5(%rip),%rdi
call   1070 <system@plt>
jmp    14b1 <modificarCalendario+0x2d1>
cmpl   $0x1,-0x18(%rbp)
je     1291 <modificarCalendario+0xb1>
jmp    14c0 <modificarCalendario+0x2e0>
mov    -0x8(%rbp),%rdi
call   1040 <fclose@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<modificarCalendario>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %edx,%r13d
mov    %esi,%ebp
movl   $0x0,0x10(%rsp)
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x14,%edx
call   10a0 <memset@plt>
lea    0xdda(%rip),%rsi
lea    0x1c(%rsp),%r14
mov    %r14,%rdi
mov    %r13d,%edx
call   10f0 <sprintf@plt>
mov    %ebp,%edi
call   1070 <getNombreMes@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
call   10e0 <strcat@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   10e0 <strcat@plt>
lea    0xda9(%rip),%rsi
mov    %rbx,%rdi
call   10e0 <strcat@plt>
lea    0xd9f(%rip),%rsi
mov    %rbx,%rdi
call   10d0 <fopen@plt>
mov    %rax,%r14
test   %rax,%rax
je     148f <modificarCalendario+0x29f>
lea    0xd7c(%rip),%r12
lea    0xe45(%rip),%r15
mov    %ebp,0xc(%rsp)
mov    %r13d,0x8(%rsp)
jmp    12d7 <modificarCalendario+0xe7>
cs nopw 0x0(%rax,%rax,1)
call   1030 <puts@plt>
lea    0xdfc(%rip),%rdi
call   1090 <printf@plt>
mov    %r12,%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   10b0 <scanf@plt>
lea    0xe05(%rip),%rdi
call   1080 <system@plt>
cmpl   $0x1,0x10(%rsp)
jne    149b <modificarCalendario+0x2ab>
lea    0xd2d(%rip),%rdi
call   1090 <printf@plt>
mov    %r12,%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   10b0 <scanf@plt>
mov    0x4(%rsp),%ebx
mov    %r15,%rdi
test   %ebx,%ebx
jle    12a0 <modificarCalendario+0xb0>
mov    %ebp,%edi
mov    %r13d,%esi
call   1110 <getDiasMes@plt>
mov    %r15,%rdi
cmp    %eax,%ebx
jg     12a0 <modificarCalendario+0xb0>
lea    0xd0b(%rip),%rdi
call   1090 <printf@plt>
lea    0xd21(%rip),%rdi
lea    0x17(%rsp),%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   10b0 <scanf@plt>
mov    %rbx,%rdi
call   1100 <formatoHora@plt>
lea    0xdf2(%rip),%rdi
test   %eax,%eax
je     12a0 <modificarCalendario+0xb0>
mov    %r14,%rdi
lea    0x17(%rsp),%rsi
lea    0x20(%rsp),%rdx
call   1040 <buscarHora@plt>
test   %eax,%eax
je     1431 <modificarCalendario+0x241>
mov    %eax,%r13d
lea    0xda3(%rip),%rdi
call   1030 <puts@plt>
lea    0xcce(%rip),%rdi
call   1090 <printf@plt>
mov    %r14,%rbx
lea    0xcbc(%rip),%r14
mov    %r14,%rdi
lea    0x3e(%rsp),%rbp
mov    %rbp,%rsi
xor    %eax,%eax
call   10b0 <scanf@plt>
mov    0x4(%rsp),%r9d
mov    %rbx,%rdi
lea    0x20(%rsp),%r15
mov    %r15,%rsi
mov    $0x1,%edx
mov    %rbp,%rcx
mov    %r13d,%r8d
call   10c0 <modificar@plt>
lea    0xc97(%rip),%rdi
call   1090 <printf@plt>
mov    %r14,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   10b0 <scanf@plt>
mov    0x4(%rsp),%r9d
mov    %rbx,%rdi
mov    %r15,%rsi
mov    $0x2,%edx
mov    %rbp,%rcx
mov    %r13d,%r8d
call   10c0 <modificar@plt>
lea    0xc82(%rip),%rdi
call   1090 <printf@plt>
mov    %r14,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   10b0 <scanf@plt>
mov    %rbp,%rdi
call   1060 <formatoDNI@plt>
test   %rax,%rax
je     1448 <modificarCalendario+0x258>
mov    0x4(%rsp),%r9d
mov    %rbx,%rdi
lea    0x20(%rsp),%rsi
mov    $0x3,%edx
mov    %rbp,%rcx
mov    %r13d,%r8d
call   10c0 <modificar@plt>
jmp    1454 <modificarCalendario+0x264>
lea    0xcaf(%rip),%rdi
call   1030 <puts@plt>
mov    0x8(%rsp),%r13d
mov    0xc(%rsp),%ebp
jmp    1467 <modificarCalendario+0x277>
lea    0xc2e(%rip),%rdi
call   1090 <printf@plt>
mov    0x8(%rsp),%r13d
mov    0xc(%rsp),%ebp
mov    %rbx,%r14
lea    0xc69(%rip),%r15
lea    0xc25(%rip),%rdi
call   1090 <printf@plt>
mov    %r12,%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   10b0 <scanf@plt>
cmpl   $0x1,0x10(%rsp)
je     12d7 <modificarCalendario+0xe7>
jmp    149b <modificarCalendario+0x2ab>
lea    0xcbb(%rip),%rdi
call   1030 <puts@plt>
mov    %r14,%rdi
call   1050 <fclose@plt>
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [5 x i8] c".txt\00"
@.str.2 = [3 x i8] c"r+\00"
@.str.3 = [27 x i8] c"CALENDARIO NO ENCONTRADO.\0A\00"
@.str.4 = [21 x i8] c"\0AIntroduzca el dia: \00"
@.str.5 = [34 x i8] c"\0AIntroduzca la hora (ej: 09:30): \00"
@.str.6 = [3 x i8] c"%s\00"
@.str.7 = [33 x i8] c"\0A** FORMATO HORA INCORRECTO! **\0A\00"
@.str.8 = [24 x i8] c"\0A\09** Dia NO VALIDO! **\0A\00"
@.str.9 = [36 x i8] c"\0AIntroduzca los siguientes datos: \0A\00"
@.str.10 = [17 x i8] c"\0A\09Especialidad: \00"
@.str.11 = [31 x i8] c"\0A\09Primer nombre del paciente: \00"
@.str.12 = [8 x i8] c"\0A\09DNI: \00"
@.str.13 = [22 x i8] c"\0A\09** DNI NO VALIDO **\00"
@.str.14 = [40 x i8] c"\0A\09** NO EXISTEN CITAS PARA ESA HORA **\0A\00"
@.str.15 = [21 x i8] c"\0ASeguir(1=si 0=no): \00"
@.str.16 = [36 x i8] c"\0APara volver a intentarlo PULSE 1: \00"
@.str.17 = [4 x i8] c"cls\00"
define void @modificarCalendario(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca [4 x i8]
%12 = alloca [20 x i8]
%13 = alloca [5 x i8]
%14 = alloca [10 x i8]
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
store i32 0, i32* %7
store i32 0, i32* %8
%15 = getelementptr inbounds [20 x i8], [20 x i8]* %12, i64 0, i64 0
%16 = call i32 @memset(i8* %15, i32 0, i32 20)
%17 = getelementptr inbounds [4 x i8], [4 x i8]* %11, i64 0, i64 0
%18 = load i32, i32* %6
%19 = call i32 @sprintf(i8* %17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %18)
%20 = getelementptr inbounds [20 x i8], [20 x i8]* %12, i64 0, i64 0
%21 = load i32, i32* %5
%22 = call i8* @getNombreMes(i32 %21)
%23 = call i32 @strcat(i8* %20, i8* %22)
%24 = getelementptr inbounds [20 x i8], [20 x i8]* %12, i64 0, i64 0
%25 = getelementptr inbounds [4 x i8], [4 x i8]* %11, i64 0, i64 0
%26 = call i32 @strcat(i8* %24, i8* %25)
%27 = getelementptr inbounds [20 x i8], [20 x i8]* %12, i64 0, i64 0
%28 = call i32 @strcat(i8* %27, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%29 = getelementptr inbounds [20 x i8], [20 x i8]* %12, i64 0, i64 0
%30 = call i32* @fopen(i8* %29, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
store i32* %30, i32** %4
%31 = load i32*, i32** %4
%32 = icmp eq i32* %31, null
br i1 %32, label %33, label %35
33: ; preds = %3
%34 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0))
br label %124
35: ; preds = %3
br label %36
36: ; preds = %120, %35
store i32 0, i32* %7
%37 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
%38 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %9)
%39 = load i32, i32* %9
%40 = icmp sgt i32 %39, 0
br i1 %40, label %41, label %62
41: ; preds = %36
%42 = load i32, i32* %9
%43 = load i32, i32* %5
%44 = load i32, i32* %6
%45 = call i32 @getDiasMes(i32 %43, i32 %44)
%46 = icmp sle i32 %42, %45
br i1 %46, label %47, label %62
47: ; preds = %41
%48 = load i32, i32* %7
%49 = add nsw i32 %48, 1
store i32 %49, i32* %7
%50 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.5, i64 0, i64 0))
%51 = getelementptr inbounds [5 x i8], [5 x i8]* %13, i64 0, i64 0
%52 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8* %51)
%53 = getelementptr inbounds [5 x i8], [5 x i8]* %13, i64 0, i64 0
%54 = call i32 @formatoHora(i8* %53)
%55 = icmp ne i32 %54, 0
br i1 %55, label %58, label %56
56: ; preds = %47
%57 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.7, i64 0, i64 0))
br label %61
58: ; preds = %47
%59 = load i32, i32* %7
%60 = add nsw i32 %59, 1
store i32 %60, i32* %7
br label %61
61: ; preds = %58, %56
br label %64
62: ; preds = %41, %36
%63 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.8, i64 0, i64 0))
br label %64
64: ; preds = %62, %61
%65 = load i32, i32* %7
%66 = icmp eq i32 %65, 2
br i1 %66, label %67, label %115
67: ; preds = %64
%68 = load i32*, i32** %4
%69 = getelementptr inbounds [5 x i8], [5 x i8]* %13, i64 0, i64 0
%70 = getelementptr inbounds [20 x i8], [20 x i8]* %12, i64 0, i64 0
%71 = call i32 @buscarHora(i32* %68, i8* %69, i8* %70)
store i32 %71, i32* %10
%72 = load i32, i32* %10
%73 = icmp ne i32 %72, 0
br i1 %73, label %74, label %110
74: ; preds = %67
%75 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.9, i64 0, i64 0))
%76 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.10, i64 0, i64 0))
%77 = getelementptr inbounds [10 x i8], [10 x i8]* %14, i64 0, i64 0
%78 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8* %77)
%79 = load i32*, i32** %4
%80 = getelementptr inbounds [20 x i8], [20 x i8]* %12, i64 0, i64 0
%81 = getelementptr inbounds [10 x i8], [10 x i8]* %14, i64 0, i64 0
%82 = load i32, i32* %10
%83 = load i32, i32* %9
%84 = call i32 @modificar(i32* %79, i8* %80, i32 1, i8* %81, i32 %82, i32 %83)
%85 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.11, i64 0, i64 0))
%86 = getelementptr inbounds [10 x i8], [10 x i8]* %14, i64 0, i64 0
%87 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8* %86)
%88 = load i32*, i32** %4
%89 = getelementptr inbounds [20 x i8], [20 x i8]* %12, i64 0, i64 0
%90 = getelementptr inbounds [10 x i8], [10 x i8]* %14, i64 0, i64 0
%91 = load i32, i32* %10
%92 = load i32, i32* %9
%93 = call i32 @modificar(i32* %88, i8* %89, i32 2, i8* %90, i32 %91, i32 %92)
%94 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.12, i64 0, i64 0))
%95 = getelementptr inbounds [10 x i8], [10 x i8]* %14, i64 0, i64 0
%96 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8* %95)
%97 = getelementptr inbounds [10 x i8], [10 x i8]* %14, i64 0, i64 0
%98 = call i64 @formatoDNI(i8* %97)
%99 = icmp ne i64 %98, 0
br i1 %99, label %100, label %107
100: ; preds = %74
%101 = load i32*, i32** %4
%102 = getelementptr inbounds [20 x i8], [20 x i8]* %12, i64 0, i64 0
%103 = getelementptr inbounds [10 x i8], [10 x i8]* %14, i64 0, i64 0
%104 = load i32, i32* %10
%105 = load i32, i32* %9
%106 = call i32 @modificar(i32* %101, i8* %102, i32 3, i8* %103, i32 %104, i32 %105)
br label %109
107: ; preds = %74
%108 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.13, i64 0, i64 0))
br label %109
109: ; preds = %107, %100
br label %112
110: ; preds = %67
%111 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.14, i64 0, i64 0))
br label %112
112: ; preds = %110, %109
%113 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.15, i64 0, i64 0))
%114 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %8)
br label %119
115: ; preds = %64
%116 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.16, i64 0, i64 0))
%117 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %8)
%118 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.17, i64 0, i64 0))
br label %119
119: ; preds = %115, %112
br label %120
120: ; preds = %119
%121 = load i32, i32* %8
%122 = icmp eq i32 %121, 1
br i1 %122, label %36, label %123
123: ; preds = %120
br label %124
124: ; preds = %123, %33
%125 = load i32*, i32** %4
%126 = call i32 @fclose(i32* %125)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [5 x i8] c".txt\00"
@.str.2 = [3 x i8] c"r+\00"
@.str.4 = [21 x i8] c"\0AIntroduzca el dia: \00"
@.str.5 = [34 x i8] c"\0AIntroduzca la hora (ej: 09:30): \00"
@.str.6 = [3 x i8] c"%s\00"
@.str.10 = [17 x i8] c"\0A\09Especialidad: \00"
@.str.11 = [31 x i8] c"\0A\09Primer nombre del paciente: \00"
@.str.12 = [8 x i8] c"\0A\09DNI: \00"
@.str.13 = [22 x i8] c"\0A\09** DNI NO VALIDO **\00"
@.str.15 = [21 x i8] c"\0ASeguir(1=si 0=no): \00"
@.str.16 = [36 x i8] c"\0APara volver a intentarlo PULSE 1: \00"
@.str.17 = [4 x i8] c"cls\00"
@str = [23 x i8] c"\0A\09** Dia NO VALIDO! **\00"
@str.18 = [39 x i8] c"\0A\09** NO EXISTEN CITAS PARA ESA HORA **\00"
@str.19 = [35 x i8] c"\0AIntroduzca los siguientes datos: \00"
@str.20 = [32 x i8] c"\0A** FORMATO HORA INCORRECTO! **\00"
@str.21 = [26 x i8] c"CALENDARIO NO ENCONTRADO.\00"
define void @modificarCalendario(i32* nocapture readnone %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca [4 x i8]
%7 = alloca [20 x i8]
%8 = alloca [5 x i8]
%9 = alloca [10 x i8]
%10 = bitcast i32* %4 to i8*
store i32 0, i32* %4
%11 = bitcast i32* %5 to i8*
%12 = getelementptr inbounds [4 x i8], [4 x i8]* %6, i64 0, i64 0
%13 = getelementptr inbounds [20 x i8], [20 x i8]* %7, i64 0, i64 0
%14 = getelementptr inbounds [5 x i8], [5 x i8]* %8, i64 0, i64 0
%15 = getelementptr inbounds [10 x i8], [10 x i8]* %9, i64 0, i64 0
%16 = call i32 @memset(i8* %13, i32 0, i32 20)
%17 = call i32 @sprintf(i8* %12, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %2)
%18 = call i8* @getNombreMes(i32 %1)
%19 = call i32 @strcat(i8* %13, i8* %18)
%20 = call i32 @strcat(i8* %13, i8* %12)
%21 = call i32 @strcat(i8* %13, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%22 = call i32* @fopen(i8* %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%23 = icmp eq i32* %22, null
br i1 %23, label %24, label %26
24: ; preds = %3
%25 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.21, i64 0, i64 0))
br label %75
26: ; preds = %3, %72
%27 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
%28 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %5)
%29 = load i32, i32* %5
%30 = icmp sgt i32 %29, 0
br i1 %30, label %31, label %66
31: ; preds = %26
%32 = call i32 @getDiasMes(i32 %1, i32 %2)
%33 = icmp sgt i32 %29, %32
br i1 %33, label %66, label %34
34: ; preds = %31
%35 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.5, i64 0, i64 0))
%36 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8* %14)
%37 = call i32 @formatoHora(i8* %14)
%38 = icmp eq i32 %37, 0
br i1 %38, label %66, label %39
39: ; preds = %34
%40 = call i32 @buscarHora(i32* %22, i8* %14, i8* %13)
%41 = icmp eq i32 %40, 0
br i1 %41, label %61, label %42
42: ; preds = %39
%43 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str.19, i64 0, i64 0))
%44 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.10, i64 0, i64 0))
%45 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8* %15)
%46 = load i32, i32* %5
%47 = call i32 @modificar(i32* %22, i8* %13, i32 1, i8* %15, i32 %40, i32 %46)
%48 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.11, i64 0, i64 0))
%49 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8* %15)
%50 = load i32, i32* %5
%51 = call i32 @modificar(i32* %22, i8* %13, i32 2, i8* %15, i32 %40, i32 %50)
%52 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.12, i64 0, i64 0))
%53 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8* %15)
%54 = call i64 @formatoDNI(i8* %15)
%55 = icmp eq i64 %54, 0
br i1 %55, label %59, label %56
56: ; preds = %42
%57 = load i32, i32* %5
%58 = call i32 @modificar(i32* %22, i8* %13, i32 3, i8* %15, i32 %40, i32 %57)
br label %63
59: ; preds = %42
%60 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.13, i64 0, i64 0))
br label %63
61: ; preds = %39
%62 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.18, i64 0, i64 0))
br label %63
63: ; preds = %56, %59, %61
%64 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.15, i64 0, i64 0))
%65 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
br label %72
66: ; preds = %26, %31, %34
%67 = phi i8* [ getelementptr inbounds ([32 x i8], [32 x i8]* @str.20, i64 0, i64 0), %34 ], [ getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0), %31 ], [ getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0), %26 ]
%68 = call i32 @puts(i8* dereferenceable(1) %67)
%69 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.16, i64 0, i64 0))
%70 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
%71 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.17, i64 0, i64 0))
br label %72
72: ; preds = %63, %66
%73 = load i32, i32* %4
%74 = icmp eq i32 %73, 1
br i1 %74, label %26, label %75
75: ; preds = %72, %24
%76 = call i32 @fclose(i32* %22)
ret void
}