#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*/ SEEK_SET;
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int, int /*<<< orphan*/);
int getushort(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, ...);
void readttfjustlookups(char *label, FILE *ttf, int base, int offset) {
  int lcnt, i;
  if (offset == 0) {
    printf("\t    No %s data\n", label);
    return;
  }
  base += offset;
  fseek(ttf, base, SEEK_SET);
  lcnt = getushort(ttf);
  printf("\t    %d lookup%s for %s\n", lcnt, lcnt == 1 ? "" : "s", label);
  for (i = 0; i < lcnt; ++i)
    printf("\t\tLookup %d\n", getushort(ttf));
}


x86 assembly (clang, -O0):
<readttfjustlookups>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jne    1167 <readttfjustlookups+0x37>
mov    -0x8(%rbp),%rsi
lea    0xea5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11f8 <readttfjustlookups+0xc8>
mov    -0x18(%rbp),%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    0x2e62(%rip),%rax
mov    (%rax),%edx
call   1040 <fseek@plt>
mov    -0x10(%rbp),%rdi
call   1050 <getushort@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%esi
mov    -0x1c(%rbp),%ecx
lea    0xe8c(%rip),%rdx
lea    0xe6b(%rip),%rax
cmp    $0x1,%ecx
cmove  %rax,%rdx
mov    -0x8(%rbp),%rcx
lea    0xe5a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    11f8 <readttfjustlookups+0xc8>
mov    -0x10(%rbp),%rdi
call   1050 <getushort@plt>
mov    %eax,%esi
lea    0xe49(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11c5 <readttfjustlookups+0x95>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readttfjustlookups>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%r14
test   %ecx,%ecx
je     11ae <readttfjustlookups+0x7e>
mov    %rsi,%rbx
add    %edx,%ecx
mov    0x2e99(%rip),%rax
mov    (%rax),%edx
mov    %rsi,%rdi
mov    %ecx,%esi
call   1040 <fseek@plt>
mov    %rbx,%rdi
call   1050 <getushort@plt>
mov    %eax,%ebp
cmp    $0x1,%eax
lea    0xea9(%rip),%rax
lea    0xebc(%rip),%rdx
cmove  %rax,%rdx
lea    0xe98(%rip),%rdi
mov    %ebp,%esi
mov    %r14,%rcx
xor    %eax,%eax
call   1030 <printf@plt>
test   %ebp,%ebp
jle    11a9 <readttfjustlookups+0x79>
lea    0xe9c(%rip),%r14
mov    %rbx,%rdi
call   1050 <getushort@plt>
mov    %r14,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0xffffffff,%ebp
jne    1190 <readttfjustlookups+0x60>
pop    %rbx
pop    %r14
pop    %rbp
ret
lea    0xe4b(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [17 x i8] c"\09 No %s data\0A\00"
@SEEK_SET = global i32 0
@.str.1 = [25 x i8] c"\09 %d lookup%s for %s\0A\00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [2 x i8] c"s\00"
@.str.4 = [13 x i8] c"\09\09Lookup %d\0A\00"
define void @readttfjustlookups(i8* %0, i32* %1, i32 %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i8* %0, i8** %5
store i32* %1, i32** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%11 = load i32, i32* %8
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %4
%14 = load i8*, i8** %5
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %14)
br label %44
16: ; preds = %4
%17 = load i32, i32* %8
%18 = load i32, i32* %7
%19 = add nsw i32 %18, %17
store i32 %19, i32* %7
%20 = load i32*, i32** %6
%21 = load i32, i32* %7
%22 = load i32, i32* @SEEK_SET
%23 = call i32 @fseek(i32* %20, i32 %21, i32 %22)
%24 = load i32*, i32** %6
%25 = call i32 @getushort(i32* %24)
store i32 %25, i32* %9
%26 = load i32, i32* %9
%27 = load i32, i32* %9
%28 = icmp eq i32 %27, 1
%29 = zext i1 %28 to i64
%30 = select i1 %28, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0)
%31 = load i8*, i8** %5
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i32 %26, i8* %30, i8* %31)
store i32 0, i32* %10
br label %33
33: ; preds = %41, %16
%34 = load i32, i32* %10
%35 = load i32, i32* %9
%36 = icmp slt i32 %34, %35
br i1 %36, label %37, label %44
37: ; preds = %33
%38 = load i32*, i32** %6
%39 = call i32 @getushort(i32* %38)
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i32 %39)
br label %41
41: ; preds = %37
%42 = load i32, i32* %10
%43 = add nsw i32 %42, 1
store i32 %43, i32* %10
br label %33
44: ; preds = %13, %33
ret void
}

LLVM IR (-O2):
@.str = [17 x i8] c"\09 No %s data\0A\00"
@SEEK_SET = global i32 0
@.str.1 = [25 x i8] c"\09 %d lookup%s for %s\0A\00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [2 x i8] c"s\00"
@.str.4 = [13 x i8] c"\09\09Lookup %d\0A\00"
define void @readttfjustlookups(i8* %0, i32* %1, i32 %2, i32 %3) {
%5 = icmp eq i32 %3, 0
br i1 %5, label %6, label %8
6: ; preds = %4
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %23
8: ; preds = %4
%9 = add nsw i32 %3, %2
%10 = load i32, i32* @SEEK_SET
%11 = tail call i32 @fseek(i32* %1, i32 %9, i32 %10)
%12 = tail call i32 @getushort(i32* %1)
%13 = icmp eq i32 %12, 1
%14 = select i1 %13, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0)
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i32 %12, i8* %14, i8* %0)
%16 = icmp sgt i32 %12, 0
br i1 %16, label %17, label %23
17: ; preds = %8, %17
%18 = phi i32 [ %21, %17 ], [ 0, %8 ]
%19 = tail call i32 @getushort(i32* %1)
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i32 %19)
%21 = add nuw nsw i32 %18, 1
%22 = icmp eq i32 %21, %12
br i1 %22, label %23, label %17
23: ; preds = %17, %8, %6
ret void
}