#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 ttf_header {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ *gettable(struct ttf_header *, int);
int hasRequiredTables(struct ttf_header *hdr) {
  static struct {
    int name, present;
  } tables[] = {{((('h') << 24) | (('e') << 16) | (('a') << 8) | ('d'))},
                {((('h') << 24) | (('h') << 16) | (('e') << 8) | ('a'))},
                {((('h') << 24) | (('m') << 16) | (('t') << 8) | ('x'))},
                {((('m') << 24) | (('a') << 16) | (('x') << 8) | ('p'))},
                {0}};
  int i;
  for (i = 0; tables[i].name != 0; ++i) {
    if (gettable(hdr, tables[i].name) == NULL)
      return (0);
  }
  return (1);
}


x86 assembly (clang, -O0):
<hasRequiredTables>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movslq -0x14(%rbp),%rcx
lea    0x2f02(%rip),%rax
cmpl   $0x0,(%rax,%rcx,8)
je     1178 <hasRequiredTables+0x68>
mov    -0x10(%rbp),%rdi
movslq -0x14(%rbp),%rcx
lea    0x2ee9(%rip),%rax
mov    (%rax,%rcx,8),%esi
call   1030 <gettable@plt>
cmp    $0x0,%rax
jne    1165 <hasRequiredTables+0x55>
movl   $0x0,-0x4(%rbp)
jmp    117f <hasRequiredTables+0x6f>
jmp    116a <hasRequiredTables+0x5a>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1123 <hasRequiredTables+0x13>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hasRequiredTables>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    $0x68656164,%esi
call   1030 <gettable@plt>
xor    %ebp,%ebp
test   %rax,%rax
je     1161 <hasRequiredTables+0x51>
mov    %rbx,%rdi
mov    $0x68686561,%esi
call   1030 <gettable@plt>
test   %rax,%rax
je     1161 <hasRequiredTables+0x51>
mov    %rbx,%rdi
mov    $0x686d7478,%esi
call   1030 <gettable@plt>
test   %rax,%rax
je     1161 <hasRequiredTables+0x51>
mov    %rbx,%rdi
mov    $0x6d617870,%esi
call   1030 <gettable@plt>
xor    %ebp,%ebp
test   %rax,%rax
setne  %bpl
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.anon = type { i32, i32 }
%struct.ttf_header = type { i32 }
@hasRequiredTables.tables = internal global [5 x %struct.anon] [%struct.anon { i32 1751474532, i32 0 }, %struct.anon { i32 1751672161, i32 0 }, %struct.anon { i32 1752003704, i32 0 }, %struct.anon { i32 1835104368, i32 0 }, %struct.anon zeroinitializer]
define i32 @hasRequiredTables(%struct.ttf_header* %0) {
%2 = alloca i32
%3 = alloca %struct.ttf_header*
%4 = alloca i32
store %struct.ttf_header* %0, %struct.ttf_header** %3
store i32 0, i32* %4
br label %5
5: ; preds = %23, %1
%6 = load i32, i32* %4
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds [5 x %struct.anon], [5 x %struct.anon]* @hasRequiredTables.tables, i64 0, i64 %7
%9 = getelementptr inbounds %struct.anon, %struct.anon* %8, i32 0, i32 0
%10 = load i32, i32* %9
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %26
12: ; preds = %5
%13 = load %struct.ttf_header*, %struct.ttf_header** %3
%14 = load i32, i32* %4
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [5 x %struct.anon], [5 x %struct.anon]* @hasRequiredTables.tables, i64 0, i64 %15
%17 = getelementptr inbounds %struct.anon, %struct.anon* %16, i32 0, i32 0
%18 = load i32, i32* %17
%19 = call i32* @gettable(%struct.ttf_header* %13, i32 %18)
%20 = icmp eq i32* %19, null
br i1 %20, label %21, label %22
21: ; preds = %12
store i32 0, i32* %2
br label %27
22: ; preds = %12
br label %23
23: ; preds = %22
%24 = load i32, i32* %4
%25 = add nsw i32 %24, 1
store i32 %25, i32* %4
br label %5
26: ; preds = %5
store i32 1, i32* %2
br label %27
27: ; preds = %26, %21
%28 = load i32, i32* %2
ret i32 %28
}

LLVM IR (-O2):
%struct.ttf_header = type { i32 }
define i32 @hasRequiredTables(%struct.ttf_header* %0) {
%2 = tail call i32* @gettable(%struct.ttf_header* %0, i32 1751474532)
%3 = icmp eq i32* %2, null
br i1 %3, label %14, label %4
4: ; preds = %1
%5 = tail call i32* @gettable(%struct.ttf_header* %0, i32 1751672161)
%6 = icmp eq i32* %5, null
br i1 %6, label %14, label %7
7: ; preds = %4
%8 = tail call i32* @gettable(%struct.ttf_header* %0, i32 1752003704)
%9 = icmp eq i32* %8, null
br i1 %9, label %14, label %10
10: ; preds = %7
%11 = tail call i32* @gettable(%struct.ttf_header* %0, i32 1835104368)
%12 = icmp ne i32* %11, null
%13 = zext i1 %12 to i32
br label %14
14: ; preds = %10, %7, %4, %1
%15 = phi i32 [ 0, %1 ], [ 0, %4 ], [ 0, %7 ], [ %13, %10 ]
ret i32 %15
}