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

/* Variables and functions */
int /*<<< orphan*/ cfile_free(struct cfile *);
struct cfile *cfile_init(char *);
int /*<<< orphan*/ require_args(int, char **, int, char *);
int parse_cmd(int argc, char **argv) {
  struct cfile *cfile;
  require_args(argc, argv, 1, "FILENAME");
  cfile = cfile_init(argv[1]);
  if (cfile)
    cfile_free(cfile);
  return !cfile;
}


x86 assembly (clang, -O0):
<parse_cmd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    $0x1,%edx
lea    0xeae(%rip),%rcx
call   1030 <require_args@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <cfile_init@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     117c <parse_cmd+0x4c>
mov    -0x18(%rbp),%rdi
call   1050 <cfile_free@plt>
cmpq   $0x0,-0x18(%rbp)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_cmd>:
push   %rbx
mov    %rsi,%rbx
lea    0xec5(%rip),%rcx
mov    $0x1,%edx
call   1030 <require_args@plt>
mov    0x8(%rbx),%rdi
call   1040 <cfile_init@plt>
mov    %rax,%rbx
test   %rax,%rax
je     115e <parse_cmd+0x2e>
mov    %rbx,%rdi
call   1050 <cfile_free@plt>
xor    %eax,%eax
test   %rbx,%rbx
sete   %al
pop    %rbx
ret

LLVM IR (-O0):
%struct.cfile = type { i32 }
@.str = [9 x i8] c"FILENAME\00"
define i32 @parse_cmd(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca %struct.cfile*
store i32 %0, i32* %3
store i8** %1, i8*** %4
%6 = load i32, i32* %3
%7 = load i8**, i8*** %4
%8 = call i32 @require_args(i32 %6, i8** %7, i32 1, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%9 = load i8**, i8*** %4
%10 = getelementptr inbounds i8*, i8** %9, i64 1
%11 = load i8*, i8** %10
%12 = call %struct.cfile* @cfile_init(i8* %11)
store %struct.cfile* %12, %struct.cfile** %5
%13 = load %struct.cfile*, %struct.cfile** %5
%14 = icmp ne %struct.cfile* %13, null
br i1 %14, label %15, label %18
15: ; preds = %2
%16 = load %struct.cfile*, %struct.cfile** %5
%17 = call i32 @cfile_free(%struct.cfile* %16)
br label %18
18: ; preds = %15, %2
%19 = load %struct.cfile*, %struct.cfile** %5
%20 = icmp ne %struct.cfile* %19, null
%21 = xor i1 %20, true
%22 = zext i1 %21 to i32
ret i32 %22
}

LLVM IR (-O2):
%struct.cfile = type { i32 }
@.str = [9 x i8] c"FILENAME\00"
define i32 @parse_cmd(i32 %0, i8** %1) {
%3 = tail call i32 @require_args(i32 %0, i8** %1, i32 1, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%4 = getelementptr inbounds i8*, i8** %1, i64 1
%5 = load i8*, i8** %4
%6 = tail call %struct.cfile* @cfile_init(i8* %5)
%7 = icmp eq %struct.cfile* %6, null
br i1 %7, label %10, label %8
8: ; preds = %2
%9 = tail call i32 @cfile_free(%struct.cfile* %6)
br label %10
10: ; preds = %8, %2
%11 = zext i1 %7 to i32
ret i32 %11
}