#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 */
double exp(double);
int fabs(double);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ printf(char *, ...);
void print_plot(const char *file_name, double *X, double *Y, double *G,
                double *V1, double *V2, int size, double tt) {
  FILE *fp;
  int i;
  if (!file_name) {
    printf("Incorrect filename by time %lf\n", tt);
  }
  if (!(fp = fopen(file_name, "w+"))) {
    printf("Cannot create file %s\n", file_name);
    return;
  }
  for (i = 0; i < size; i++) {
    fprintf(fp, "%f %f %f %f %f\n", Y[i], X[i], V2[i], V1[i], exp(G[i]));
    if (i < size - 1 && fabs(Y[i] - Y[i + 1]) > 1e-6) {
      fprintf(fp, "\n");
    }
  }
  fclose(fp);
}


x86 assembly (clang, -O0):
<print_plot>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    0x10(%rbp),%eax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
movsd  %xmm0,-0x38(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    11a6 <print_plot+0x46>
movsd  -0x38(%rbp),%xmm0
lea    0xe69(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
lea    0xe77(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x40(%rbp)
cmp    $0x0,%rax
jne    11db <print_plot+0x7b>
mov    -0x8(%rbp),%rsi
lea    0xe5c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    12f2 <print_plot+0x192>
movl   $0x0,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cmp    0x10(%rbp),%eax
jge    12e9 <print_plot+0x189>
mov    -0x40(%rbp),%rax
mov    %rax,-0x70(%rbp)
mov    -0x18(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    -0x30(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x28(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x20(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
call   1070 <exp@plt>
mov    -0x70(%rbp),%rdi
movsd  -0x68(%rbp),%xmm1
movsd  -0x60(%rbp),%xmm2
movsd  -0x58(%rbp),%xmm3
movaps %xmm0,%xmm4
movsd  -0x50(%rbp),%xmm0
lea    0xdd0(%rip),%rsi
mov    $0x5,%al
call   1060 <fprintf@plt>
mov    -0x44(%rbp),%eax
mov    0x10(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    12d6 <print_plot+0x176>
mov    -0x18(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
mov    -0x44(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
subsd  (%rax,%rcx,8),%xmm0
call   1050 <fabs@plt>
cvtsi2sd %eax,%xmm0
movsd  0xd46(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    12d6 <print_plot+0x176>
mov    -0x40(%rbp),%rdi
lea    0xd81(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
jmp    12db <print_plot+0x17b>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    11e2 <print_plot+0x82>
mov    -0x40(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_plot>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %r9,0x10(%rsp)
mov    %r8,0x8(%rsp)
mov    %rcx,(%rsp)
mov    %rdx,%rbx
mov    %rsi,%r13
mov    %rdi,%r14
mov    0x70(%rsp),%r15d
test   %rdi,%rdi
jne    11ad <print_plot+0x3d>
lea    0xe5a(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xe6c(%rip),%rsi
mov    %r14,%rdi
call   1090 <fopen@plt>
test   %rax,%rax
je     12b2 <print_plot+0x142>
mov    %rax,%rbp
test   %r15d,%r15d
jle    129c <print_plot+0x12c>
lea    -0x1(%r15),%r14d
mov    %r15d,%r15d
xor    %r12d,%r12d
jmp    11ed <print_plot+0x7d>
nopl   (%rax)
add    $0x1,%r12
cmp    %r15,%r12
je     129c <print_plot+0x12c>
movsd  (%rbx,%r12,8),%xmm0
movsd  %xmm0,0x30(%rsp)
movsd  0x0(%r13,%r12,8),%xmm0
movsd  %xmm0,0x28(%rsp)
mov    0x10(%rsp),%rax
movsd  (%rax,%r12,8),%xmm0
movsd  %xmm0,0x20(%rsp)
mov    0x8(%rsp),%rax
movsd  (%rax,%r12,8),%xmm0
movsd  %xmm0,0x18(%rsp)
mov    (%rsp),%rax
movsd  (%rax,%r12,8),%xmm0
call   1080 <exp@plt>
movaps %xmm0,%xmm4
mov    %rbp,%rdi
lea    0xdf6(%rip),%rsi
movsd  0x30(%rsp),%xmm0
movsd  0x28(%rsp),%xmm1
movsd  0x20(%rsp),%xmm2
movsd  0x18(%rsp),%xmm3
mov    $0x5,%al
call   1070 <fprintf@plt>
cmp    %r14,%r12
jge    11e0 <print_plot+0x70>
movsd  (%rbx,%r12,8),%xmm0
subsd  0x8(%rbx,%r12,8),%xmm0
add    $0x1,%r12
call   1060 <fabs@plt>
test   %eax,%eax
jle    11e4 <print_plot+0x74>
mov    $0xa,%edi
mov    %rbp,%rsi
call   1050 <fputc@plt>
jmp    11e4 <print_plot+0x74>
mov    %rbp,%rdi
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <fclose@plt>
lea    0xd6a(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [32 x i8] c"Incorrect filename by time %lf\0A\00"
@.str.1 = [3 x i8] c"w+\00"
@.str.2 = [23 x i8] c"Cannot create file %s\0A\00"
@.str.3 = [16 x i8] c"%f %f %f %f %f\0A\00"
@.str.4 = [2 x i8] c"\0A\00"
define void @print_plot(i8* %0, double* %1, double* %2, double* %3, double* %4, double* %5, i32 %6, double %7) {
%9 = alloca i8*
%10 = alloca double*
%11 = alloca double*
%12 = alloca double*
%13 = alloca double*
%14 = alloca double*
%15 = alloca i32
%16 = alloca double
%17 = alloca i32*
%18 = alloca i32
store i8* %0, i8** %9
store double* %1, double** %10
store double* %2, double** %11
store double* %3, double** %12
store double* %4, double** %13
store double* %5, double** %14
store i32 %6, i32* %15
store double %7, double* %16
%19 = load i8*, i8** %9
%20 = icmp ne i8* %19, null
br i1 %20, label %24, label %21
21: ; preds = %8
%22 = load double, double* %16
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), double %22)
br label %24
24: ; preds = %21, %8
%25 = load i8*, i8** %9
%26 = call i32* @fopen(i8* %25, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %26, i32** %17
%27 = icmp ne i32* %26, null
br i1 %27, label %31, label %28
28: ; preds = %24
%29 = load i8*, i8** %9
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i8* %29)
br label %95
31: ; preds = %24
store i32 0, i32* %18
br label %32
32: ; preds = %89, %31
%33 = load i32, i32* %18
%34 = load i32, i32* %15
%35 = icmp slt i32 %33, %34
br i1 %35, label %36, label %92
36: ; preds = %32
%37 = load i32*, i32** %17
%38 = load double*, double** %11
%39 = load i32, i32* %18
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds double, double* %38, i64 %40
%42 = load double, double* %41
%43 = load double*, double** %10
%44 = load i32, i32* %18
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds double, double* %43, i64 %45
%47 = load double, double* %46
%48 = load double*, double** %14
%49 = load i32, i32* %18
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds double, double* %48, i64 %50
%52 = load double, double* %51
%53 = load double*, double** %13
%54 = load i32, i32* %18
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds double, double* %53, i64 %55
%57 = load double, double* %56
%58 = load double*, double** %12
%59 = load i32, i32* %18
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds double, double* %58, i64 %60
%62 = load double, double* %61
%63 = call double @exp(double %62)
%64 = call i32 (i32*, i8*, ...) @fprintf(i32* %37, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), double %42, double %47, double %52, double %57, double %63)
%65 = load i32, i32* %18
%66 = load i32, i32* %15
%67 = sub nsw i32 %66, 1
%68 = icmp slt i32 %65, %67
br i1 %68, label %69, label %88
69: ; preds = %36
%70 = load double*, double** %11
%71 = load i32, i32* %18
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds double, double* %70, i64 %72
%74 = load double, double* %73
%75 = load double*, double** %11
%76 = load i32, i32* %18
%77 = add nsw i32 %76, 1
%78 = sext i32 %77 to i64
%79 = getelementptr inbounds double, double* %75, i64 %78
%80 = load double, double* %79
%81 = fsub double %74, %80
%82 = call i32 @fabs(double %81)
%83 = sitofp i32 %82 to double
%84 = fcmp ogt double %83, 0x3EB0C6F7A0B5ED8D
br i1 %84, label %85, label %88
85: ; preds = %69
%86 = load i32*, i32** %17
%87 = call i32 (i32*, i8*, ...) @fprintf(i32* %86, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %88
88: ; preds = %85, %69, %36
br label %89
89: ; preds = %88
%90 = load i32, i32* %18
%91 = add nsw i32 %90, 1
store i32 %91, i32* %18
br label %32
92: ; preds = %32
%93 = load i32*, i32** %17
%94 = call i32 @fclose(i32* %93)
br label %95
95: ; preds = %92, %28
ret void
}

LLVM IR (-O2):
@.str = [32 x i8] c"Incorrect filename by time %lf\0A\00"
@.str.1 = [3 x i8] c"w+\00"
@.str.2 = [23 x i8] c"Cannot create file %s\0A\00"
@.str.3 = [16 x i8] c"%f %f %f %f %f\0A\00"
define void @print_plot(i8* %0, double* nocapture %1, double* nocapture %2, double* nocapture %3, double* nocapture %4, double* nocapture %5, i32 %6, double %7) {
%9 = icmp eq i8* %0, null
br i1 %9, label %10, label %12
10: ; preds = %8
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), double %7)
br label %12
12: ; preds = %10, %8
%13 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%14 = icmp eq i32* %13, null
br i1 %14, label %21, label %15
15: ; preds = %12
%16 = icmp sgt i32 %6, 0
br i1 %16, label %17, label %53
17: ; preds = %15
%18 = add nsw i32 %6, -1
%19 = zext i32 %18 to i64
%20 = zext i32 %6 to i64
br label %23
21: ; preds = %12
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i8* %0)
br label %55
23: ; preds = %17, %50
%24 = phi i64 [ 0, %17 ], [ %51, %50 ]
%25 = getelementptr inbounds double, double* %2, i64 %24
%26 = load double, double* %25
%27 = getelementptr inbounds double, double* %1, i64 %24
%28 = load double, double* %27
%29 = getelementptr inbounds double, double* %5, i64 %24
%30 = load double, double* %29
%31 = getelementptr inbounds double, double* %4, i64 %24
%32 = load double, double* %31
%33 = getelementptr inbounds double, double* %3, i64 %24
%34 = load double, double* %33
%35 = tail call double @exp(double %34)
%36 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %13, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), double %26, double %28, double %30, double %32, double %35)
%37 = icmp slt i64 %24, %19
br i1 %37, label %40, label %38
38: ; preds = %23
%39 = add nuw nsw i64 %24, 1
br label %50
40: ; preds = %23
%41 = load double, double* %25
%42 = add nuw nsw i64 %24, 1
%43 = getelementptr inbounds double, double* %2, i64 %42
%44 = load double, double* %43
%45 = fsub double %41, %44
%46 = tail call i32 @fabs(double %45)
%47 = icmp sgt i32 %46, 0
br i1 %47, label %48, label %50
48: ; preds = %40
%49 = tail call i32 @fputc(i32 10, i32* %13)
br label %50
50: ; preds = %38, %40, %48
%51 = phi i64 [ %39, %38 ], [ %42, %40 ], [ %42, %48 ]
%52 = icmp eq i64 %51, %20
br i1 %52, label %53, label %23
53: ; preds = %50, %15
%54 = tail call i32 @fclose(i32* %13)
br label %55
55: ; preds = %53, %21
ret void
}