#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*/ fp_printf(int /*<<< orphan*/ *, char *, ...);
void print_file_buffer(FILE *fp, char *buffer) {
  int i, l;
  for (i = 0, l = 0; i < 512; i++, l++) {
    if (l == 0)
      fp_printf(fp, "0x%03X:", i);
    fp_printf(fp, " %02X", (unsigned char)buffer[i]);
    if (l == 16 - 1) {
      fp_printf(fp, "\n");
      l = -1;
    }
  }
  if (l > 0)
    fp_printf(fp, "\n");
  fp_printf(fp, "\n");
}


x86 assembly (clang, -O0):
<print_file_buffer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
cmpl   $0x200,-0x14(%rbp)
jge    11b7 <print_file_buffer+0xa7>
cmpl   $0x0,-0x18(%rbp)
jne    115a <print_file_buffer+0x4a>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%edx
lea    0xead(%rip),%rsi
mov    $0x0,%al
call   1030 <fp_printf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movzbl (%rax,%rcx,1),%edx
lea    0xe97(%rip),%rsi
mov    $0x0,%al
call   1030 <fp_printf@plt>
cmpl   $0xf,-0x18(%rbp)
jne    119b <print_file_buffer+0x8b>
mov    -0x8(%rbp),%rdi
lea    0xe81(%rip),%rsi
mov    $0x0,%al
call   1030 <fp_printf@plt>
movl   $0xffffffff,-0x18(%rbp)
jmp    11a0 <print_file_buffer+0x90>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    112e <print_file_buffer+0x1e>
cmpl   $0x0,-0x18(%rbp)
jle    11d3 <print_file_buffer+0xc3>
mov    -0x8(%rbp),%rdi
lea    0xe42(%rip),%rsi
mov    $0x0,%al
call   1030 <fp_printf@plt>
mov    -0x8(%rbp),%rdi
lea    0xe30(%rip),%rsi
mov    $0x0,%al
call   1030 <fp_printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_file_buffer>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xee0(%rip),%r12
xor    %ebp,%ebp
xor    %r15d,%r15d
jmp    1166 <print_file_buffer+0x56>
nop
mov    %rbx,%rdi
lea    0xec6(%rip),%rsi
mov    %ebp,%edx
xor    %eax,%eax
call   1030 <fp_printf@plt>
movzbl (%r14,%rbp,1),%edx
mov    %rbx,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1030 <fp_printf@plt>
add    $0x1,%rbp
lea    0x1(%r13),%r15d
cmp    $0x200,%rbp
je     11a9 <print_file_buffer+0x99>
mov    %r15d,%r13d
test   %r15d,%r15d
je     1130 <print_file_buffer+0x20>
movzbl (%r14,%rbp,1),%edx
mov    %rbx,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1030 <fp_printf@plt>
cmp    $0xf,%r13d
jne    1155 <print_file_buffer+0x45>
xor    %r15d,%r15d
mov    %rbx,%rdi
lea    0xe7b(%rip),%rsi
xor    %eax,%eax
call   1030 <fp_printf@plt>
add    $0x1,%rbp
cmp    $0x200,%rbp
jne    1166 <print_file_buffer+0x56>
jmp    11bf <print_file_buffer+0xaf>
test   %r13d,%r13d
js     11bf <print_file_buffer+0xaf>
lea    0xe59(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <fp_printf@plt>
lea    0xe48(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <fp_printf@plt>

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

LLVM IR (-O2):
@.str = [8 x i8] c"0x%03X:\00"
@.str.1 = [6 x i8] c" %02X\00"
@.str.2 = [2 x i8] c"\0A\00"
define void @print_file_buffer(i32* %0, i8* nocapture %1) {
br label %3
3: ; preds = %24, %2
%4 = phi i64 [ 0, %2 ], [ %25, %24 ]
%5 = phi i32 [ 0, %2 ], [ %26, %24 ]
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %14
7: ; preds = %3
%8 = trunc i64 %4 to i32
%9 = tail call i32 (i32*, i8*, ...) @fp_printf(i32* %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = getelementptr inbounds i8, i8* %1, i64 %4
%11 = load i8, i8* %10
%12 = zext i8 %11 to i32
%13 = tail call i32 (i32*, i8*, ...) @fp_printf(i32* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %12)
br label %20
14: ; preds = %3
%15 = getelementptr inbounds i8, i8* %1, i64 %4
%16 = load i8, i8* %15
%17 = zext i8 %16 to i32
%18 = tail call i32 (i32*, i8*, ...) @fp_printf(i32* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %17)
%19 = icmp eq i32 %5, 15
br i1 %19, label %27, label %20
20: ; preds = %7, %14
%21 = add nuw nsw i64 %4, 1
%22 = add nsw i32 %5, 1
%23 = icmp eq i64 %21, 512
br i1 %23, label %31, label %24
24: ; preds = %20, %27
%25 = phi i64 [ %21, %20 ], [ %29, %27 ]
%26 = phi i32 [ %22, %20 ], [ 0, %27 ]
br label %3
27: ; preds = %14
%28 = tail call i32 (i32*, i8*, ...) @fp_printf(i32* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%29 = add nuw nsw i64 %4, 1
%30 = icmp eq i64 %29, 512
br i1 %30, label %35, label %24
31: ; preds = %20
%32 = icmp sgt i32 %5, -1
br i1 %32, label %33, label %35
33: ; preds = %31
%34 = tail call i32 (i32*, i8*, ...) @fp_printf(i32* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %35
35: ; preds = %27, %33, %31
%36 = tail call i32 (i32*, i8*, ...) @fp_printf(i32* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret void
}