#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*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
char fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ printf(char *, char);
void impFotograma(int i) {
  if (i <= 30) {
    FILE *fptr = fopen("resources/Menu_principal.txt", "r");
    int cont = 1;
    char ch;
    while (cont < i) {
      ch = fgetc(fptr);
      while (ch != '?') {
        ch = fgetc(fptr);
      }
      cont++;
    }
    ch = fgetc(fptr);
    while (ch != '?') {
      printf("%c", ch);
      ch = fgetc(fptr);
    }
    fclose(fptr);
  }
}


x86 assembly (clang, -O0):
<impFotograma>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x1e,-0x4(%rbp)
jg     11fa <impFotograma+0xba>
lea    0xea4(%rip),%rdi
lea    0xeba(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11b7 <impFotograma+0x77>
mov    -0x10(%rbp),%rdi
call   1050 <fgetc@plt>
mov    %al,-0x15(%rbp)
movsbl -0x15(%rbp),%eax
cmp    $0x3f,%eax
je     11a9 <impFotograma+0x69>
mov    -0x10(%rbp),%rdi
call   1050 <fgetc@plt>
mov    %al,-0x15(%rbp)
jmp    118b <impFotograma+0x4b>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1173 <impFotograma+0x33>
mov    -0x10(%rbp),%rdi
call   1050 <fgetc@plt>
mov    %al,-0x15(%rbp)
movsbl -0x15(%rbp),%eax
cmp    $0x3f,%eax
je     11f1 <impFotograma+0xb1>
lea    0xe48(%rip),%rdi
movsbl -0x15(%rbp),%esi
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1050 <fgetc@plt>
mov    %al,-0x15(%rbp)
jmp    11c3 <impFotograma+0x83>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<impFotograma>:
cmp    $0x1e,%edi
jg     11c3 <impFotograma+0x83>
push   %rbp
push   %r14
push   %rbx
mov    %edi,%r14d
lea    0xead(%rip),%rdi
lea    0xec3(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,%rbx
cmp    $0x2,%r14d
jl     1184 <impFotograma+0x44>
mov    $0x1,%ebp
nopl   (%rax)
mov    %rbx,%rdi
call   1050 <fgetc@plt>
cmp    $0x3f,%al
jne    1170 <impFotograma+0x30>
add    $0x1,%ebp
cmp    %r14d,%ebp
jne    1170 <impFotograma+0x30>
mov    %rbx,%rdi
call   1050 <fgetc@plt>
cmp    $0x3f,%al
je     11b7 <impFotograma+0x77>
lea    0xe88(%rip),%rbp
nopw   0x0(%rax,%rax,1)
movsbl %al,%esi
mov    %rbp,%rdi
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1050 <fgetc@plt>
cmp    $0x3f,%al
jne    11a0 <impFotograma+0x60>
mov    %rbx,%rdi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <fclose@plt>
ret

LLVM IR (-O0):
@.str = [29 x i8] c"resources/Menu_principal.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [3 x i8] c"%c\00"
define void @impFotograma(i32 %0) {
%2 = alloca i32
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i8
store i32 %0, i32* %2
%6 = load i32, i32* %2
%7 = icmp sle i32 %6, 30
br i1 %7, label %8, label %42
8: ; preds = %1
%9 = call i32* @fopen(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %9, i32** %3
store i32 1, i32* %4
br label %10
10: ; preds = %24, %8
%11 = load i32, i32* %4
%12 = load i32, i32* %2
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %27
14: ; preds = %10
%15 = load i32*, i32** %3
%16 = call signext i8 @fgetc(i32* %15)
store i8 %16, i8* %5
br label %17
17: ; preds = %21, %14
%18 = load i8, i8* %5
%19 = sext i8 %18 to i32
%20 = icmp ne i32 %19, 63
br i1 %20, label %21, label %24
21: ; preds = %17
%22 = load i32*, i32** %3
%23 = call signext i8 @fgetc(i32* %22)
store i8 %23, i8* %5
br label %17
24: ; preds = %17
%25 = load i32, i32* %4
%26 = add nsw i32 %25, 1
store i32 %26, i32* %4
br label %10
27: ; preds = %10
%28 = load i32*, i32** %3
%29 = call signext i8 @fgetc(i32* %28)
store i8 %29, i8* %5
br label %30
30: ; preds = %34, %27
%31 = load i8, i8* %5
%32 = sext i8 %31 to i32
%33 = icmp ne i32 %32, 63
br i1 %33, label %34, label %39
34: ; preds = %30
%35 = load i8, i8* %5
%36 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8 signext %35)
%37 = load i32*, i32** %3
%38 = call signext i8 @fgetc(i32* %37)
store i8 %38, i8* %5
br label %30
39: ; preds = %30
%40 = load i32*, i32** %3
%41 = call i32 @fclose(i32* %40)
br label %42
42: ; preds = %39, %1
ret void
}

LLVM IR (-O2):
@.str = [29 x i8] c"resources/Menu_principal.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [3 x i8] c"%c\00"
define void @impFotograma(i32 %0) {
%2 = icmp slt i32 %0, 31
br i1 %2, label %3, label %26
3: ; preds = %1
%4 = tail call i32* @fopen(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%5 = icmp sgt i32 %0, 1
br i1 %5, label %6, label %16
6: ; preds = %3, %13
%7 = phi i32 [ %14, %13 ], [ 1, %3 ]
%8 = tail call signext i8 @fgetc(i32* %4)
%9 = icmp eq i8 %8, 63
br i1 %9, label %13, label %10
10: ; preds = %6, %10
%11 = tail call signext i8 @fgetc(i32* %4)
%12 = icmp eq i8 %11, 63
br i1 %12, label %13, label %10
13: ; preds = %10, %6
%14 = add nuw nsw i32 %7, 1
%15 = icmp eq i32 %14, %0
br i1 %15, label %16, label %6
16: ; preds = %13, %3
%17 = tail call signext i8 @fgetc(i32* %4)
%18 = icmp eq i8 %17, 63
br i1 %18, label %24, label %19
19: ; preds = %16, %19
%20 = phi i8 [ %22, %19 ], [ %17, %16 ]
%21 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8 signext %20)
%22 = tail call signext i8 @fgetc(i32* %4)
%23 = icmp eq i8 %22, 63
br i1 %23, label %24, label %19
24: ; preds = %19, %16
%25 = tail call i32 @fclose(i32* %4)
br label %26
26: ; preds = %24, %1
ret void
}