#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,
                           double);
void print_points(double *x, double *y, double *z, int npoints) {
  FILE *fileout;
  int i;
  fileout = fopen("Esfera-Homogenea.txt", "w");
  for (i = 0; i < npoints; i++) {
    fprintf(fileout, "%f %f %f \n", x[i], y[i], z[i]);
  }
  fclose(fileout);
}


x86 assembly (clang, -O0):
<print_points>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
lea    0xeb2(%rip),%rdi
lea    0xec0(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    11b6 <print_points+0x86>
mov    -0x28(%rbp),%rdi
mov    -0x8(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x18(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
lea    0xe74(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1165 <print_points+0x35>
mov    -0x28(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_points>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %ecx,%ebp
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%r12
lea    0xeb3(%rip),%rdi
lea    0xec1(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,%rbx
test   %ebp,%ebp
jle    119a <print_points+0x6a>
mov    %ebp,%ebp
xor    %r13d,%r13d
cs nopw 0x0(%rax,%rax,1)
nop
movsd  (%r12,%r13,8),%xmm0
movsd  (%r15,%r13,8),%xmm1
movsd  (%r14,%r13,8),%xmm2
mov    %rbx,%rdi
lea    0xe8b(%rip),%rsi
call   1040 <fprintf@plt>
add    $0x1,%r13
cmp    %r13,%rbp
jne    1170 <print_points+0x40>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <fclose@plt>

LLVM IR (-O0):
@.str = [21 x i8] c"Esfera-Homogenea.txt\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [11 x i8] c"%f %f %f \0A\00"
define void @print_points(double* %0, double* %1, double* %2, i32 %3) {
%5 = alloca double*
%6 = alloca double*
%7 = alloca double*
%8 = alloca i32
%9 = alloca i32*
%10 = alloca i32
store double* %0, double** %5
store double* %1, double** %6
store double* %2, double** %7
store i32 %3, i32* %8
%11 = call i32* @fopen(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %11, i32** %9
store i32 0, i32* %10
br label %12
12: ; preds = %34, %4
%13 = load i32, i32* %10
%14 = load i32, i32* %8
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %37
16: ; preds = %12
%17 = load i32*, i32** %9
%18 = load double*, double** %5
%19 = load i32, i32* %10
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds double, double* %18, i64 %20
%22 = load double, double* %21
%23 = load double*, double** %6
%24 = load i32, i32* %10
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds double, double* %23, i64 %25
%27 = load double, double* %26
%28 = load double*, double** %7
%29 = load i32, i32* %10
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds double, double* %28, i64 %30
%32 = load double, double* %31
%33 = call i32 @fprintf(i32* %17, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), double %22, double %27, double %32)
br label %34
34: ; preds = %16
%35 = load i32, i32* %10
%36 = add nsw i32 %35, 1
store i32 %36, i32* %10
br label %12
37: ; preds = %12
%38 = load i32*, i32** %9
%39 = call i32 @fclose(i32* %38)
ret void
}

LLVM IR (-O2):
@.str = [21 x i8] c"Esfera-Homogenea.txt\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [11 x i8] c"%f %f %f \0A\00"
define void @print_points(double* nocapture %0, double* nocapture %1, double* nocapture %2, i32 %3) {
%5 = tail call i32* @fopen(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%6 = icmp sgt i32 %3, 0
br i1 %6, label %7, label %20
7: ; preds = %4
%8 = zext i32 %3 to i64
br label %9
9: ; preds = %7, %9
%10 = phi i64 [ 0, %7 ], [ %18, %9 ]
%11 = getelementptr inbounds double, double* %0, i64 %10
%12 = load double, double* %11
%13 = getelementptr inbounds double, double* %1, i64 %10
%14 = load double, double* %13
%15 = getelementptr inbounds double, double* %2, i64 %10
%16 = load double, double* %15
%17 = tail call i32 @fprintf(i32* %5, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), double %12, double %14, double %16)
%18 = add nuw nsw i64 %10, 1
%19 = icmp eq i64 %18, %8
br i1 %19, label %20, label %9
20: ; preds = %9, %4
%21 = tail call i32 @fclose(i32* %5)
ret void
}