#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*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *, char *, char *,
                           char *, char const *, char *, char *);
int MakeNewPrefsFile(const char *path, const char *entry) {
  char filebuf[1000];
  FILE *f;
  f = fopen(path, "wb");
  if (f == NULL)
    return -1;
  fprintf(f, "%s%s%s%s%s%s%s", "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n",
          "<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" "
          "\"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n",
          "<plist version=\"1.0\">\n", "<dict>\n", entry, "</dict>\n",
          "</plist>\n");
  fclose(f);
  return 0;
}


x86 assembly (clang, -O0):
<MakeNewPrefsFile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x420,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xeb2(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x408(%rbp)
cmpq   $0x0,-0x408(%rbp)
jne    1174 <MakeNewPrefsFile+0x44>
movl   $0xffffffff,-0x4(%rbp)
jmp    11d6 <MakeNewPrefsFile+0xa6>
mov    -0x408(%rbp),%rdi
mov    -0x18(%rbp),%r11
lea    0xe7d(%rip),%rsi
lea    0xe85(%rip),%rdx
lea    0xea6(%rip),%rcx
lea    0xf10(%rip),%r8
lea    0xf20(%rip),%r9
lea    0xf21(%rip),%r10
lea    0xf23(%rip),%rax
mov    %r11,(%rsp)
mov    %r10,0x8(%rsp)
mov    %rax,0x10(%rsp)
call   1040 <fprintf@plt>
mov    -0x408(%rbp),%rdi
call   1030 <fclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MakeNewPrefsFile>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
lea    0xec2(%rip),%rsi
call   1050 <fopen@plt>
test   %rax,%rax
je     119d <MakeNewPrefsFile+0x6d>
mov    %rax,%rbx
sub    $0x8,%rsp
lea    0xf7d(%rip),%rax
lea    0xf6d(%rip),%r10
lea    0xe9f(%rip),%rsi
lea    0xea7(%rip),%rdx
lea    0xec8(%rip),%rcx
lea    0xf32(%rip),%r8
lea    0xf42(%rip),%r9
mov    %rbx,%rdi
push   %rax
push   %r10
push   %r14
call   1040 <fprintf@plt>
add    $0x20,%rsp
mov    %rbx,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
jmp    11a2 <MakeNewPrefsFile+0x72>
mov    $0xffffffff,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c"wb\00"
@.str.1 = [15 x i8] c"%s%s%s%s%s%s%s\00"
@.str.2 = [40 x i8] c"<?xml version=\221.0\22 encoding=\22UTF-8\22?>\0A\00"
@.str.3 = [113 x i8] c"<!DOCTYPE plist PUBLIC \22-//Apple Computer//DTD PLIST 1.0//EN\22 \22http://www.apple.com/DTDs/PropertyList-1.0.dtd\22>\0A\00"
@.str.4 = [23 x i8] c"<plist version=\221.0\22>\0A\00"
@.str.5 = [8 x i8] c"<dict>\0A\00"
@.str.6 = [9 x i8] c"</dict>\0A\00"
@.str.7 = [10 x i8] c"</plist>\0A\00"
define i32 @MakeNewPrefsFile(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca [1000 x i8]
%7 = alloca i32*
store i8* %0, i8** %4
store i8* %1, i8** %5
%8 = load i8*, i8** %4
%9 = call i32* @fopen(i8* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32* %9, i32** %7
%10 = load i32*, i32** %7
%11 = icmp eq i32* %10, null
br i1 %11, label %12, label %13
12: ; preds = %2
store i32 -1, i32* %3
br label %19
13: ; preds = %2
%14 = load i32*, i32** %7
%15 = load i8*, i8** %5
%16 = call i32 @fprintf(i32* %14, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([113 x i8], [113 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i8* %15, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0))
%17 = load i32*, i32** %7
%18 = call i32 @fclose(i32* %17)
store i32 0, i32* %3
br label %19
19: ; preds = %13, %12
%20 = load i32, i32* %3
ret i32 %20
}

LLVM IR (-O2):
@.str = [3 x i8] c"wb\00"
@.str.1 = [15 x i8] c"%s%s%s%s%s%s%s\00"
@.str.2 = [40 x i8] c"<?xml version=\221.0\22 encoding=\22UTF-8\22?>\0A\00"
@.str.3 = [113 x i8] c"<!DOCTYPE plist PUBLIC \22-//Apple Computer//DTD PLIST 1.0//EN\22 \22http://www.apple.com/DTDs/PropertyList-1.0.dtd\22>\0A\00"
@.str.4 = [23 x i8] c"<plist version=\221.0\22>\0A\00"
@.str.5 = [8 x i8] c"<dict>\0A\00"
@.str.6 = [9 x i8] c"</dict>\0A\00"
@.str.7 = [10 x i8] c"</plist>\0A\00"
define i32 @MakeNewPrefsFile(i8* nocapture %0, i8* %1) {
%3 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i32* %3, null
br i1 %4, label %8, label %5
5: ; preds = %2
%6 = tail call i32 @fprintf(i32* %3, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([113 x i8], [113 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i8* %1, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0))
%7 = tail call i32 @fclose(i32* %3)
br label %8
8: ; preds = %2, %5
%9 = phi i32 [ 0, %5 ], [ -1, %2 ]
ret i32 %9
}