#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__ parse_input(int, char **);
int /*<<< orphan*/ printf(char *);
scalar_t__ process_img();
int main(int argc, char **argv) {
  int ret = 1;
  if (parse_input(argc, argv))
    return 1;
  if (0 == process_img()) {
    printf("\nwe done!\n");
    ret = 0;
  } else
    printf("\nwe failed\n");
  return ret;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1050 <parse_input@plt>
cmp    $0x0,%rax
je     116f <main+0x3f>
movl   $0x1,-0x4(%rbp)
jmp    11ae <main+0x7e>
mov    $0x0,%al
call   1040 <process_img@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jne    119c <main+0x6c>
lea    0xe75(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x14(%rbp)
jmp    11a8 <main+0x78>
lea    0xe68(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
call   1050 <parse_input@plt>
mov    $0x1,%ebx
test   %rax,%rax
jne    1166 <main+0x36>
xor    %eax,%eax
call   1040 <process_img@plt>
xor    %ebx,%ebx
test   %rax,%rax
setne  %bl
lea    0xeb5(%rip),%rax
lea    0xea3(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [11 x i8] c"\0Awe done!\0A\00"
@.str.1 = [12 x i8] c"\0Awe failed\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1, i32* %6
%7 = load i32, i32* %4
%8 = load i8**, i8*** %5
%9 = call i64 @parse_input(i32 %7, i8** %8)
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %2
store i32 1, i32* %3
br label %21
12: ; preds = %2
%13 = call i64 (...) @process_img()
%14 = icmp eq i64 0, %13
br i1 %14, label %15, label %17
15: ; preds = %12
%16 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %6
br label %19
17: ; preds = %12
%18 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
br label %19
19: ; preds = %17, %15
%20 = load i32, i32* %6
store i32 %20, i32* %3
br label %21
21: ; preds = %19, %11
%22 = load i32, i32* %3
ret i32 %22
}

LLVM IR (-O2):
@str = [11 x i8] c"\0Awe failed\00"
@str.2 = [10 x i8] c"\0Awe done!\00"
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i64 @parse_input(i32 %0, i8** %1)
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %12
5: ; preds = %2
%6 = tail call i64 (...) @process_img()
%7 = icmp eq i64 %6, 0
%8 = select i1 %7, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @str.2, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0)
%9 = xor i1 %7, true
%10 = zext i1 %9 to i32
%11 = tail call i32 @puts(i8* dereferenceable(1) %8)
br label %12
12: ; preds = %5, %2
%13 = phi i32 [ 1, %2 ], [ %10, %5 ]
ret i32 %13
}