#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*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ printf(char *);
int scanf(char *, char *);
muestraFichero24(FILE *ficheroAbierto) {
  char siguiente = NULL;
  char tmp[5] = "";
  int leidos = 0;
  int i;
  do {
    for (i = 0; i < 24 && tmp != NULL; ++i) {
      if (fgets(tmp, 5, ficheroAbierto) != NULL) {
        printf(tmp);
      }
    }
    printf("mostrar siguiente página(s) salir(otro): ");
    leidos = scanf("%c", &siguiente);
    getchar();
  } while (leidos > 0 && siguiente == 's');
}


x86 assembly (clang, -O0):
<muestraFichero24>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
movb   $0x0,-0x11(%rbp)
lea    -0x16(%rbp),%rdi
xor    %esi,%esi
mov    $0x5,%edx
call   1040 <memset@plt>
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
xor    %eax,%eax
cmpl   $0x18,-0x20(%rbp)
mov    %al,-0x21(%rbp)
jge    119b <muestraFichero24+0x4b>
lea    -0x16(%rbp),%rax
cmp    $0x0,%rax
setne  %al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
test   $0x1,%al
jne    11ab <muestraFichero24+0x5b>
jmp    11e3 <muestraFichero24+0x93>
lea    -0x16(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0x5,%esi
call   1050 <fgets@plt>
cmp    $0x0,%rax
je     11d0 <muestraFichero24+0x80>
lea    -0x16(%rbp),%rdi
call   1030 <printf@plt>
jmp    11d5 <muestraFichero24+0x85>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    117e <muestraFichero24+0x2e>
lea    0xe16(%rip),%rdi
call   1030 <printf@plt>
lea    0xe35(%rip),%rdi
lea    -0x11(%rbp),%rsi
call   1070 <scanf@plt>
mov    %eax,-0x1c(%rbp)
mov    $0x0,%al
call   1060 <getchar@plt>
xor    %eax,%eax
cmpl   $0x0,-0x1c(%rbp)
mov    %al,-0x22(%rbp)
jle    1225 <muestraFichero24+0xd5>
movsbl -0x11(%rbp),%eax
cmp    $0x73,%eax
sete   %al
mov    %al,-0x22(%rbp)
mov    -0x22(%rbp),%al
test   $0x1,%al
jne    1177 <muestraFichero24+0x27>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<muestraFichero24>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%rbx
movb   $0x0,0xf(%rsp)
movb   $0x0,0x14(%rsp)
movl   $0x0,0x10(%rsp)
xor    %r15d,%r15d
lea    0x10(%rsp),%r14
lea    0xeb9(%rip),%r12
lea    0xf(%rsp),%r13
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    $0x5,%esi
mov    %rbx,%rdx
call   1040 <fgets@plt>
test   %rax,%rax
je     119d <muestraFichero24+0x5d>
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0x1,%r15d
cmp    $0x18,%r15d
jne    1180 <muestraFichero24+0x40>
lea    0xe52(%rip),%rdi
call   1030 <printf@plt>
mov    %r12,%rdi
mov    %r13,%rsi
call   1060 <scanf@plt>
mov    %eax,%ebp
xor    %r15d,%r15d
xor    %eax,%eax
call   1050 <getchar@plt>
test   %ebp,%ebp
jle    11d5 <muestraFichero24+0x95>
cmpb   $0x73,0xf(%rsp)
je     1180 <muestraFichero24+0x40>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [43 x i8] c"mostrar siguiente p\C3\A1gina(s) salir(otro): \00"
@.str.1 = [3 x i8] c"%c\00"
define i32 @muestraFichero24(i32* %0) {
%2 = alloca i32
%3 = alloca i32*
%4 = alloca i8
%5 = alloca [5 x i8]
%6 = alloca i32
%7 = alloca i32
store i32* %0, i32** %3
store i8 0, i8* %4
%8 = bitcast [5 x i8]* %5 to i8*
store i32 0, i32* %6
br label %9
9: ; preds = %41, %1
store i32 0, i32* %7
br label %10
10: ; preds = %27, %9
%11 = load i32, i32* %7
%12 = icmp slt i32 %11, 24
br i1 %12, label %13, label %16
13: ; preds = %10
%14 = getelementptr inbounds [5 x i8], [5 x i8]* %5, i64 0, i64 0
%15 = icmp ne i8* %14, null
br label %16
16: ; preds = %13, %10
%17 = phi i1 [ false, %10 ], [ %15, %13 ]
br i1 %17, label %18, label %30
18: ; preds = %16
%19 = getelementptr inbounds [5 x i8], [5 x i8]* %5, i64 0, i64 0
%20 = load i32*, i32** %3
%21 = call i32* @fgets(i8* %19, i32 5, i32* %20)
%22 = icmp ne i32* %21, null
br i1 %22, label %23, label %26
23: ; preds = %18
%24 = getelementptr inbounds [5 x i8], [5 x i8]* %5, i64 0, i64 0
%25 = call i32 @printf(i8* %24)
br label %26
26: ; preds = %23, %18
br label %27
27: ; preds = %26
%28 = load i32, i32* %7
%29 = add nsw i32 %28, 1
store i32 %29, i32* %7
br label %10
30: ; preds = %16
%31 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
%32 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %4)
store i32 %32, i32* %6
%33 = call i32 (...) @getchar()
br label %34
34: ; preds = %30
%35 = load i32, i32* %6
%36 = icmp sgt i32 %35, 0
br i1 %36, label %37, label %41
37: ; preds = %34
%38 = load i8, i8* %4
%39 = sext i8 %38 to i32
%40 = icmp eq i32 %39, 115
br label %41
41: ; preds = %37, %34
%42 = phi i1 [ false, %34 ], [ %40, %37 ]
br i1 %42, label %9, label %43
43: ; preds = %41
%44 = load i32, i32* %2
ret i32 %44
}

LLVM IR (-O2):
@.str = [43 x i8] c"mostrar siguiente p\C3\A1gina(s) salir(otro): \00"
@.str.1 = [3 x i8] c"%c\00"
define i32 @muestraFichero24(i32* nocapture %0) {
%2 = alloca i8
%3 = alloca [5 x i8]
store i8 0, i8* %2
%4 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 0
br label %5
5: ; preds = %14, %1
%6 = phi i32 [ 0, %1 ], [ %15, %14 ]
%7 = call i32* @fgets(i8* %4, i32 5, i32* %0)
%8 = icmp eq i32* %7, null
br i1 %8, label %11, label %9
9: ; preds = %5
%10 = call i32 @printf(i8* %4)
br label %11
11: ; preds = %5, %9
%12 = add nuw nsw i32 %6, 1
%13 = icmp eq i32 %12, 24
br i1 %13, label %16, label %14
14: ; preds = %11, %16
%15 = phi i32 [ %12, %11 ], [ 0, %16 ]
br label %5
16: ; preds = %11
%17 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%19 = call i32 (...) @getchar()
%20 = icmp sgt i32 %18, 0
%21 = load i8, i8* %2
%22 = icmp eq i8 %21, 115
%23 = select i1 %20, i1 %22, i1 false
br i1 %23, label %14, label %24
24: ; preds = %16
ret i32 undef
}