#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*/ free(unsigned char *);
unsigned char *getContent(int /*<<< orphan*/, int);
int /*<<< orphan*/ print_decode_line(unsigned char *, int, int, int, char *);
int /*<<< orphan*/ printf(char *);
void print_wal_header(void) {
  unsigned char *aData;
  aData = getContent(0, 32);
  printf("WAL Header:\n");
  print_decode_line(aData, 0, 4, 1,
                    "Magic.  0x377f0682 (le) or 0x377f0683 (be)");
  print_decode_line(aData, 4, 4, 0, "File format");
  print_decode_line(aData, 8, 4, 0, "Database page size");
  print_decode_line(aData, 12, 4, 0, "Checkpoint sequence number");
  print_decode_line(aData, 16, 4, 1, "Salt-1");
  print_decode_line(aData, 20, 4, 1, "Salt-2");
  print_decode_line(aData, 24, 4, 1, "Checksum-1");
  print_decode_line(aData, 28, 4, 1, "Checksum-2");
  free(aData);
}


x86 assembly (clang, -O0):
<print_wal_header>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %edi,%edi
mov    $0x20,%esi
call   1060 <getContent@plt>
mov    %rax,-0x8(%rbp)
lea    0xea1(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
mov    $0x4,%edx
mov    $0x1,%ecx
lea    0xe92(%rip),%r8
call   1050 <print_decode_line@plt>
mov    -0x8(%rbp),%rdi
mov    $0x4,%edx
xor    %ecx,%ecx
lea    0xea6(%rip),%r8
mov    %edx,%esi
call   1050 <print_decode_line@plt>
mov    -0x8(%rbp),%rdi
mov    $0x8,%esi
mov    $0x4,%edx
xor    %ecx,%ecx
lea    0xe94(%rip),%r8
call   1050 <print_decode_line@plt>
mov    -0x8(%rbp),%rdi
mov    $0xc,%esi
mov    $0x4,%edx
xor    %ecx,%ecx
lea    0xe8b(%rip),%r8
call   1050 <print_decode_line@plt>
mov    -0x8(%rbp),%rdi
mov    $0x10,%esi
mov    $0x4,%edx
mov    $0x1,%ecx
lea    0xe87(%rip),%r8
call   1050 <print_decode_line@plt>
mov    -0x8(%rbp),%rdi
mov    $0x14,%esi
mov    $0x4,%edx
mov    $0x1,%ecx
lea    0xe6f(%rip),%r8
call   1050 <print_decode_line@plt>
mov    -0x8(%rbp),%rdi
mov    $0x18,%esi
mov    $0x4,%edx
mov    $0x1,%ecx
lea    0xe57(%rip),%r8
call   1050 <print_decode_line@plt>
mov    -0x8(%rbp),%rdi
mov    $0x1c,%esi
mov    $0x4,%edx
mov    $0x1,%ecx
lea    0xe43(%rip),%r8
call   1050 <print_decode_line@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_wal_header>:
push   %rbx
xor    %edi,%edi
mov    $0x20,%esi
call   1060 <getContent@plt>
mov    %rax,%rbx
lea    0xf32(%rip),%rdi
call   1040 <puts@plt>
lea    0xe9d(%rip),%r8
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x4,%edx
mov    $0x1,%ecx
call   1050 <print_decode_line@plt>
lea    0xead(%rip),%r8
mov    %rbx,%rdi
mov    $0x4,%esi
mov    $0x4,%edx
xor    %ecx,%ecx
call   1050 <print_decode_line@plt>
lea    0xe9e(%rip),%r8
mov    %rbx,%rdi
mov    $0x8,%esi
mov    $0x4,%edx
xor    %ecx,%ecx
call   1050 <print_decode_line@plt>
lea    0xe96(%rip),%r8
mov    %rbx,%rdi
mov    $0xc,%esi
mov    $0x4,%edx
xor    %ecx,%ecx
call   1050 <print_decode_line@plt>
lea    0xe96(%rip),%r8
mov    %rbx,%rdi
mov    $0x10,%esi
mov    $0x4,%edx
mov    $0x1,%ecx
call   1050 <print_decode_line@plt>
lea    0xe7f(%rip),%r8
mov    %rbx,%rdi
mov    $0x14,%esi
mov    $0x4,%edx
mov    $0x1,%ecx
call   1050 <print_decode_line@plt>
lea    0xe68(%rip),%r8
mov    %rbx,%rdi
mov    $0x18,%esi
mov    $0x4,%edx
mov    $0x1,%ecx
call   1050 <print_decode_line@plt>
lea    0xe55(%rip),%r8
mov    %rbx,%rdi
mov    $0x1c,%esi
mov    $0x4,%edx
mov    $0x1,%ecx
call   1050 <print_decode_line@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"WAL Header:\0A\00"
@.str.1 = [43 x i8] c"Magic. 0x377f0682 (le) or 0x377f0683 (be)\00"
@.str.2 = [12 x i8] c"File format\00"
@.str.3 = [19 x i8] c"Database page size\00"
@.str.4 = [27 x i8] c"Checkpoint sequence number\00"
@.str.5 = [7 x i8] c"Salt-1\00"
@.str.6 = [7 x i8] c"Salt-2\00"
@.str.7 = [11 x i8] c"Checksum-1\00"
@.str.8 = [11 x i8] c"Checksum-2\00"
define void @print_wal_header() {
%1 = alloca i8*
%2 = call i8* @getContent(i32 0, i32 32)
store i8* %2, i8** %1
%3 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%4 = load i8*, i8** %1
%5 = call i32 @print_decode_line(i8* %4, i32 0, i32 4, i32 1, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0))
%6 = load i8*, i8** %1
%7 = call i32 @print_decode_line(i8* %6, i32 4, i32 4, i32 0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%8 = load i8*, i8** %1
%9 = call i32 @print_decode_line(i8* %8, i32 8, i32 4, i32 0, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
%10 = load i8*, i8** %1
%11 = call i32 @print_decode_line(i8* %10, i32 12, i32 4, i32 0, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0))
%12 = load i8*, i8** %1
%13 = call i32 @print_decode_line(i8* %12, i32 16, i32 4, i32 1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
%14 = load i8*, i8** %1
%15 = call i32 @print_decode_line(i8* %14, i32 20, i32 4, i32 1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0))
%16 = load i8*, i8** %1
%17 = call i32 @print_decode_line(i8* %16, i32 24, i32 4, i32 1, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0))
%18 = load i8*, i8** %1
%19 = call i32 @print_decode_line(i8* %18, i32 28, i32 4, i32 1, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0))
%20 = load i8*, i8** %1
%21 = call i32 @free(i8* %20)
ret void
}

LLVM IR (-O2):
@.str.1 = [43 x i8] c"Magic. 0x377f0682 (le) or 0x377f0683 (be)\00"
@.str.2 = [12 x i8] c"File format\00"
@.str.3 = [19 x i8] c"Database page size\00"
@.str.4 = [27 x i8] c"Checkpoint sequence number\00"
@.str.5 = [7 x i8] c"Salt-1\00"
@.str.6 = [7 x i8] c"Salt-2\00"
@.str.7 = [11 x i8] c"Checksum-1\00"
@.str.8 = [11 x i8] c"Checksum-2\00"
@str = [12 x i8] c"WAL Header:\00"
define void @print_wal_header() {
%1 = tail call i8* @getContent(i32 0, i32 32)
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @print_decode_line(i8* %1, i32 0, i32 4, i32 1, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 @print_decode_line(i8* %1, i32 4, i32 4, i32 0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%5 = tail call i32 @print_decode_line(i8* %1, i32 8, i32 4, i32 0, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
%6 = tail call i32 @print_decode_line(i8* %1, i32 12, i32 4, i32 0, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0))
%7 = tail call i32 @print_decode_line(i8* %1, i32 16, i32 4, i32 1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
%8 = tail call i32 @print_decode_line(i8* %1, i32 20, i32 4, i32 1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0))
%9 = tail call i32 @print_decode_line(i8* %1, i32 24, i32 4, i32 1, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0))
%10 = tail call i32 @print_decode_line(i8* %1, i32 28, i32 4, i32 1, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0))
%11 = tail call i32 @free(i8* %1)
ret void
}