#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 */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
int write_result(char *, char *, int, int, double *, int, double);
void finalization(char *file_in, int total_iters, double residual_ratio,
                  int nintci, int nintcf, double *var, double *cgup,
                  double *su) {
  char file_out[30] = "summary.out";
  int status = write_result(file_in, file_out, nintci, nintcf, var, total_iters,
                            residual_ratio);
  if (status != 0)
    fprintf(stderr, "Error when trying to write to file %s\n", file_out);
}


x86 assembly (clang, -O0):
<finalization>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movsd  %xmm0,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %ecx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    0xeb3(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    0xeb0(%rip),%rax
mov    %rax,-0x48(%rbp)
mov    0xead(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xeab(%rip),%eax
mov    %eax,-0x38(%rbp)
mov    0xea5(%rip),%ax
mov    %ax,-0x34(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x50(%rbp),%rsi
mov    -0x1c(%rbp),%edx
mov    -0x20(%rbp),%ecx
mov    -0x28(%rbp),%r8
mov    -0xc(%rbp),%r9d
movsd  -0x18(%rbp),%xmm0
call   1030 <write_result@plt>
mov    %eax,-0x54(%rbp)
cmpl   $0x0,-0x54(%rbp)
je     11c1 <finalization+0xa1>
mov    0x2e31(%rip),%rax
mov    (%rax),%edi
lea    -0x50(%rbp),%rdx
lea    0xe62(%rip),%rsi
call   1040 <fprintf@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<finalization>:
sub    $0x28,%rsp
mov    %esi,%r9d
movups 0xee0(%rip),%xmm1
movups %xmm1,0xe(%rsp)
movaps 0xec6(%rip),%xmm1
movaps %xmm1,(%rsp)
mov    %rsp,%rsi
call   1030 <write_result@plt>
test   %eax,%eax
je     1162 <finalization+0x42>
mov    0x2e8f(%rip),%rax
mov    (%rax),%edi
lea    0xec4(%rip),%rsi
mov    %rsp,%rdx
call   1040 <fprintf@plt>
add    $0x28,%rsp
ret

LLVM IR (-O0):
@__const.finalization.file_out = [30 x i8] c"summary.out\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@stderr = global i32 0
@.str = [39 x i8] c"Error when trying to write to file %s\0A\00"
define void @finalization(i8* %0, i32 %1, double %2, i32 %3, i32 %4, double* %5, double* %6, double* %7) {
%9 = alloca i8*
%10 = alloca i32
%11 = alloca double
%12 = alloca i32
%13 = alloca i32
%14 = alloca double*
%15 = alloca double*
%16 = alloca double*
%17 = alloca [30 x i8]
%18 = alloca i32
store i8* %0, i8** %9
store i32 %1, i32* %10
store double %2, double* %11
store i32 %3, i32* %12
store i32 %4, i32* %13
store double* %5, double** %14
store double* %6, double** %15
store double* %7, double** %16
%19 = bitcast [30 x i8]* %17 to i8*
%20 = load i8*, i8** %9
%21 = getelementptr inbounds [30 x i8], [30 x i8]* %17, i64 0, i64 0
%22 = load i32, i32* %12
%23 = load i32, i32* %13
%24 = load double*, double** %14
%25 = load i32, i32* %10
%26 = load double, double* %11
%27 = call i32 @write_result(i8* %20, i8* %21, i32 %22, i32 %23, double* %24, i32 %25, double %26)
store i32 %27, i32* %18
%28 = load i32, i32* %18
%29 = icmp ne i32 %28, 0
br i1 %29, label %30, label %34
30: ; preds = %8
%31 = load i32, i32* @stderr
%32 = getelementptr inbounds [30 x i8], [30 x i8]* %17, i64 0, i64 0
%33 = call i32 @fprintf(i32 %31, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i8* %32)
br label %34
34: ; preds = %30, %8
ret void
}

LLVM IR (-O2):
@__const.finalization.file_out = [30 x i8] c"summary.out\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@stderr = global i32 0
@.str = [39 x i8] c"Error when trying to write to file %s\0A\00"
define void @finalization(i8* %0, i32 %1, double %2, i32 %3, i32 %4, double* %5, double* nocapture readnone %6, double* nocapture readnone %7) {
%9 = alloca [30 x i8]
%10 = getelementptr inbounds [30 x i8], [30 x i8]* %9, i64 0, i64 0
%11 = call i32 @write_result(i8* %0, i8* %10, i32 %3, i32 %4, double* %5, i32 %1, double %2)
%12 = icmp eq i32 %11, 0
br i1 %12, label %16, label %13
13: ; preds = %8
%14 = load i32, i32* @stderr
%15 = call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i8* %10)
br label %16
16: ; preds = %13, %8
ret void
}