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

/* Variables and functions */
int buscarHora(int /*<<< orphan*/ *, char *, char *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
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*/ strcat(char *, char *);
void eliminarCita(FILE *c, int dia, char h[], int mes, char anio[]) {
  int pun, i;
  char cam1[11];
  char nomF[21];
  memset(nomF, 0, sizeof(nomF));
  strcat(nomF, getNombreMes(mes));
  strcat(nomF, anio);
  strcat(nomF, ".txt");
  c = fopen(nomF, "r+");
  if (c == NULL) {
    printf("CALENDARIO elmi NO ENCONTRADO.\n");
  } else {
    for (i = 1; i < 4; i++) {
      pun = buscarHora(c, h, nomF);
      modificar(c, nomF, i, cam1, pun, dia);
    }
  }
  fclose(c);
}


x86 assembly (clang, -O0):
<eliminarCita>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8,-0x28(%rbp)
lea    -0x50(%rbp),%rdi
xor    %esi,%esi
mov    $0x15,%edx
call   1070 <memset@plt>
lea    -0x50(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x1c(%rbp),%edi
call   1050 <getNombreMes@plt>
mov    -0x58(%rbp),%rdi
mov    %rax,%rsi
call   10a0 <strcat@plt>
lea    -0x50(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   10a0 <strcat@plt>
lea    -0x50(%rbp),%rdi
lea    0xe22(%rip),%rsi
call   10a0 <strcat@plt>
lea    -0x50(%rbp),%rdi
lea    0xe17(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1213 <eliminarCita+0x93>
lea    0xdff(%rip),%rdi
call   1060 <printf@plt>
jmp    1267 <eliminarCita+0xe7>
movl   $0x1,-0x30(%rbp)
cmpl   $0x4,-0x30(%rbp)
jge    1262 <eliminarCita+0xe2>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
lea    -0x50(%rbp),%rdx
call   1030 <buscarHora@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x50(%rbp),%rsi
mov    -0x30(%rbp),%edx
lea    -0x3b(%rbp),%rcx
mov    -0x2c(%rbp),%r8d
mov    -0xc(%rbp),%r9d
call   1080 <modificar@plt>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    121a <eliminarCita+0x9a>
jmp    1267 <eliminarCita+0xe7>
mov    -0x8(%rbp),%rdi
call   1040 <fclose@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<eliminarCita>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x20,%rsp
mov    %r8,%r12
mov    %ecx,%ebp
mov    %rdx,%r15
mov    %esi,%r14d
mov    %rsp,%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x15,%edx
call   1070 <memset@plt>
mov    %ebp,%edi
call   1060 <getNombreMes@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
call   10a0 <strcat@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
call   10a0 <strcat@plt>
lea    0xe33(%rip),%rsi
mov    %rbx,%rdi
call   10a0 <strcat@plt>
lea    0xe29(%rip),%rsi
mov    %rbx,%rdi
call   1090 <fopen@plt>
mov    %rax,%rbp
test   %rax,%rax
je     126b <eliminarCita+0xeb>
mov    %rsp,%rbx
mov    %rbp,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1040 <buscarHora@plt>
lea    0x15(%rsp),%r12
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    $0x1,%edx
mov    %r12,%rcx
mov    %eax,%r8d
mov    %r14d,%r9d
call   1080 <modificar@plt>
mov    %rbp,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1040 <buscarHora@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    $0x2,%edx
mov    %r12,%rcx
mov    %eax,%r8d
mov    %r14d,%r9d
call   1080 <modificar@plt>
mov    %rbp,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1040 <buscarHora@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    $0x3,%edx
mov    %r12,%rcx
mov    %eax,%r8d
mov    %r14d,%r9d
call   1080 <modificar@plt>
jmp    1277 <eliminarCita+0xf7>
lea    0xd96(%rip),%rdi
call   1030 <puts@plt>
mov    %rbp,%rdi
call   1050 <fclose@plt>
add    $0x20,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c".txt\00"
@.str.1 = [3 x i8] c"r+\00"
@.str.2 = [32 x i8] c"CALENDARIO elmi NO ENCONTRADO.\0A\00"
define void @eliminarCita(i32* %0, i32 %1, i8* %2, i32 %3, i8* %4) {
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i32
%12 = alloca i32
%13 = alloca [11 x i8]
%14 = alloca [21 x i8]
store i32* %0, i32** %6
store i32 %1, i32* %7
store i8* %2, i8** %8
store i32 %3, i32* %9
store i8* %4, i8** %10
%15 = getelementptr inbounds [21 x i8], [21 x i8]* %14, i64 0, i64 0
%16 = call i32 @memset(i8* %15, i32 0, i32 21)
%17 = getelementptr inbounds [21 x i8], [21 x i8]* %14, i64 0, i64 0
%18 = load i32, i32* %9
%19 = call i8* @getNombreMes(i32 %18)
%20 = call i32 @strcat(i8* %17, i8* %19)
%21 = getelementptr inbounds [21 x i8], [21 x i8]* %14, i64 0, i64 0
%22 = load i8*, i8** %10
%23 = call i32 @strcat(i8* %21, i8* %22)
%24 = getelementptr inbounds [21 x i8], [21 x i8]* %14, i64 0, i64 0
%25 = call i32 @strcat(i8* %24, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%26 = getelementptr inbounds [21 x i8], [21 x i8]* %14, i64 0, i64 0
%27 = call i32* @fopen(i8* %26, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %27, i32** %6
%28 = load i32*, i32** %6
%29 = icmp eq i32* %28, null
br i1 %29, label %30, label %32
30: ; preds = %5
%31 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0))
br label %52
32: ; preds = %5
store i32 1, i32* %12
br label %33
33: ; preds = %48, %32
%34 = load i32, i32* %12
%35 = icmp slt i32 %34, 4
br i1 %35, label %36, label %51
36: ; preds = %33
%37 = load i32*, i32** %6
%38 = load i8*, i8** %8
%39 = getelementptr inbounds [21 x i8], [21 x i8]* %14, i64 0, i64 0
%40 = call i32 @buscarHora(i32* %37, i8* %38, i8* %39)
store i32 %40, i32* %11
%41 = load i32*, i32** %6
%42 = getelementptr inbounds [21 x i8], [21 x i8]* %14, i64 0, i64 0
%43 = load i32, i32* %12
%44 = getelementptr inbounds [11 x i8], [11 x i8]* %13, i64 0, i64 0
%45 = load i32, i32* %11
%46 = load i32, i32* %7
%47 = call i32 @modificar(i32* %41, i8* %42, i32 %43, i8* %44, i32 %45, i32 %46)
br label %48
48: ; preds = %36
%49 = load i32, i32* %12
%50 = add nsw i32 %49, 1
store i32 %50, i32* %12
br label %33
51: ; preds = %33
br label %52
52: ; preds = %51, %30
%53 = load i32*, i32** %6
%54 = call i32 @fclose(i32* %53)
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c".txt\00"
@.str.1 = [3 x i8] c"r+\00"
@str = [31 x i8] c"CALENDARIO elmi NO ENCONTRADO.\00"
define void @eliminarCita(i32* nocapture readnone %0, i32 %1, i8* %2, i32 %3, i8* %4) {
%6 = alloca [11 x i8]
%7 = alloca [21 x i8]
%8 = getelementptr inbounds [11 x i8], [11 x i8]* %6, i64 0, i64 0
%9 = getelementptr inbounds [21 x i8], [21 x i8]* %7, i64 0, i64 0
%10 = call i32 @memset(i8* %9, i32 0, i32 21)
%11 = call i8* @getNombreMes(i32 %3)
%12 = call i32 @strcat(i8* %9, i8* %11)
%13 = call i32 @strcat(i8* %9, i8* %4)
%14 = call i32 @strcat(i8* %9, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%15 = call i32* @fopen(i8* %9, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%16 = icmp eq i32* %15, null
br i1 %16, label %24, label %17
17: ; preds = %5
%18 = call i32 @buscarHora(i32* %15, i8* %2, i8* %9)
%19 = call i32 @modificar(i32* %15, i8* %9, i32 1, i8* %8, i32 %18, i32 %1)
%20 = call i32 @buscarHora(i32* %15, i8* %2, i8* %9)
%21 = call i32 @modificar(i32* %15, i8* %9, i32 2, i8* %8, i32 %20, i32 %1)
%22 = call i32 @buscarHora(i32* %15, i8* %2, i8* %9)
%23 = call i32 @modificar(i32* %15, i8* %9, i32 3, i8* %8, i32 %22, i32 %1)
br label %26
24: ; preds = %5
%25 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str, i64 0, i64 0))
br label %26
26: ; preds = %17, %24
%27 = call i32 @fclose(i32* %15)
ret void
}