#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*/ errno;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ stderr;
char *strerror(int /*<<< orphan*/);
void createrc(char *f) {
  FILE *fp;
  if ((fp = fopen(f, "w")) == NULL) {
    fprintf(stderr, "Aget: couldn't create agetrc file %s: %s\n", f,
            strerror(errno));
    return;
  }
  fprintf(fp, "ftpanonymoususer = ftp\n");
  fprintf(fp, "ftpanonymouspass = aget@enderunix.org\n");
  fclose(fp);
}


x86 assembly (clang, -O0):
<createrc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xea9(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    11ac <createrc+0x6c>
mov    0x2e6f(%rip),%rax
movslq (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    0x2e51(%rip),%rax
mov    (%rax),%edi
call   1060 <strerror@plt>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    %rax,%rcx
lea    0xe62(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
jmp    11d9 <createrc+0x99>
mov    -0x10(%rbp),%rdi
lea    0xe75(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x10(%rbp),%rdi
lea    0xe7b(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<createrc>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
lea    0xea2(%rip),%rsi
call   1050 <fopen@plt>
test   %rax,%rax
je     11ac <createrc+0x5c>
mov    %rax,%rbx
lea    0xeba(%rip),%rdi
mov    $0x17,%esi
mov    $0x1,%edx
mov    %rax,%rcx
call   1060 <fwrite@plt>
lea    0xeb9(%rip),%rdi
mov    $0x26,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1060 <fwrite@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <fclose@plt>
mov    0x2e2d(%rip),%rax
movslq (%rax),%rbx
mov    0x2e1b(%rip),%rax
mov    (%rax),%edi
call   1070 <strerror@plt>
lea    0xe37(%rip),%rsi
mov    %rbx,%rdi
mov    %r14,%rdx
mov    %rax,%rcx
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <fprintf@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"w\00"
@stderr = global i32 0
@.str.1 = [42 x i8] c"Aget: couldn't create agetrc file %s: %s\0A\00"
@errno = global i32 0
@.str.2 = [24 x i8] c"ftpanonymoususer = ftp\0A\00"
@.str.3 = [39 x i8] c"ftpanonymouspass = aget@enderunix.org\0A\00"
define void @createrc(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32* @fopen(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %5, i32** %3
%6 = icmp eq i32* %5, null
br i1 %6, label %7, label %15
7: ; preds = %1
%8 = load i32, i32* @stderr
%9 = sext i32 %8 to i64
%10 = inttoptr i64 %9 to i32*
%11 = load i8*, i8** %2
%12 = load i32, i32* @errno
%13 = call i8* @strerror(i32 %12)
%14 = call i32 (i32*, i8*, ...) @fprintf(i32* %10, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0), i8* %11, i8* %13)
br label %22
15: ; preds = %1
%16 = load i32*, i32** %3
%17 = call i32 (i32*, i8*, ...) @fprintf(i32* %16, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
%18 = load i32*, i32** %3
%19 = call i32 (i32*, i8*, ...) @fprintf(i32* %18, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0))
%20 = load i32*, i32** %3
%21 = call i32 @fclose(i32* %20)
br label %22
22: ; preds = %15, %7
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"w\00"
@stderr = global i32 0
@.str.1 = [42 x i8] c"Aget: couldn't create agetrc file %s: %s\0A\00"
@errno = global i32 0
@.str.2 = [24 x i8] c"ftpanonymoususer = ftp\0A\00"
@.str.3 = [39 x i8] c"ftpanonymouspass = aget@enderunix.org\0A\00"
define void @createrc(i8* %0) {
%2 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i32* %2, null
br i1 %3, label %4, label %11
4: ; preds = %1
%5 = load i32, i32* @stderr
%6 = sext i32 %5 to i64
%7 = inttoptr i64 %6 to i32*
%8 = load i32, i32* @errno
%9 = tail call i8* @strerror(i32 %8)
%10 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %7, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0), i8* %0, i8* %9)
br label %15
11: ; preds = %1
%12 = tail call i64 @fwrite(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i64 23, i64 1, i32* %2)
%13 = tail call i64 @fwrite(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0), i64 38, i64 1, i32* %2)
%14 = tail call i32 @fclose(i32* %2)
br label %15
15: ; preds = %11, %4
ret void
}