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

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void printFileReverse(char content[][128], int *line, int charNum[]) {
  printf("\n");
  for (int i = *line - 1; i >= 0; i--) {
    for (int j = 0; j < charNum[i]; j++) {
      printf("%c", content[i][j]);
    }
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<printFileReverse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    0xed5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
sub    $0x1,%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jl     11b2 <printFileReverse+0xa2>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    -0x18(%rbp),%rcx
movslq -0x1c(%rbp),%rdx
cmp    (%rcx,%rdx,4),%eax
jge    1196 <printFileReverse+0x86>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
shl    $0x7,%rcx
add    %rcx,%rax
movslq -0x20(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
lea    0xe81(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    114f <printFileReverse+0x3f>
lea    0xe63(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x1c(%rbp)
jmp    113e <printFileReverse+0x2e>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printFileReverse>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rdx,%r12
mov    %rsi,%r15
mov    %rdi,%r14
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    (%r15),%r15d
test   %r15d,%r15d
jle    1199 <printFileReverse+0x89>
mov    %r15,%rax
shl    $0x7,%rax
add    %rax,%r14
add    $0xffffffffffffff80,%r14
jmp    1167 <printFileReverse+0x57>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0xffffffffffffff80,%r14
cmp    $0x1,%r15
mov    %r13,%r15
jle    1199 <printFileReverse+0x89>
lea    -0x1(%r15),%r13
cmpl   $0x0,-0x4(%r12,%r15,4)
jle    1150 <printFileReverse+0x40>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
movsbl (%r14,%rbx,1),%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
movslq (%r12,%r13,4),%rax
cmp    %rax,%rbx
jl     1180 <printFileReverse+0x70>
jmp    1150 <printFileReverse+0x40>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @printFileReverse([128 x i8]* nocapture %0, i32* nocapture %1, i32* nocapture %2) {
%4 = tail call i32 @putchar(i32 10)
%5 = load i32, i32* %1
%6 = icmp sgt i32 %5, 0
br i1 %6, label %7, label %15
7: ; preds = %3
%8 = zext i32 %5 to i64
br label %9
9: ; preds = %7, %16
%10 = phi i64 [ %8, %7 ], [ %11, %16 ]
%11 = add nsw i64 %10, -1
%12 = getelementptr inbounds i32, i32* %2, i64 %11
%13 = load i32, i32* %12
%14 = icmp sgt i32 %13, 0
br i1 %14, label %19, label %16
15: ; preds = %16, %3
ret void
16: ; preds = %19, %9
%17 = tail call i32 @putchar(i32 10)
%18 = icmp sgt i64 %10, 1
br i1 %18, label %9, label %15
19: ; preds = %9, %19
%20 = phi i64 [ %25, %19 ], [ 0, %9 ]
%21 = getelementptr inbounds [128 x i8], [128 x i8]* %0, i64 %11, i64 %20
%22 = load i8, i8* %21
%23 = sext i8 %22 to i32
%24 = tail call i32 @putchar(i32 %23)
%25 = add nuw nsw i64 %20, 1
%26 = load i32, i32* %12
%27 = sext i32 %26 to i64
%28 = icmp slt i64 %25, %27
br i1 %28, label %19, label %16
}