#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 */
struct page {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ assert(struct page *);
int /*<<< orphan*/ dumphex(struct page *, int, int);
int /*<<< orphan*/ freehex(struct page *, int);
struct page *rdhex(char *, int, int);
int main(int argc, char **argv) {
  struct page *p;
  if (argc != 2)
    return -1;
  p = rdhex(argv[1], 256, 128);
  assert(p);
  dumphex(p, 256, 128);
  freehex(p, 256);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     116c <main+0x2c>
movl   $0xffffffff,-0x4(%rbp)
jmp    11b8 <main+0x78>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    $0x100,%esi
mov    $0x80,%edx
call   1060 <rdhex@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <assert@plt>
mov    -0x18(%rbp),%rdi
mov    $0x100,%esi
mov    $0x80,%edx
call   1040 <dumphex@plt>
mov    -0x18(%rbp),%rdi
mov    $0x100,%esi
call   1030 <freehex@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
mov    $0xffffffff,%eax
cmp    $0x2,%edi
jne    118b <main+0x4b>
push   %rbx
mov    0x8(%rsi),%rdi
mov    $0x100,%esi
mov    $0x80,%edx
call   1060 <rdhex@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1050 <assert@plt>
mov    %rbx,%rdi
mov    $0x100,%esi
mov    $0x80,%edx
call   1040 <dumphex@plt>
mov    %rbx,%rdi
mov    $0x100,%esi
call   1030 <freehex@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.page = type { i32 }
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.page*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp ne i32 %7, 2
br i1 %8, label %9, label %10
9: ; preds = %2
store i32 -1, i32* %3
br label %21
10: ; preds = %2
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
%14 = call %struct.page* @rdhex(i8* %13, i32 256, i32 128)
store %struct.page* %14, %struct.page** %6
%15 = load %struct.page*, %struct.page** %6
%16 = call i32 @assert(%struct.page* %15)
%17 = load %struct.page*, %struct.page** %6
%18 = call i32 @dumphex(%struct.page* %17, i32 256, i32 128)
%19 = load %struct.page*, %struct.page** %6
%20 = call i32 @freehex(%struct.page* %19, i32 256)
store i32 0, i32* %3
br label %21
21: ; preds = %10, %9
%22 = load i32, i32* %3
ret i32 %22
}

LLVM IR (-O2):
%struct.page = type { i32 }
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %4, label %11
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call %struct.page* @rdhex(i8* %6, i32 256, i32 128)
%8 = tail call i32 @assert(%struct.page* %7)
%9 = tail call i32 @dumphex(%struct.page* %7, i32 256, i32 128)
%10 = tail call i32 @freehex(%struct.page* %7, i32 256)
br label %11
11: ; preds = %2, %4
%12 = phi i32 [ 0, %4 ], [ -1, %2 ]
ret i32 %12
}