#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 */
char *getenv(char *);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ parse_options(char *, int *);
int /*<<< orphan*/ snprintf(char *, int, char *, char *, char *, char *);
int get_local_defaults(char *label) {
  int ret = 0;
  char name[1024];
  memset(name, 0, 1024);
  char *user_home_dir = getenv("HOME");
  snprintf(name, 1024, "%s/%s/%s.conf", user_home_dir, ".getdns", label);
  parse_options(name, &ret);
  return ret;
}


x86 assembly (clang, -O0):
<get_local_defaults>:
push   %rbp
mov    %rsp,%rbp
sub    $0x420,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
lea    -0x410(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1060 <memset@plt>
lea    0xe90(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x418(%rbp)
lea    -0x410(%rbp),%rdi
mov    -0x418(%rbp),%rcx
mov    -0x8(%rbp),%r9
mov    $0x400,%esi
lea    0xe6b(%rip),%rdx
lea    0xe72(%rip),%r8
call   1050 <snprintf@plt>
lea    -0x410(%rbp),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <parse_options@plt>
mov    -0xc(%rbp),%eax
add    $0x420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_local_defaults>:
push   %r14
push   %rbx
sub    $0x418,%rsp
mov    %rdi,%rbx
movl   $0x0,0xc(%rsp)
lea    0x10(%rsp),%r14
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1060 <memset@plt>
lea    0xe90(%rip),%rdi
call   1030 <getenv@plt>
lea    0xe89(%rip),%rdx
lea    0xe90(%rip),%r8
mov    %r14,%rdi
mov    $0x400,%esi
mov    %rax,%rcx
mov    %rbx,%r9
call   1050 <snprintf@plt>
lea    0xc(%rsp),%rsi
mov    %r14,%rdi
call   1040 <parse_options@plt>
mov    0xc(%rsp),%eax
add    $0x418,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [5 x i8] c"HOME\00"
@.str.1 = [14 x i8] c"%s/%s/%s.conf\00"
@.str.2 = [8 x i8] c".getdns\00"
define i32 @get_local_defaults(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca [1024 x i8]
%5 = alloca i8*
store i8* %0, i8** %2
store i32 0, i32* %3
%6 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%7 = call i32 @memset(i8* %6, i32 0, i32 1024)
%8 = call i8* @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
store i8* %8, i8** %5
%9 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%10 = load i8*, i8** %5
%11 = load i8*, i8** %2
%12 = call i32 @snprintf(i8* %9, i32 1024, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* %10, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* %11)
%13 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%14 = call i32 @parse_options(i8* %13, i32* %3)
%15 = load i32, i32* %3
ret i32 %15
}

LLVM IR (-O2):
@.str = [5 x i8] c"HOME\00"
@.str.1 = [14 x i8] c"%s/%s/%s.conf\00"
@.str.2 = [8 x i8] c".getdns\00"
define i32 @get_local_defaults(i8* %0) {
%2 = alloca i32
%3 = alloca [1024 x i8]
%4 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%5 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%6 = call i32 @memset(i8* %5, i32 0, i32 1024)
%7 = call i8* @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @snprintf(i8* %5, i32 1024, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* %7, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* %0)
%9 = call i32 @parse_options(i8* %5, i32* %2)
%10 = load i32, i32* %2
ret i32 %10
}