#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 *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, double, double);
int /*<<< orphan*/ print_error_global(char *, char *, int /*<<< orphan*/);
void write_DIC(char *file_data, double deviance, double DIC) {
  FILE *file = NULL;
  file = fopen(file_data, "a");
  if (!file)
    print_error_global("open", file_data, 0);
  fprintf(file, "Deviance DIC\n", deviance, DIC);
  fprintf(file, "%G %G\n", deviance, DIC);
  fclose(file);
}


x86 assembly (clang, -O0):
<write_DIC>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe97(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    118f <write_DIC+0x4f>
mov    -0x8(%rbp),%rsi
lea    0xe7a(%rip),%rdi
xor    %edx,%edx
call   1060 <print_error_global@plt>
mov    -0x20(%rbp),%rdi
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
lea    0xe63(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x20(%rbp),%rdi
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
lea    0xe57(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x20(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_DIC>:
push   %r14
push   %rbx
sub    $0x18,%rsp
movsd  %xmm1,0x10(%rsp)
movsd  %xmm0,0x8(%rsp)
mov    %rdi,%r14
lea    0xea3(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    117b <write_DIC+0x3b>
lea    0xe91(%rip),%rdi
mov    %r14,%rsi
xor    %edx,%edx
call   1060 <print_error_global@plt>
lea    0xe85(%rip),%rsi
mov    %rbx,%rdi
movsd  0x8(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
call   1040 <fprintf@plt>
lea    0xe78(%rip),%rsi
mov    %rbx,%rdi
movsd  0x8(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
call   1040 <fprintf@plt>
mov    %rbx,%rdi
add    $0x18,%rsp
pop    %rbx
pop    %r14
jmp    1030 <fclose@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"a\00"
@.str.1 = [5 x i8] c"open\00"
@.str.2 = [14 x i8] c"Deviance DIC\0A\00"
@.str.3 = [7 x i8] c"%G %G\0A\00"
define void @write_DIC(i8* %0, double %1, double %2) {
%4 = alloca i8*
%5 = alloca double
%6 = alloca double
%7 = alloca i32*
store i8* %0, i8** %4
store double %1, double* %5
store double %2, double* %6
store i32* null, i32** %7
%8 = load i8*, i8** %4
%9 = call i32* @fopen(i8* %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %9, i32** %7
%10 = load i32*, i32** %7
%11 = icmp ne i32* %10, null
br i1 %11, label %15, label %12
12: ; preds = %3
%13 = load i8*, i8** %4
%14 = call i32 @print_error_global(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %13, i32 0)
br label %15
15: ; preds = %12, %3
%16 = load i32*, i32** %7
%17 = load double, double* %5
%18 = load double, double* %6
%19 = call i32 @fprintf(i32* %16, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), double %17, double %18)
%20 = load i32*, i32** %7
%21 = load double, double* %5
%22 = load double, double* %6
%23 = call i32 @fprintf(i32* %20, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), double %21, double %22)
%24 = load i32*, i32** %7
%25 = call i32 @fclose(i32* %24)
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"a\00"
@.str.1 = [5 x i8] c"open\00"
@.str.2 = [14 x i8] c"Deviance DIC\0A\00"
@.str.3 = [7 x i8] c"%G %G\0A\00"
define void @write_DIC(i8* %0, double %1, double %2) {
%4 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i32* %4, null
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = tail call i32 @print_error_global(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %0, i32 0)
br label %8
8: ; preds = %6, %3
%9 = tail call i32 @fprintf(i32* %4, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), double %1, double %2)
%10 = tail call i32 @fprintf(i32* %4, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), double %1, double %2)
%11 = tail call i32 @fclose(i32* %4)
ret void
}