#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__ archive_files(char const **);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
scalar_t__ output_archive(char const *);
scalar_t__ setup_archive(int, char const **);
int /*<<< orphan*/ stderr;
int cmd_create(const char *archive_path, int count, const char **files) {
  if (count < 1 || !files) {
    fprintf(stderr, "Error: no input files specified\n");
    return -1;
  }
  if (setup_archive(count, files))
    return -1;
  if (archive_files(files))
    return -1;
  if (output_archive(archive_path))
    return -1;
  return 0;
}


x86 assembly (clang, -O0):
<cmd_create>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
cmpl   $0x1,-0x14(%rbp)
jl     1168 <cmd_create+0x28>
cmpq   $0x0,-0x20(%rbp)
jne    1189 <cmd_create+0x49>
mov    0x2e71(%rip),%rax
mov    (%rax),%edi
lea    0xe88(%rip),%rsi
call   1040 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11f0 <cmd_create+0xb0>
mov    -0x14(%rbp),%edi
mov    -0x20(%rbp),%rsi
call   1060 <setup_archive@plt>
cmp    $0x0,%rax
je     11ab <cmd_create+0x6b>
movl   $0xffffffff,-0x4(%rbp)
jmp    11f0 <cmd_create+0xb0>
mov    -0x20(%rbp),%rdi
call   1030 <archive_files@plt>
cmp    $0x0,%rax
je     11ca <cmd_create+0x8a>
movl   $0xffffffff,-0x4(%rbp)
jmp    11f0 <cmd_create+0xb0>
mov    -0x10(%rbp),%rdi
call   1050 <output_archive@plt>
cmp    $0x0,%rax
je     11e9 <cmd_create+0xa9>
movl   $0xffffffff,-0x4(%rbp)
jmp    11f0 <cmd_create+0xb0>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmd_create>:
push   %rbp
push   %r14
push   %rbx
test   %esi,%esi
jle    1183 <cmd_create+0x43>
mov    %rdx,%rbx
test   %rdx,%rdx
je     1183 <cmd_create+0x43>
mov    %rdi,%r14
mov    %esi,%edi
mov    %rbx,%rsi
call   1060 <setup_archive@plt>
mov    $0xffffffff,%ebp
test   %rax,%rax
jne    119d <cmd_create+0x5d>
mov    %rbx,%rdi
call   1030 <archive_files@plt>
test   %rax,%rax
jne    119d <cmd_create+0x5d>
mov    %r14,%rdi
call   1050 <output_archive@plt>
neg    %rax
sbb    %ebp,%ebp
jmp    119d <cmd_create+0x5d>
mov    0x2e56(%rip),%rax
mov    (%rax),%edi
lea    0xe6d(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0xffffffff,%ebp
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [33 x i8] c"Error: no input files specified\0A\00"
define i32 @cmd_create(i8* %0, i32 %1, i8** %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8**
store i8* %0, i8** %5
store i32 %1, i32* %6
store i8** %2, i8*** %7
%8 = load i32, i32* %6
%9 = icmp slt i32 %8, 1
br i1 %9, label %13, label %10
10: ; preds = %3
%11 = load i8**, i8*** %7
%12 = icmp ne i8** %11, null
br i1 %12, label %16, label %13
13: ; preds = %10, %3
%14 = load i32, i32* @stderr
%15 = call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %4
br label %33
16: ; preds = %10
%17 = load i32, i32* %6
%18 = load i8**, i8*** %7
%19 = call i64 @setup_archive(i32 %17, i8** %18)
%20 = icmp ne i64 %19, 0
br i1 %20, label %21, label %22
21: ; preds = %16
store i32 -1, i32* %4
br label %33
22: ; preds = %16
%23 = load i8**, i8*** %7
%24 = call i64 @archive_files(i8** %23)
%25 = icmp ne i64 %24, 0
br i1 %25, label %26, label %27
26: ; preds = %22
store i32 -1, i32* %4
br label %33
27: ; preds = %22
%28 = load i8*, i8** %5
%29 = call i64 @output_archive(i8* %28)
%30 = icmp ne i64 %29, 0
br i1 %30, label %31, label %32
31: ; preds = %27
store i32 -1, i32* %4
br label %33
32: ; preds = %27
store i32 0, i32* %4
br label %33
33: ; preds = %32, %31, %26, %21, %13
%34 = load i32, i32* %4
ret i32 %34
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [33 x i8] c"Error: no input files specified\0A\00"
define i32 @cmd_create(i8* %0, i32 %1, i8** %2) {
%4 = icmp sgt i32 %1, 0
%5 = icmp ne i8** %2, null
%6 = and i1 %4, %5
br i1 %6, label %10, label %7
7: ; preds = %3
%8 = load i32, i32* @stderr
%9 = tail call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
br label %20
10: ; preds = %3
%11 = tail call i64 @setup_archive(i32 %1, i8** %2)
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %20
13: ; preds = %10
%14 = tail call i64 @archive_files(i8** %2)
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %20
16: ; preds = %13
%17 = tail call i64 @output_archive(i8* %0)
%18 = icmp ne i64 %17, 0
%19 = sext i1 %18 to i32
br label %20
20: ; preds = %16, %13, %10, %7
%21 = phi i32 [ -1, %7 ], [ -1, %10 ], [ -1, %13 ], [ %19, %16 ]
ret i32 %21
}