#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 *, ...);
int /*<<< orphan*/ printf(char *, ...);
void print_data(const char *file_name, double *G, double *V1, double *V2,
                int size) {
  FILE *fp;
  int i;
  if (!file_name) {
    printf("Incorrect filename\n");
  }
  if (!(fp = fopen(file_name, "w"))) {
    printf("Cannot create file %s\n", file_name);
    return;
  }
  fprintf(fp, "%d \n", size);
  for (i = 0; i < size; i++) {
    fprintf(fp, "%lf ", G[i]);
  }
  fprintf(fp, "\n");
  for (i = 0; i < size; i++) {
    fprintf(fp, "%lf ", V1[i]);
  }
  fprintf(fp, "\n");
  for (i = 0; i < size; i++) {
    fprintf(fp, "%lf ", V2[i]);
  }
  fprintf(fp, "\n");
  fclose(fp);
}


x86 assembly (clang, -O0):
<print_data>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1175 <print_data+0x35>
lea    0xe92(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
lea    0xe94(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x30(%rbp)
cmp    $0x0,%rax
jne    11aa <print_data+0x6a>
mov    -0x8(%rbp),%rsi
lea    0xe78(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    12be <print_data+0x17e>
mov    -0x30(%rbp),%rdi
mov    -0x24(%rbp),%edx
lea    0xe75(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    11ff <print_data+0xbf>
mov    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xe48(%rip),%rsi
mov    $0x1,%al
call   1050 <fprintf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11c6 <print_data+0x86>
mov    -0x30(%rbp),%rdi
lea    0xe26(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    1251 <print_data+0x111>
mov    -0x30(%rbp),%rdi
mov    -0x18(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xdf6(%rip),%rsi
mov    $0x1,%al
call   1050 <fprintf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1218 <print_data+0xd8>
mov    -0x30(%rbp),%rdi
lea    0xdd4(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    12a3 <print_data+0x163>
mov    -0x30(%rbp),%rdi
mov    -0x20(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xda4(%rip),%rsi
mov    $0x1,%al
call   1050 <fprintf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    126a <print_data+0x12a>
mov    -0x30(%rbp),%rdi
lea    0xd82(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x30(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_data>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r8d,%r14d
mov    %rcx,0x10(%rsp)
mov    %rdx,%r12
mov    %rsi,%rbp
mov    %rdi,%r13
test   %rdi,%rdi
jne    1190 <print_data+0x30>
lea    0xe98(%rip),%rdi
call   1030 <puts@plt>
lea    0xe69(%rip),%rsi
mov    %r13,%rdi
call   1080 <fopen@plt>
test   %rax,%rax
je     127e <print_data+0x11e>
mov    %rax,%rbx
lea    0xe67(%rip),%rsi
mov    %rax,%rdi
mov    %r14d,%edx
xor    %eax,%eax
call   1070 <fprintf@plt>
test   %r14d,%r14d
jle    129d <print_data+0x13d>
mov    %r14d,0xc(%rsp)
mov    %r14d,%r15d
xor    %r14d,%r14d
lea    0xe44(%rip),%r13
nopw   0x0(%rax,%rax,1)
movsd  0x0(%rbp,%r14,8),%xmm0
mov    %rbx,%rdi
mov    %r13,%rsi
mov    $0x1,%al
call   1070 <fprintf@plt>
add    $0x1,%r14
cmp    %r14,%r15
jne    11e0 <print_data+0x80>
mov    $0xa,%edi
mov    %rbx,%rsi
call   1060 <fputc@plt>
cmpl   $0x0,0xc(%rsp)
jle    12aa <print_data+0x14a>
xor    %ebp,%ebp
lea    0xe00(%rip),%r14
xchg   %ax,%ax
movsd  (%r12,%rbp,8),%xmm0
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x1,%al
call   1070 <fprintf@plt>
add    $0x1,%rbp
cmp    %rbp,%r15
jne    1220 <print_data+0xc0>
mov    $0xa,%edi
mov    %rbx,%rsi
call   1060 <fputc@plt>
cmpl   $0x0,0xc(%rsp)
mov    0x10(%rsp),%r12
jle    12b7 <print_data+0x157>
xor    %ebp,%ebp
lea    0xdc0(%rip),%r14
xchg   %ax,%ax
movsd  (%r12,%rbp,8),%xmm0
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x1,%al
call   1070 <fprintf@plt>
add    $0x1,%rbp
cmp    %rbp,%r15
jne    1260 <print_data+0x100>
jmp    12b7 <print_data+0x157>
lea    0xd7d(%rip),%rdi
mov    %r13,%rsi
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <printf@plt>
mov    $0xa,%edi
mov    %rbx,%rsi
call   1060 <fputc@plt>
mov    $0xa,%edi
mov    %rbx,%rsi
call   1060 <fputc@plt>
mov    $0xa,%edi
mov    %rbx,%rsi
call   1060 <fputc@plt>
mov    %rbx,%rdi
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <fclose@plt>

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

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