#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 *config_path(char const *);
int /*<<< orphan*/ cp(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, char *);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ printf(char *, char *, char *);
int /*<<< orphan*/ stderr;
int create_config(const char *base) {
  char *path;
  path = config_path(base);
  printf("copying %s to %s\n", "resources/config.ini", path);
  if (!cp("resources/config.ini", path)) {
    fprintf(stderr,
            "failed to copy default configuration(%s) "
            "to %s\n",
            "resources/config.ini", path);
    return 0;
  }
  free(path);
  return 1;
}


x86 assembly (clang, -O0):
<create_config>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <config_path@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdx
lea    0xe8c(%rip),%rdi
lea    0xe97(%rip),%rsi
call   1060 <printf@plt>
mov    -0x18(%rbp),%rsi
lea    0xe87(%rip),%rdi
call   1040 <cp@plt>
cmp    $0x0,%eax
jne    11c5 <create_config+0x75>
mov    0x2e40(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rcx
lea    0xe7a(%rip),%rsi
lea    0xe5e(%rip),%rdx
call   1070 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    11d5 <create_config+0x85>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_config>:
push   %r14
push   %rbx
push   %rax
call   1050 <config_path@plt>
mov    %rax,%rbx
lea    0xe9d(%rip),%rdi
lea    0xea8(%rip),%r14
mov    %r14,%rsi
mov    %rax,%rdx
call   1060 <printf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <cp@plt>
test   %eax,%eax
je     1193 <create_config+0x43>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    $0x1,%eax
jmp    11b4 <create_config+0x64>
mov    0x2e46(%rip),%rax
mov    (%rax),%edi
lea    0xe84(%rip),%rsi
lea    0xe68(%rip),%rdx
mov    %rbx,%rcx
call   1070 <fprintf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [18 x i8] c"copying %s to %s\0A\00"
@.str.1 = [21 x i8] c"resources/config.ini\00"
@stderr = global i32 0
@.str.2 = [48 x i8] c"failed to copy default configuration(%s) to %s\0A\00"
define i32 @create_config(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i8* @config_path(i8* %5)
store i8* %6, i8** %4
%7 = load i8*, i8** %4
%8 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8* %7)
%9 = load i8*, i8** %4
%10 = call i32 @cp(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8* %9)
%11 = icmp ne i32 %10, 0
br i1 %11, label %16, label %12
12: ; preds = %1
%13 = load i32, i32* @stderr
%14 = load i8*, i8** %4
%15 = call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8* %14)
store i32 0, i32* %2
br label %19
16: ; preds = %1
%17 = load i8*, i8** %4
%18 = call i32 @free(i8* %17)
store i32 1, i32* %2
br label %19
19: ; preds = %16, %12
%20 = load i32, i32* %2
ret i32 %20
}

LLVM IR (-O2):
@.str = [18 x i8] c"copying %s to %s\0A\00"
@.str.1 = [21 x i8] c"resources/config.ini\00"
@stderr = global i32 0
@.str.2 = [48 x i8] c"failed to copy default configuration(%s) to %s\0A\00"
define i32 @create_config(i8* %0) {
%2 = tail call i8* @config_path(i8* %0)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%4 = tail call i32 @cp(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load i32, i32* @stderr
%8 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8* %2)
br label %11
9: ; preds = %1
%10 = tail call i32 @free(i8* %2)
br label %11
11: ; preds = %9, %6
%12 = phi i32 [ 1, %9 ], [ 0, %6 ]
ret i32 %12
}