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

/* Variables and functions */
int /*<<< orphan*/ config_init(struct config_t *);
scalar_t__ config_validate(struct config_t *);
scalar_t__ parse_args(struct config_t *, int, char **);
int setup(struct config_t *config, int argc, char **argv) {
  config_init(config);
  if (parse_args(config, argc, argv) != 0)
    return -1;
  if (config_validate(config) != 0)
    return -1;
  return 0;
}


x86 assembly (clang, -O0):
<setup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <config_init@plt>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x20(%rbp),%rdx
call   1050 <parse_args@plt>
cmp    $0x0,%rax
je     1172 <setup+0x42>
movl   $0xffffffff,-0x4(%rbp)
jmp    1198 <setup+0x68>
mov    -0x10(%rbp),%rdi
call   1030 <config_validate@plt>
cmp    $0x0,%rax
je     1191 <setup+0x61>
movl   $0xffffffff,-0x4(%rbp)
jmp    1198 <setup+0x68>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setup>:
push   %rbp
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %esi,%ebp
mov    %rdi,%rbx
call   1040 <config_init@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %r14,%rdx
call   1050 <parse_args@plt>
mov    %rax,%rcx
mov    $0xffffffff,%eax
test   %rcx,%rcx
jne    1168 <setup+0x38>
mov    %rbx,%rdi
call   1030 <config_validate@plt>
neg    %rax
sbb    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.config_t = type { i32 }
define i32 @setup(%struct.config_t* %0, i32 %1, i8** %2) {
%4 = alloca i32
%5 = alloca %struct.config_t*
%6 = alloca i32
%7 = alloca i8**
store %struct.config_t* %0, %struct.config_t** %5
store i32 %1, i32* %6
store i8** %2, i8*** %7
%8 = load %struct.config_t*, %struct.config_t** %5
%9 = call i32 @config_init(%struct.config_t* %8)
%10 = load %struct.config_t*, %struct.config_t** %5
%11 = load i32, i32* %6
%12 = load i8**, i8*** %7
%13 = call i64 @parse_args(%struct.config_t* %10, i32 %11, i8** %12)
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %3
store i32 -1, i32* %4
br label %22
16: ; preds = %3
%17 = load %struct.config_t*, %struct.config_t** %5
%18 = call i64 @config_validate(%struct.config_t* %17)
%19 = icmp ne i64 %18, 0
br i1 %19, label %20, label %21
20: ; preds = %16
store i32 -1, i32* %4
br label %22
21: ; preds = %16
store i32 0, i32* %4
br label %22
22: ; preds = %21, %20, %15
%23 = load i32, i32* %4
ret i32 %23
}

LLVM IR (-O2):
%struct.config_t = type { i32 }
define i32 @setup(%struct.config_t* %0, i32 %1, i8** %2) {
%4 = tail call i32 @config_init(%struct.config_t* %0)
%5 = tail call i64 @parse_args(%struct.config_t* %0, i32 %1, i8** %2)
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %11
7: ; preds = %3
%8 = tail call i64 @config_validate(%struct.config_t* %0)
%9 = icmp ne i64 %8, 0
%10 = sext i1 %9 to i32
br label %11
11: ; preds = %7, %3
%12 = phi i32 [ -1, %3 ], [ %10, %7 ]
ret i32 %12
}