#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 uci_package {
  int dummy;
};
struct uci_context {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ parse_sections(struct uci_package *);
struct uci_context *uci_alloc_context();
int /*<<< orphan*/ uci_free_context(struct uci_context *);
int /*<<< orphan*/ uci_load(struct uci_context *, char const *,
                            struct uci_package **);
int /*<<< orphan*/ uci_perror(struct uci_context *, char *);
void read_conf_uci(const char *name) {
  struct uci_context *ctx;
  struct uci_package *p = NULL;
  ctx = uci_alloc_context();
  if (!ctx)
    return;
  uci_load(ctx, name, &p);
  if (!p) {
    uci_perror(ctx, "Failed to load config file: ");
    uci_free_context(ctx);
    exit(-1);
  }
  parse_sections(p);
  uci_free_context(ctx);
}


x86 assembly (clang, -O0):
<read_conf_uci>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x18(%rbp)
mov    $0x0,%al
call   1050 <uci_alloc_context@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    118f <read_conf_uci+0x2f>
jmp    11e0 <read_conf_uci+0x80>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
lea    -0x18(%rbp),%rdx
call   1060 <uci_load@plt>
cmpq   $0x0,-0x18(%rbp)
jne    11ce <read_conf_uci+0x6e>
mov    -0x10(%rbp),%rdi
lea    0xe4a(%rip),%rsi
call   1030 <uci_perror@plt>
mov    -0x10(%rbp),%rdi
call   1040 <uci_free_context@plt>
mov    $0xffffffff,%edi
call   1080 <exit@plt>
mov    -0x18(%rbp),%rdi
call   1070 <parse_sections@plt>
mov    -0x10(%rbp),%rdi
call   1040 <uci_free_context@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_conf_uci>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
movq   $0x0,(%rsp)
xor    %eax,%eax
call   1050 <uci_alloc_context@plt>
test   %rax,%rax
je     11a2 <read_conf_uci+0x42>
mov    %rax,%rbx
mov    %rsp,%rdx
mov    %rax,%rdi
mov    %r14,%rsi
call   1060 <uci_load@plt>
mov    (%rsp),%rdi
test   %rdi,%rdi
je     11aa <read_conf_uci+0x4a>
call   1070 <parse_sections@plt>
mov    %rbx,%rdi
call   1040 <uci_free_context@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
lea    0xe4f(%rip),%rsi
mov    %rbx,%rdi
call   1030 <uci_perror@plt>
mov    %rbx,%rdi
call   1040 <uci_free_context@plt>
mov    $0xffffffff,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
%struct.uci_context = type { i32 }
%struct.uci_package = type { i32 }
@.str = [29 x i8] c"Failed to load config file: \00"
define void @read_conf_uci(i8* %0) {
%2 = alloca i8*
%3 = alloca %struct.uci_context*
%4 = alloca %struct.uci_package*
store i8* %0, i8** %2
store %struct.uci_package* null, %struct.uci_package** %4
%5 = call %struct.uci_context* (...) @uci_alloc_context()
store %struct.uci_context* %5, %struct.uci_context** %3
%6 = load %struct.uci_context*, %struct.uci_context** %3
%7 = icmp ne %struct.uci_context* %6, null
br i1 %7, label %9, label %8
8: ; preds = %1
br label %26
9: ; preds = %1
%10 = load %struct.uci_context*, %struct.uci_context** %3
%11 = load i8*, i8** %2
%12 = call i32 @uci_load(%struct.uci_context* %10, i8* %11, %struct.uci_package** %4)
%13 = load %struct.uci_package*, %struct.uci_package** %4
%14 = icmp ne %struct.uci_package* %13, null
br i1 %14, label %21, label %15
15: ; preds = %9
%16 = load %struct.uci_context*, %struct.uci_context** %3
%17 = call i32 @uci_perror(%struct.uci_context* %16, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%18 = load %struct.uci_context*, %struct.uci_context** %3
%19 = call i32 @uci_free_context(%struct.uci_context* %18)
%20 = call i32 @exit(i32 -1)
unreachable
21: ; preds = %9
%22 = load %struct.uci_package*, %struct.uci_package** %4
%23 = call i32 @parse_sections(%struct.uci_package* %22)
%24 = load %struct.uci_context*, %struct.uci_context** %3
%25 = call i32 @uci_free_context(%struct.uci_context* %24)
br label %26
26: ; preds = %21, %8
ret void
}

LLVM IR (-O2):
%struct.uci_package = type { i32 }
%struct.uci_context = type { i32 }
@.str = [29 x i8] c"Failed to load config file: \00"
define void @read_conf_uci(i8* %0) {
%2 = alloca %struct.uci_package*
%3 = bitcast %struct.uci_package** %2 to i8*
store %struct.uci_package* null, %struct.uci_package** %2
%4 = tail call %struct.uci_context* (...) @uci_alloc_context()
%5 = icmp eq %struct.uci_context* %4, null
br i1 %5, label %17, label %6
6: ; preds = %1
%7 = call i32 @uci_load(%struct.uci_context* %4, i8* %0, %struct.uci_package** %2)
%8 = load %struct.uci_package*, %struct.uci_package** %2
%9 = icmp eq %struct.uci_package* %8, null
br i1 %9, label %10, label %14
10: ; preds = %6
%11 = call i32 @uci_perror(%struct.uci_context* %4, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @uci_free_context(%struct.uci_context* %4)
%13 = call i32 @exit(i32 -1)
unreachable
14: ; preds = %6
%15 = call i32 @parse_sections(%struct.uci_package* %8)
%16 = call i32 @uci_free_context(%struct.uci_context* %4)
br label %17
17: ; preds = %1, %14
ret void
}