#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*/ scm_vector(int, double, double, double *);
void scm_get_sample_corners(int f, long i, long j, long n, double *v) {
  scm_vector(f, (double)(i + 0) / n, (double)(j + 0) / n, v + 0);
  scm_vector(f, (double)(i + 1) / n, (double)(j + 0) / n, v + 3);
  scm_vector(f, (double)(i + 0) / n, (double)(j + 1) / n, v + 6);
  scm_vector(f, (double)(i + 1) / n, (double)(j + 1) / n, v + 9);
}


x86 assembly (clang, -O0):
<scm_get_sample_corners>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rax
add    $0x0,%rax
cvtsi2sd %rax,%xmm0
cvtsi2sdq -0x20(%rbp),%xmm1
divsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
add    $0x0,%rax
cvtsi2sd %rax,%xmm1
cvtsi2sdq -0x20(%rbp),%xmm2
divsd  %xmm2,%xmm1
mov    -0x28(%rbp),%rsi
call   1030 <scm_vector@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rax
add    $0x1,%rax
cvtsi2sd %rax,%xmm0
cvtsi2sdq -0x20(%rbp),%xmm1
divsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
add    $0x0,%rax
cvtsi2sd %rax,%xmm1
cvtsi2sdq -0x20(%rbp),%xmm2
divsd  %xmm2,%xmm1
mov    -0x28(%rbp),%rsi
add    $0x18,%rsi
call   1030 <scm_vector@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rax
add    $0x0,%rax
cvtsi2sd %rax,%xmm0
cvtsi2sdq -0x20(%rbp),%xmm1
divsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
add    $0x1,%rax
cvtsi2sd %rax,%xmm1
cvtsi2sdq -0x20(%rbp),%xmm2
divsd  %xmm2,%xmm1
mov    -0x28(%rbp),%rsi
add    $0x30,%rsi
call   1030 <scm_vector@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rax
add    $0x1,%rax
cvtsi2sd %rax,%xmm0
cvtsi2sdq -0x20(%rbp),%xmm1
divsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
add    $0x1,%rax
cvtsi2sd %rax,%xmm1
cvtsi2sdq -0x20(%rbp),%xmm2
divsd  %xmm2,%xmm1
mov    -0x28(%rbp),%rsi
add    $0x48,%rsi
call   1030 <scm_vector@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<scm_get_sample_corners>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x28,%rsp
mov    %r8,%rbx
mov    %rdx,%r15
mov    %rsi,%rbp
mov    %edi,%r14d
cvtsi2sd %rsi,%xmm0
cvtsi2sd %rcx,%xmm2
movsd  %xmm2,0x8(%rsp)
divsd  %xmm2,%xmm0
movsd  %xmm0,0x20(%rsp)
cvtsi2sd %rdx,%xmm1
divsd  %xmm2,%xmm1
movsd  %xmm1,0x10(%rsp)
mov    %r8,%rsi
call   1030 <scm_vector@plt>
add    $0x1,%rbp
xorps  %xmm0,%xmm0
cvtsi2sd %rbp,%xmm0
divsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x18(%rsp)
lea    0x18(%rbx),%rsi
mov    %r14d,%edi
movsd  0x10(%rsp),%xmm1
call   1030 <scm_vector@plt>
add    $0x1,%r15
xorps  %xmm1,%xmm1
cvtsi2sd %r15,%xmm1
divsd  0x8(%rsp),%xmm1
movsd  %xmm1,0x8(%rsp)
lea    0x30(%rbx),%rsi
mov    %r14d,%edi
movsd  0x20(%rsp),%xmm0
call   1030 <scm_vector@plt>
add    $0x48,%rbx
mov    %r14d,%edi
movsd  0x18(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
mov    %rbx,%rsi
add    $0x28,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <scm_vector@plt>

LLVM IR (-O0):
define void @scm_get_sample_corners(i32 %0, i64 %1, i64 %2, i64 %3, double* %4) {
%6 = alloca i32
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
%10 = alloca double*
store i32 %0, i32* %6
store i64 %1, i64* %7
store i64 %2, i64* %8
store i64 %3, i64* %9
store double* %4, double** %10
%11 = load i32, i32* %6
%12 = load i64, i64* %7
%13 = add nsw i64 %12, 0
%14 = sitofp i64 %13 to double
%15 = load i64, i64* %9
%16 = sitofp i64 %15 to double
%17 = fdiv double %14, %16
%18 = load i64, i64* %8
%19 = add nsw i64 %18, 0
%20 = sitofp i64 %19 to double
%21 = load i64, i64* %9
%22 = sitofp i64 %21 to double
%23 = fdiv double %20, %22
%24 = load double*, double** %10
%25 = getelementptr inbounds double, double* %24, i64 0
%26 = call i32 @scm_vector(i32 %11, double %17, double %23, double* %25)
%27 = load i32, i32* %6
%28 = load i64, i64* %7
%29 = add nsw i64 %28, 1
%30 = sitofp i64 %29 to double
%31 = load i64, i64* %9
%32 = sitofp i64 %31 to double
%33 = fdiv double %30, %32
%34 = load i64, i64* %8
%35 = add nsw i64 %34, 0
%36 = sitofp i64 %35 to double
%37 = load i64, i64* %9
%38 = sitofp i64 %37 to double
%39 = fdiv double %36, %38
%40 = load double*, double** %10
%41 = getelementptr inbounds double, double* %40, i64 3
%42 = call i32 @scm_vector(i32 %27, double %33, double %39, double* %41)
%43 = load i32, i32* %6
%44 = load i64, i64* %7
%45 = add nsw i64 %44, 0
%46 = sitofp i64 %45 to double
%47 = load i64, i64* %9
%48 = sitofp i64 %47 to double
%49 = fdiv double %46, %48
%50 = load i64, i64* %8
%51 = add nsw i64 %50, 1
%52 = sitofp i64 %51 to double
%53 = load i64, i64* %9
%54 = sitofp i64 %53 to double
%55 = fdiv double %52, %54
%56 = load double*, double** %10
%57 = getelementptr inbounds double, double* %56, i64 6
%58 = call i32 @scm_vector(i32 %43, double %49, double %55, double* %57)
%59 = load i32, i32* %6
%60 = load i64, i64* %7
%61 = add nsw i64 %60, 1
%62 = sitofp i64 %61 to double
%63 = load i64, i64* %9
%64 = sitofp i64 %63 to double
%65 = fdiv double %62, %64
%66 = load i64, i64* %8
%67 = add nsw i64 %66, 1
%68 = sitofp i64 %67 to double
%69 = load i64, i64* %9
%70 = sitofp i64 %69 to double
%71 = fdiv double %68, %70
%72 = load double*, double** %10
%73 = getelementptr inbounds double, double* %72, i64 9
%74 = call i32 @scm_vector(i32 %59, double %65, double %71, double* %73)
ret void
}

LLVM IR (-O2):
define void @scm_get_sample_corners(i32 %0, i64 %1, i64 %2, i64 %3, double* %4) {
%6 = sitofp i64 %1 to double
%7 = sitofp i64 %3 to double
%8 = fdiv double %6, %7
%9 = sitofp i64 %2 to double
%10 = fdiv double %9, %7
%11 = tail call i32 @scm_vector(i32 %0, double %8, double %10, double* %4)
%12 = add nsw i64 %1, 1
%13 = sitofp i64 %12 to double
%14 = fdiv double %13, %7
%15 = getelementptr inbounds double, double* %4, i64 3
%16 = tail call i32 @scm_vector(i32 %0, double %14, double %10, double* %15)
%17 = add nsw i64 %2, 1
%18 = sitofp i64 %17 to double
%19 = fdiv double %18, %7
%20 = getelementptr inbounds double, double* %4, i64 6
%21 = tail call i32 @scm_vector(i32 %0, double %8, double %19, double* %20)
%22 = getelementptr inbounds double, double* %4, i64 9
%23 = tail call i32 @scm_vector(i32 %0, double %14, double %19, double* %22)
ret void
}