#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*/ assert(int);
int /*<<< orphan*/ print_decode_line(unsigned char *, int, int, int, char *);
void print_index_hdr(unsigned char *aData, int ix) {
  int i;
  assert(ix == 0 || ix == 1);
  i = ix ? 48 : 0;
  print_decode_line(aData, 0 + i, 4, 2, "Wal-index version");
  print_decode_line(aData, 4 + i, 4, 0, "unused padding");
  print_decode_line(aData, 8 + i, 4, 2, "transaction counter");
  print_decode_line(aData, 12 + i, 1, 0, "1 when initialized");
  print_decode_line(aData, 13 + i, 1, 0, "true if WAL cksums are bigendian");
  print_decode_line(aData, 14 + i, 2, 4, "database page size");
  print_decode_line(aData, 16 + i, 4, 2, "mxFrame");
  print_decode_line(aData, 20 + i, 4, 2, "Size of database in pages");
  print_decode_line(aData, 24 + i, 8, 0, "Cksum of last frame in -wal");
  print_decode_line(aData, 32 + i, 8, 0, "Salt values from the -wal");
  print_decode_line(aData, 40 + i, 8, 0, "Cksum over all prior fields");
}


x86 assembly (clang, -O0):
<print_index_hdr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    $0x1,%al
cmpl   $0x0,-0xc(%rbp)
mov    %al,-0x11(%rbp)
je     1148 <print_index_hdr+0x28>
cmpl   $0x1,-0xc(%rbp)
sete   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0xc(%rbp),%edx
xor    %eax,%eax
mov    $0x30,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%esi
add    $0x0,%esi
mov    $0x4,%edx
mov    $0x2,%ecx
lea    0xe7d(%rip),%r8
call   1030 <print_decode_line@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%esi
add    $0x4,%esi
mov    $0x4,%edx
xor    %ecx,%ecx
lea    0xe72(%rip),%r8
call   1030 <print_decode_line@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%esi
add    $0x8,%esi
mov    $0x4,%edx
mov    $0x2,%ecx
lea    0xe61(%rip),%r8
call   1030 <print_decode_line@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%esi
add    $0xc,%esi
mov    $0x1,%edx
xor    %ecx,%ecx
lea    0xe58(%rip),%r8
call   1030 <print_decode_line@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%esi
add    $0xd,%esi
mov    $0x1,%edx
xor    %ecx,%ecx
lea    0xe4e(%rip),%r8
call   1030 <print_decode_line@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%esi
add    $0xe,%esi
mov    $0x2,%edx
mov    $0x4,%ecx
lea    0xe4f(%rip),%r8
call   1030 <print_decode_line@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%esi
add    $0x10,%esi
mov    $0x4,%edx
mov    $0x2,%ecx
lea    0xe42(%rip),%r8
call   1030 <print_decode_line@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%esi
add    $0x14,%esi
mov    $0x4,%edx
mov    $0x2,%ecx
lea    0xe2a(%rip),%r8
call   1030 <print_decode_line@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%esi
add    $0x18,%esi
mov    $0x8,%edx
xor    %ecx,%ecx
lea    0xe27(%rip),%r8
call   1030 <print_decode_line@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%esi
add    $0x20,%esi
mov    $0x8,%edx
xor    %ecx,%ecx
lea    0xe26(%rip),%r8
call   1030 <print_decode_line@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%esi
add    $0x28,%esi
mov    $0x8,%edx
xor    %ecx,%ecx
lea    0xe23(%rip),%r8
call   1030 <print_decode_line@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_index_hdr>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebp
mov    %rdi,%r14
xor    %edi,%edi
cmp    $0x2,%esi
setb   %dil
call   1040 <assert@plt>
test   %ebp,%ebp
mov    $0x30,%ebx
cmove  %ebp,%ebx
lea    0xeb8(%rip),%r8
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x4,%edx
mov    $0x2,%ecx
call   1030 <print_decode_line@plt>
mov    %ebx,%esi
or     $0x4,%esi
lea    0xeaa(%rip),%r8
mov    %r14,%rdi
mov    $0x4,%edx
xor    %ecx,%ecx
call   1030 <print_decode_line@plt>
mov    %ebx,%esi
or     $0x8,%esi
lea    0xe9e(%rip),%r8
mov    %r14,%rdi
mov    $0x4,%edx
mov    $0x2,%ecx
call   1030 <print_decode_line@plt>
mov    %ebx,%esi
or     $0xc,%esi
lea    0xe94(%rip),%r8
mov    %r14,%rdi
mov    $0x1,%edx
xor    %ecx,%ecx
call   1030 <print_decode_line@plt>
mov    %ebx,%esi
or     $0xd,%esi
lea    0xe8c(%rip),%r8
mov    %r14,%rdi
mov    $0x1,%edx
xor    %ecx,%ecx
call   1030 <print_decode_line@plt>
mov    %ebx,%esi
or     $0xe,%esi
lea    0xe92(%rip),%r8
mov    %r14,%rdi
mov    $0x2,%edx
mov    $0x4,%ecx
call   1030 <print_decode_line@plt>
lea    0x10(%rbx),%esi
lea    0xe89(%rip),%r8
mov    %r14,%rdi
mov    $0x4,%edx
mov    $0x2,%ecx
call   1030 <print_decode_line@plt>
lea    0x14(%rbx),%esi
lea    0xe75(%rip),%r8
mov    %r14,%rdi
mov    $0x4,%edx
mov    $0x2,%ecx
call   1030 <print_decode_line@plt>
lea    0x18(%rbx),%esi
lea    0xe73(%rip),%r8
mov    %r14,%rdi
mov    $0x8,%edx
xor    %ecx,%ecx
call   1030 <print_decode_line@plt>
lea    0x20(%rbx),%esi
lea    0xe76(%rip),%r8
mov    %r14,%rdi
mov    $0x8,%edx
xor    %ecx,%ecx
call   1030 <print_decode_line@plt>
add    $0x28,%ebx
lea    0xe77(%rip),%r8
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x8,%edx
xor    %ecx,%ecx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <print_decode_line@plt>

LLVM IR (-O0):
@.str = [18 x i8] c"Wal-index version\00"
@.str.1 = [15 x i8] c"unused padding\00"
@.str.2 = [20 x i8] c"transaction counter\00"
@.str.3 = [19 x i8] c"1 when initialized\00"
@.str.4 = [33 x i8] c"true if WAL cksums are bigendian\00"
@.str.5 = [19 x i8] c"database page size\00"
@.str.6 = [8 x i8] c"mxFrame\00"
@.str.7 = [26 x i8] c"Size of database in pages\00"
@.str.8 = [28 x i8] c"Cksum of last frame in -wal\00"
@.str.9 = [26 x i8] c"Salt values from the -wal\00"
@.str.10 = [28 x i8] c"Cksum over all prior fields\00"
define void @print_index_hdr(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = icmp eq i32 %6, 0
br i1 %7, label %11, label %8
8: ; preds = %2
%9 = load i32, i32* %4
%10 = icmp eq i32 %9, 1
br label %11
11: ; preds = %8, %2
%12 = phi i1 [ true, %2 ], [ %10, %8 ]
%13 = zext i1 %12 to i32
%14 = call i32 @assert(i32 %13)
%15 = load i32, i32* %4
%16 = icmp ne i32 %15, 0
%17 = zext i1 %16 to i64
%18 = select i1 %16, i32 48, i32 0
store i32 %18, i32* %5
%19 = load i8*, i8** %3
%20 = load i32, i32* %5
%21 = add nsw i32 0, %20
%22 = call i32 @print_decode_line(i8* %19, i32 %21, i32 4, i32 2, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%23 = load i8*, i8** %3
%24 = load i32, i32* %5
%25 = add nsw i32 4, %24
%26 = call i32 @print_decode_line(i8* %23, i32 %25, i32 4, i32 0, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%27 = load i8*, i8** %3
%28 = load i32, i32* %5
%29 = add nsw i32 8, %28
%30 = call i32 @print_decode_line(i8* %27, i32 %29, i32 4, i32 2, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
%31 = load i8*, i8** %3
%32 = load i32, i32* %5
%33 = add nsw i32 12, %32
%34 = call i32 @print_decode_line(i8* %31, i32 %33, i32 1, i32 0, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
%35 = load i8*, i8** %3
%36 = load i32, i32* %5
%37 = add nsw i32 13, %36
%38 = call i32 @print_decode_line(i8* %35, i32 %37, i32 1, i32 0, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.4, i64 0, i64 0))
%39 = load i8*, i8** %3
%40 = load i32, i32* %5
%41 = add nsw i32 14, %40
%42 = call i32 @print_decode_line(i8* %39, i32 %41, i32 2, i32 4, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0))
%43 = load i8*, i8** %3
%44 = load i32, i32* %5
%45 = add nsw i32 16, %44
%46 = call i32 @print_decode_line(i8* %43, i32 %45, i32 4, i32 2, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0))
%47 = load i8*, i8** %3
%48 = load i32, i32* %5
%49 = add nsw i32 20, %48
%50 = call i32 @print_decode_line(i8* %47, i32 %49, i32 4, i32 2, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.7, i64 0, i64 0))
%51 = load i8*, i8** %3
%52 = load i32, i32* %5
%53 = add nsw i32 24, %52
%54 = call i32 @print_decode_line(i8* %51, i32 %53, i32 8, i32 0, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.8, i64 0, i64 0))
%55 = load i8*, i8** %3
%56 = load i32, i32* %5
%57 = add nsw i32 32, %56
%58 = call i32 @print_decode_line(i8* %55, i32 %57, i32 8, i32 0, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.9, i64 0, i64 0))
%59 = load i8*, i8** %3
%60 = load i32, i32* %5
%61 = add nsw i32 40, %60
%62 = call i32 @print_decode_line(i8* %59, i32 %61, i32 8, i32 0, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.10, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [18 x i8] c"Wal-index version\00"
@.str.1 = [15 x i8] c"unused padding\00"
@.str.2 = [20 x i8] c"transaction counter\00"
@.str.3 = [19 x i8] c"1 when initialized\00"
@.str.4 = [33 x i8] c"true if WAL cksums are bigendian\00"
@.str.5 = [19 x i8] c"database page size\00"
@.str.6 = [8 x i8] c"mxFrame\00"
@.str.7 = [26 x i8] c"Size of database in pages\00"
@.str.8 = [28 x i8] c"Cksum of last frame in -wal\00"
@.str.9 = [26 x i8] c"Salt values from the -wal\00"
@.str.10 = [28 x i8] c"Cksum over all prior fields\00"
define void @print_index_hdr(i8* %0, i32 %1) {
%3 = icmp ult i32 %1, 2
%4 = zext i1 %3 to i32
%5 = tail call i32 @assert(i32 %4)
%6 = icmp eq i32 %1, 0
%7 = select i1 %6, i32 0, i32 48
%8 = tail call i32 @print_decode_line(i8* %0, i32 %7, i32 4, i32 2, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%9 = or i32 %7, 4
%10 = tail call i32 @print_decode_line(i8* %0, i32 %9, i32 4, i32 0, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%11 = or i32 %7, 8
%12 = tail call i32 @print_decode_line(i8* %0, i32 %11, i32 4, i32 2, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
%13 = or i32 %7, 12
%14 = tail call i32 @print_decode_line(i8* %0, i32 %13, i32 1, i32 0, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
%15 = or i32 %7, 13
%16 = tail call i32 @print_decode_line(i8* %0, i32 %15, i32 1, i32 0, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.4, i64 0, i64 0))
%17 = or i32 %7, 14
%18 = tail call i32 @print_decode_line(i8* %0, i32 %17, i32 2, i32 4, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0))
%19 = add nuw nsw i32 %7, 16
%20 = tail call i32 @print_decode_line(i8* %0, i32 %19, i32 4, i32 2, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0))
%21 = add nuw nsw i32 %7, 20
%22 = tail call i32 @print_decode_line(i8* %0, i32 %21, i32 4, i32 2, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.7, i64 0, i64 0))
%23 = add nuw nsw i32 %7, 24
%24 = tail call i32 @print_decode_line(i8* %0, i32 %23, i32 8, i32 0, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.8, i64 0, i64 0))
%25 = add nuw nsw i32 %7, 32
%26 = tail call i32 @print_decode_line(i8* %0, i32 %25, i32 8, i32 0, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.9, i64 0, i64 0))
%27 = add nuw nsw i32 %7, 40
%28 = tail call i32 @print_decode_line(i8* %0, i32 %27, i32 8, i32 0, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.10, i64 0, i64 0))
ret void
}