#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 */
typedef int /*<<< orphan*/ fn;

/* Variables and functions */
int /*<<< orphan*/ __load_options(char *);
char *getenv(char *);
int /*<<< orphan*/ snprintf(char *, int, char *, char *);
int load_options(void) {
  char fn[256];
  __load_options("/etc/miniphone.conf");
  if (getenv("HOME")) {
    snprintf(fn, sizeof(fn), "%s/.miniphone-conf", getenv("HOME"));
    __load_options(fn);
  }
  return 0;
}


x86 assembly (clang, -O0):
<load_options>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
lea    0xebe(%rip),%rdi
call   1050 <__load_options@plt>
lea    0xec6(%rip),%rdi
call   1030 <getenv@plt>
cmp    $0x0,%rax
je     119e <load_options+0x6e>
lea    -0x100(%rbp),%rax
mov    %rax,-0x108(%rbp)
lea    0xea2(%rip),%rdi
call   1030 <getenv@plt>
mov    -0x108(%rbp),%rdi
mov    %rax,%rcx
mov    $0x100,%esi
lea    0xe8c(%rip),%rdx
call   1040 <snprintf@plt>
lea    -0x100(%rbp),%rdi
call   1050 <__load_options@plt>
xor    %eax,%eax
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<load_options>:
push   %rbx
sub    $0x100,%rsp
lea    0xec1(%rip),%rdi
call   1050 <__load_options@plt>
lea    0xec9(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     1177 <load_options+0x47>
lea    0xebd(%rip),%rdx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x100,%esi
mov    %rax,%rcx
call   1040 <snprintf@plt>
mov    %rbx,%rdi
call   1050 <__load_options@plt>
xor    %eax,%eax
add    $0x100,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [20 x i8] c"/etc/miniphone.conf\00"
@.str.1 = [5 x i8] c"HOME\00"
@.str.2 = [19 x i8] c"%s/.miniphone-conf\00"
define i32 @load_options() {
%1 = alloca [256 x i8]
%2 = call i32 @__load_options(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%3 = call i8* @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%4 = icmp ne i8* %3, null
br i1 %4, label %5, label %11
5: ; preds = %0
%6 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%7 = call i8* @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @snprintf(i8* %6, i32 256, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i8* %7)
%9 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%10 = call i32 @__load_options(i8* %9)
br label %11
11: ; preds = %5, %0
ret i32 0
}

LLVM IR (-O2):
@.str = [20 x i8] c"/etc/miniphone.conf\00"
@.str.1 = [5 x i8] c"HOME\00"
@.str.2 = [19 x i8] c"%s/.miniphone-conf\00"
define i32 @load_options() {
%1 = alloca [256 x i8]
%2 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @__load_options(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%4 = tail call i8* @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%5 = icmp eq i8* %4, null
br i1 %5, label %9, label %6
6: ; preds = %0
%7 = call i32 @snprintf(i8* %2, i32 256, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i8* %4)
%8 = call i32 @__load_options(i8* %2)
br label %9
9: ; preds = %6, %0
ret i32 0
}