#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 */

/* Variables and functions */
scalar_t__ fsck_commit(unsigned char *, void *, unsigned long);
scalar_t__ fsck_tree(unsigned char *, void *, unsigned long);
int mark_sha1_seen(unsigned char *, char *);
int /*<<< orphan*/ strcmp(char *, char *);
int fsck_entry(unsigned char *sha1, char *tag, void *data, unsigned long size) {
  if (!strcmp(tag, "blob")) {
    ;
  } else if (!strcmp(tag, "tree")) {
    if (fsck_tree(sha1, data, size) < 0)
      return -1;
  } else if (!strcmp(tag, "commit")) {
    if (fsck_commit(sha1, data, size) < 0)
      return -1;
  } else
    return -1;
  return mark_sha1_seen(sha1, tag);
}


x86 assembly (clang, -O0):
<fsck_entry>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xe9d(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    1176 <fsck_entry+0x36>
jmp    1216 <fsck_entry+0xd6>
mov    -0x18(%rbp),%rdi
lea    0xe84(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    11bb <fsck_entry+0x7b>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
call   1060 <fsck_tree@plt>
cmp    $0x0,%rax
jge    11b6 <fsck_entry+0x76>
movl   $0xffffffff,-0x4(%rbp)
jmp    1226 <fsck_entry+0xe6>
jmp    1211 <fsck_entry+0xd1>
mov    -0x18(%rbp),%rdi
lea    0xe44(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    1200 <fsck_entry+0xc0>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
call   1040 <fsck_commit@plt>
cmp    $0x0,%rax
jge    11fb <fsck_entry+0xbb>
movl   $0xffffffff,-0x4(%rbp)
jmp    1226 <fsck_entry+0xe6>
jmp    120c <fsck_entry+0xcc>
movl   $0xffffffff,-0x4(%rbp)
jmp    1226 <fsck_entry+0xe6>
jmp    1211 <fsck_entry+0xd1>
jmp    1216 <fsck_entry+0xd6>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <mark_sha1_seen@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fsck_entry>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r15
mov    %rdx,%r12
mov    %rsi,%rbx
mov    %rdi,%r14
lea    0xea5(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
test   %eax,%eax
je     11a0 <fsck_entry+0x60>
lea    0xe97(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
test   %eax,%eax
je     11b6 <fsck_entry+0x76>
lea    0xe89(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
test   %eax,%eax
jne    11c9 <fsck_entry+0x89>
mov    %r14,%rdi
mov    %r12,%rsi
mov    %r15,%rdx
call   1040 <fsck_commit@plt>
test   %rax,%rax
js     11c9 <fsck_entry+0x89>
mov    %r14,%rdi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <mark_sha1_seen@plt>
mov    %r14,%rdi
mov    %r12,%rsi
mov    %r15,%rdx
call   1060 <fsck_tree@plt>
test   %rax,%rax
jns    11a0 <fsck_entry+0x60>
mov    $0xffffffff,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [5 x i8] c"blob\00"
@.str.1 = [5 x i8] c"tree\00"
@.str.2 = [7 x i8] c"commit\00"
define i32 @fsck_entry(i8* %0, i8* %1, i8* %2, i64 %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i64
store i8* %0, i8** %6
store i8* %1, i8** %7
store i8* %2, i8** %8
store i64 %3, i64* %9
%10 = load i8*, i8** %7
%11 = call i32 @strcmp(i8* %10, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%12 = icmp ne i32 %11, 0
br i1 %12, label %14, label %13
13: ; preds = %4
br label %41
14: ; preds = %4
%15 = load i8*, i8** %7
%16 = call i32 @strcmp(i8* %15, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%17 = icmp ne i32 %16, 0
br i1 %17, label %26, label %18
18: ; preds = %14
%19 = load i8*, i8** %6
%20 = load i8*, i8** %8
%21 = load i64, i64* %9
%22 = call i64 @fsck_tree(i8* %19, i8* %20, i64 %21)
%23 = icmp slt i64 %22, 0
br i1 %23, label %24, label %25
24: ; preds = %18
store i32 -1, i32* %5
br label %45
25: ; preds = %18
br label %40
26: ; preds = %14
%27 = load i8*, i8** %7
%28 = call i32 @strcmp(i8* %27, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%29 = icmp ne i32 %28, 0
br i1 %29, label %38, label %30
30: ; preds = %26
%31 = load i8*, i8** %6
%32 = load i8*, i8** %8
%33 = load i64, i64* %9
%34 = call i64 @fsck_commit(i8* %31, i8* %32, i64 %33)
%35 = icmp slt i64 %34, 0
br i1 %35, label %36, label %37
36: ; preds = %30
store i32 -1, i32* %5
br label %45
37: ; preds = %30
br label %39
38: ; preds = %26
store i32 -1, i32* %5
br label %45
39: ; preds = %37
br label %40
40: ; preds = %39, %25
br label %41
41: ; preds = %40, %13
%42 = load i8*, i8** %6
%43 = load i8*, i8** %7
%44 = call i32 @mark_sha1_seen(i8* %42, i8* %43)
store i32 %44, i32* %5
br label %45
45: ; preds = %41, %38, %36, %24
%46 = load i32, i32* %5
ret i32 %46
}

LLVM IR (-O2):
@.str = [5 x i8] c"blob\00"
@.str.1 = [5 x i8] c"tree\00"
@.str.2 = [7 x i8] c"commit\00"
define i32 @fsck_entry(i8* %0, i8* %1, i8* %2, i64 %3) {
%5 = tail call i32 @strcmp(i8* dereferenceable(1) %1, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%6 = icmp eq i32 %5, 0
br i1 %6, label %19, label %7
7: ; preds = %4
%8 = tail call i32 @strcmp(i8* dereferenceable(1) %1, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %7
%11 = tail call i64 @fsck_tree(i8* %0, i8* %2, i64 %3)
%12 = icmp slt i64 %11, 0
br i1 %12, label %21, label %19
13: ; preds = %7
%14 = tail call i32 @strcmp(i8* dereferenceable(1) %1, i8* dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %21
16: ; preds = %13
%17 = tail call i64 @fsck_commit(i8* %0, i8* %2, i64 %3)
%18 = icmp slt i64 %17, 0
br i1 %18, label %21, label %19
19: ; preds = %10, %16, %4
%20 = tail call i32 @mark_sha1_seen(i8* %0, i8* %1)
br label %21
21: ; preds = %13, %16, %10, %19
%22 = phi i32 [ %20, %19 ], [ -1, %10 ], [ -1, %16 ], [ -1, %13 ]
ret i32 %22
}