#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 */
int brstub_new_object_validate(char *, char *);
int /*<<< orphan*/ printf(char *, char *);
int main(int argc, char **argv) {
  int ret = 0;
  char *filp = NULL;
  char *brick = NULL;
  if (argc != 3) {
    printf("Usage: %s <path> <brick>\n", argv[0]);
    goto err;
  }
  filp = argv[1];
  brick = argv[2];
  printf("Validating object version [%s]\n", filp);
  ret = brstub_new_object_validate(filp, brick);
  if (ret < 0)
    goto err;
  return 0;
err:
  return -1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     116f <main+0x4f>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe9b(%rip),%rdi
call   1030 <printf@plt>
jmp    11c2 <main+0xa2>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rsi
lea    0xe88(%rip),%rdi
call   1030 <printf@plt>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1040 <brstub_new_object_validate@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    11b6 <main+0x96>
jmp    11c2 <main+0xa2>
movl   $0x0,-0x4(%rbp)
jmp    11c9 <main+0xa9>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
cmp    $0x3,%edi
jne    1155 <main+0x35>
mov    0x8(%rsi),%rbx
mov    0x10(%rsi),%r14
lea    0xee2(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <brstub_new_object_validate@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
jns    1169 <main+0x49>
jmp    1164 <main+0x44>
mov    (%rsi),%rsi
lea    0xea1(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffffffff,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [26 x i8] c"Usage: %s <path> <brick>\0A\00"
@.str.1 = [32 x i8] c"Validating object version [%s]\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
store i8* null, i8** %7
store i8* null, i8** %8
%9 = load i32, i32* %4
%10 = icmp ne i32 %9, 3
br i1 %10, label %11, label %16
11: ; preds = %2
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 0
%14 = load i8*, i8** %13
%15 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %14)
br label %32
16: ; preds = %2
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 1
%19 = load i8*, i8** %18
store i8* %19, i8** %7
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 2
%22 = load i8*, i8** %21
store i8* %22, i8** %8
%23 = load i8*, i8** %7
%24 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i8* %23)
%25 = load i8*, i8** %7
%26 = load i8*, i8** %8
%27 = call i32 @brstub_new_object_validate(i8* %25, i8* %26)
store i32 %27, i32* %6
%28 = load i32, i32* %6
%29 = icmp slt i32 %28, 0
br i1 %29, label %30, label %31
30: ; preds = %16
br label %32
31: ; preds = %16
store i32 0, i32* %3
br label %33
32: ; preds = %30, %11
store i32 -1, i32* %3
br label %33
33: ; preds = %32, %31
%34 = load i32, i32* %3
ret i32 %34
}

LLVM IR (-O2):
@.str = [26 x i8] c"Usage: %s <path> <brick>\0A\00"
@.str.1 = [32 x i8] c"Validating object version [%s]\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 3
br i1 %3, label %7, label %4
4: ; preds = %2
%5 = load i8*, i8** %1
%6 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %5)
br label %15
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = getelementptr inbounds i8*, i8** %1, i64 2
%11 = load i8*, i8** %10
%12 = tail call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i8* %9)
%13 = tail call i32 @brstub_new_object_validate(i8* %9, i8* %11)
%14 = icmp slt i32 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %7, %4
br label %16
16: ; preds = %7, %15
%17 = phi i32 [ -1, %15 ], [ 0, %7 ]
ret i32 %17
}