#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 *, char *);
void nbl_list_files(char *pstrBuffer, int iHeaderChunksPos) {
  int i, iNbChunks;
  iNbChunks = (*((int *)(pstrBuffer + 0x0C)));
  for (i = 0; i < iNbChunks; i++)
    printf("%s\n", pstrBuffer + iHeaderChunksPos + 0x10 + i * 0x60);
}


x86 assembly (clang, -O0):
<nbl_list_files>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    0xc(%rax),%eax
mov    %eax,-0x14(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    116e <nbl_list_files+0x5e>
mov    -0x8(%rbp),%rsi
movslq -0xc(%rbp),%rax
add    %rax,%rsi
add    $0x10,%rsi
imul   $0x60,-0x10(%rbp),%eax
cltq
add    %rax,%rsi
lea    0xea5(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1130 <nbl_list_files+0x20>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nbl_list_files>:
push   %r15
push   %r14
push   %rbx
mov    0xc(%rdi),%r15d
test   %r15d,%r15d
jle    1145 <nbl_list_files+0x35>
movslq %esi,%rax
lea    (%rdi,%rax,1),%rbx
add    $0x10,%rbx
lea    0xed0(%rip),%r14
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
add    $0x60,%rbx
add    $0xffffffffffffffff,%r15
jne    1130 <nbl_list_files+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
define void @nbl_list_files(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%7 = load i8*, i8** %3
%8 = getelementptr inbounds i8, i8* %7, i64 12
%9 = bitcast i8* %8 to i32*
%10 = load i32, i32* %9
store i32 %10, i32* %6
store i32 0, i32* %5
br label %11
11: ; preds = %26, %2
%12 = load i32, i32* %5
%13 = load i32, i32* %6
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %29
15: ; preds = %11
%16 = load i8*, i8** %3
%17 = load i32, i32* %4
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i8, i8* %16, i64 %18
%20 = getelementptr inbounds i8, i8* %19, i64 16
%21 = load i32, i32* %5
%22 = mul nsw i32 %21, 96
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i8, i8* %20, i64 %23
%25 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %24)
br label %26
26: ; preds = %15
%27 = load i32, i32* %5
%28 = add nsw i32 %27, 1
store i32 %28, i32* %5
br label %11
29: ; preds = %11
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define void @nbl_list_files(i8* %0, i32 %1) {
%3 = getelementptr inbounds i8, i8* %0, i64 12
%4 = bitcast i8* %3 to i32*
%5 = load i32, i32* %4
%6 = icmp sgt i32 %5, 0
br i1 %6, label %7, label %19
7: ; preds = %2
%8 = sext i32 %1 to i64
%9 = getelementptr inbounds i8, i8* %0, i64 %8
%10 = getelementptr inbounds i8, i8* %9, i64 16
%11 = zext i32 %5 to i64
br label %12
12: ; preds = %7, %12
%13 = phi i64 [ 0, %7 ], [ %17, %12 ]
%14 = mul nuw nsw i64 %13, 96
%15 = getelementptr inbounds i8, i8* %10, i64 %14
%16 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %15)
%17 = add nuw nsw i64 %13, 1
%18 = icmp eq i64 %17, %11
br i1 %18, label %19, label %12
19: ; preds = %12, %2
ret void
}