#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 getushort(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, ...);
int showbinsearchheader(FILE *ttf) {
  int size, cnt;
  printf("\t  Binary search header\n");
  printf("\t   Entry size=%d\n", size = getushort(ttf));
  printf("\t   Number of entries=%d\n", cnt = getushort(ttf));
  printf("\t   Search range=%d\n", getushort(ttf));
  printf("\t   Log2(nUnits)=%d\n", getushort(ttf));
  printf("\t   Range Shift=%d\n", getushort(ttf));
  return (cnt);
}


x86 assembly (clang, -O0):
<showbinsearchheader>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xecd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1040 <getushort@plt>
mov    %eax,%esi
mov    %esi,-0xc(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1040 <getushort@plt>
mov    %eax,%esi
mov    %esi,-0x10(%rbp)
lea    0xec1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1040 <getushort@plt>
mov    %eax,%esi
lea    0xec2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1040 <getushort@plt>
mov    %eax,%esi
lea    0xebe(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1040 <getushort@plt>
mov    %eax,%esi
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<showbinsearchheader>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xf2e(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1050 <getushort@plt>
lea    0xeaf(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1050 <getushort@plt>
mov    %eax,%ebp
lea    0xea8(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1050 <getushort@plt>
lea    0xeaa(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1050 <getushort@plt>
lea    0xea7(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1050 <getushort@plt>
lea    0xea4(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [25 x i8] c"\09 Binary search header\0A\00"
@.str.1 = [19 x i8] c"\09 Entry size=%d\0A\00"
@.str.2 = [26 x i8] c"\09 Number of entries=%d\0A\00"
@.str.3 = [21 x i8] c"\09 Search range=%d\0A\00"
@.str.4 = [21 x i8] c"\09 Log2(nUnits)=%d\0A\00"
@.str.5 = [20 x i8] c"\09 Range Shift=%d\0A\00"
define i32 @showbinsearchheader(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
store i32* %0, i32** %2
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%6 = load i32*, i32** %2
%7 = call i32 @getushort(i32* %6)
store i32 %7, i32* %3
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 %7)
%9 = load i32*, i32** %2
%10 = call i32 @getushort(i32* %9)
store i32 %10, i32* %4
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i32 %10)
%12 = load i32*, i32** %2
%13 = call i32 @getushort(i32* %12)
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i32 %13)
%15 = load i32*, i32** %2
%16 = call i32 @getushort(i32* %15)
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i32 %16)
%18 = load i32*, i32** %2
%19 = call i32 @getushort(i32* %18)
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0), i32 %19)
%21 = load i32, i32* %4
ret i32 %21
}

LLVM IR (-O2):
@.str.1 = [19 x i8] c"\09 Entry size=%d\0A\00"
@.str.2 = [26 x i8] c"\09 Number of entries=%d\0A\00"
@.str.3 = [21 x i8] c"\09 Search range=%d\0A\00"
@.str.4 = [21 x i8] c"\09 Log2(nUnits)=%d\0A\00"
@.str.5 = [20 x i8] c"\09 Range Shift=%d\0A\00"
@str = [24 x i8] c"\09 Binary search header\00"
define i32 @showbinsearchheader(i32* %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @getushort(i32* %0)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 %3)
%5 = tail call i32 @getushort(i32* %0)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i32 %5)
%7 = tail call i32 @getushort(i32* %0)
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i32 %7)
%9 = tail call i32 @getushort(i32* %0)
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i32 %9)
%11 = tail call i32 @getushort(i32* %0)
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0), i32 %11)
ret i32 %5
}