#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*/ db;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fread(char **, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ rewind(int /*<<< orphan*/ *);
scalar_t__ strcmp(char *, char *);
int identify(FILE *database) {
  int result = 0;
  char db[100] = {0};
  if (database != NULL) {
    fread(&db, sizeof(db), 1, database);
    rewind(database);
    if (strcmp(db, "Warehouse") != 0) {
      result = 1;
    }
  }
  return result;
}


x86 assembly (clang, -O0):
<identify>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
lea    -0x70(%rbp),%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   1050 <memset@plt>
cmpq   $0x0,-0x8(%rbp)
je     11b4 <identify+0x74>
lea    -0x70(%rbp),%rdi
mov    -0x8(%rbp),%rcx
mov    $0x64,%esi
mov    $0x1,%edx
call   1030 <fread@plt>
mov    -0x8(%rbp),%rdi
call   1040 <rewind@plt>
lea    -0x70(%rbp),%rdi
lea    0xe67(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
je     11af <identify+0x6f>
movl   $0x1,-0xc(%rbp)
jmp    11b4 <identify+0x74>
mov    -0xc(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<identify>:
push   %r14
push   %rbx
sub    $0x68,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
movl   $0x0,0x60(%rsp)
test   %rdi,%rdi
je     11a3 <identify+0x73>
mov    %rdi,%rbx
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x64,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1030 <fread@plt>
mov    %rbx,%rdi
call   1040 <rewind@plt>
lea    0xe72(%rip),%rsi
mov    %r14,%rdi
call   1050 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
jmp    11a5 <identify+0x75>
xor    %eax,%eax
add    $0x68,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [10 x i8] c"Warehouse\00"
define i32 @identify(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
%4 = alloca [100 x i8]
store i32* %0, i32** %2
store i32 0, i32* %3
%5 = bitcast [100 x i8]* %4 to i8*
%6 = load i32*, i32** %2
%7 = icmp ne i32* %6, null
br i1 %7, label %8, label %19
8: ; preds = %1
%9 = bitcast [100 x i8]* %4 to i8**
%10 = load i32*, i32** %2
%11 = call i32 @fread(i8** %9, i32 100, i32 1, i32* %10)
%12 = load i32*, i32** %2
%13 = call i32 @rewind(i32* %12)
%14 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%15 = call i64 @strcmp(i8* %14, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %8
store i32 1, i32* %3
br label %18
18: ; preds = %17, %8
br label %19
19: ; preds = %18, %1
%20 = load i32, i32* %3
ret i32 %20
}

LLVM IR (-O2):
@.str = [10 x i8] c"Warehouse\00"
define i32 @identify(i32* %0) {
%2 = alloca [100 x i8]
%3 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%4 = icmp eq i32* %0, null
br i1 %4, label %12, label %5
5: ; preds = %1
%6 = bitcast [100 x i8]* %2 to i8**
%7 = call i32 @fread(i8** %6, i32 100, i32 1, i32* %0)
%8 = tail call i32 @rewind(i32* %0)
%9 = call i64 @strcmp(i8* %3, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%10 = icmp ne i64 %9, 0
%11 = zext i1 %10 to i32
br label %12
12: ; preds = %5, %1
%13 = phi i32 [ 0, %1 ], [ %11, %5 ]
ret i32 %13
}