#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*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ errno;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, char *);
int /*<<< orphan*/ get_home_directory();
int /*<<< orphan*/ stderr;
char *strcat(int /*<<< orphan*/, char *);
char *strerror(int /*<<< orphan*/);
int open_config_file(void) {
  FILE *config_file;
  char c;
  if ((config_file =
           fopen(strcat(get_home_directory(), "/.shell_init"), "r")) == NULL) {
    fprintf(stderr, "Error: Can't open file %s; %s\n",
            strcat(get_home_directory(), "/.shell_init"), strerror(errno));
    exit(EXIT_FAILURE);
  }
}


x86 assembly (clang, -O0):
<open_config_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    $0x0,%al
call   1060 <get_home_directory@plt>
mov    %eax,%edi
lea    0xe88(%rip),%rsi
call   1050 <strcat@plt>
mov    %rax,%rdi
lea    0xe86(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    11f1 <open_config_file+0x91>
mov    0x2e3f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x24(%rbp)
mov    $0x0,%al
call   1060 <get_home_directory@plt>
mov    %eax,%edi
lea    0xe4a(%rip),%rsi
call   1050 <strcat@plt>
mov    %rax,-0x20(%rbp)
mov    0x2e12(%rip),%rax
mov    (%rax),%edi
call   1080 <strerror@plt>
mov    -0x24(%rbp),%edi
mov    -0x20(%rbp),%rdx
mov    %rax,%rcx
lea    0xe31(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2de6(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<open_config_file>:
push   %rbp
push   %rbx
push   %rax
xor    %eax,%eax
call   1060 <get_home_directory@plt>
lea    0xe8f(%rip),%rsi
mov    %eax,%edi
call   1050 <strcat@plt>
lea    0xe8e(%rip),%rsi
mov    %rax,%rdi
call   1040 <fopen@plt>
test   %rax,%rax
je     1193 <open_config_file+0x33>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
mov    0x2e46(%rip),%rax
mov    (%rax),%ebp
xor    %eax,%eax
call   1060 <get_home_directory@plt>
lea    0xe56(%rip),%rsi
mov    %eax,%edi
call   1050 <strcat@plt>
mov    %rax,%rbx
mov    0x2e1d(%rip),%rax
mov    (%rax),%edi
call   1080 <strerror@plt>
lea    0xe46(%rip),%rsi
mov    %ebp,%edi
mov    %rbx,%rdx
mov    %rax,%rcx
call   1030 <fprintf@plt>
mov    0x2df3(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"/.shell_init\00"
@.str.1 = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.2 = [31 x i8] c"Error: Can't open file %s; %s\0A\00"
@errno = global i32 0
@EXIT_FAILURE = global i32 0
define i32 @open_config_file() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i8
%4 = call i32 (...) @get_home_directory()
%5 = call i8* @strcat(i32 %4, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%6 = call i32* @fopen(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %6, i32** %2
%7 = icmp eq i32* %6, null
br i1 %7, label %8, label %17
8: ; preds = %0
%9 = load i32, i32* @stderr
%10 = call i32 (...) @get_home_directory()
%11 = call i8* @strcat(i32 %10, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%12 = load i32, i32* @errno
%13 = call i8* @strerror(i32 %12)
%14 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i8* %11, i8* %13)
%15 = load i32, i32* @EXIT_FAILURE
%16 = call i32 @exit(i32 %15)
unreachable
17: ; preds = %0
%18 = load i32, i32* %1
ret i32 %18
}

LLVM IR (-O2):
@.str = [13 x i8] c"/.shell_init\00"
@.str.1 = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.2 = [31 x i8] c"Error: Can't open file %s; %s\0A\00"
@errno = global i32 0
@EXIT_FAILURE = global i32 0
define i32 @open_config_file() {
%1 = tail call i32 (...) @get_home_directory()
%2 = tail call i8* @strcat(i32 %1, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32* @fopen(i8* %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%4 = icmp eq i32* %3, null
br i1 %4, label %5, label %14
5: ; preds = %0
%6 = load i32, i32* @stderr
%7 = tail call i32 (...) @get_home_directory()
%8 = tail call i8* @strcat(i32 %7, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%9 = load i32, i32* @errno
%10 = tail call i8* @strerror(i32 %9)
%11 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i8* %8, i8* %10)
%12 = load i32, i32* @EXIT_FAILURE
%13 = tail call i32 @exit(i32 %12)
unreachable
14: ; preds = %0
ret i32 undef
}