#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 */
double sin(double);
void geom_igam_sph_rtp(double x[], double igam[3][3]) {
  double r = x[0];
  double st = sin(x[1]);
  igam[0][0] = 1.0;
  igam[0][1] = 0.0;
  igam[0][2] = 0.0;
  igam[1][0] = 0.0;
  igam[1][1] = 1.0 / (r * r);
  igam[1][2] = 0.0;
  igam[2][0] = 0.0;
  igam[2][1] = 0.0;
  igam[2][2] = 1.0 / (r * r * st * st);
}


x86 assembly (clang, -O0):
<geom_igam_sph_rtp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,-0x20(%rbp)
mov    -0x10(%rbp),%rax
movsd  0xeb4(%rip),%xmm0
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x8(%rax)
mov    -0x10(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x10(%rax)
mov    -0x10(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x18(%rax)
movsd  -0x18(%rbp),%xmm1
mulsd  -0x18(%rbp),%xmm1
movsd  0xe7a(%rip),%xmm0
divsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x20(%rax)
mov    -0x10(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x28(%rax)
mov    -0x10(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x30(%rax)
mov    -0x10(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x38(%rax)
movsd  -0x18(%rbp),%xmm1
mulsd  -0x18(%rbp),%xmm1
mulsd  -0x20(%rbp),%xmm1
mulsd  -0x20(%rbp),%xmm1
movsd  0xe2d(%rip),%xmm0
divsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x40(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<geom_igam_sph_rtp>:
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
movsd  (%rdi),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x8(%rdi),%xmm0
call   1030 <sin@plt>
movabs $0x3ff0000000000000,%rax
mov    %rax,(%rbx)
movsd  0x8(%rsp),%xmm4
mulsd  %xmm4,%xmm4
movsd  0xeb5(%rip),%xmm1
movapd %xmm1,%xmm2
divsd  %xmm4,%xmm2
xorps  %xmm3,%xmm3
movups %xmm3,0x8(%rbx)
movq   $0x0,0x18(%rbx)
movsd  %xmm2,0x20(%rbx)
mulsd  %xmm0,%xmm4
mulsd  %xmm0,%xmm4
divsd  %xmm4,%xmm1
movups %xmm3,0x28(%rbx)
movq   $0x0,0x38(%rbx)
movsd  %xmm1,0x40(%rbx)
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @geom_igam_sph_rtp(double* %0, [3 x double]* %1) {
%3 = alloca double*
%4 = alloca [3 x double]*
%5 = alloca double
%6 = alloca double
store double* %0, double** %3
store [3 x double]* %1, [3 x double]** %4
%7 = load double*, double** %3
%8 = getelementptr inbounds double, double* %7, i64 0
%9 = load double, double* %8
store double %9, double* %5
%10 = load double*, double** %3
%11 = getelementptr inbounds double, double* %10, i64 1
%12 = load double, double* %11
%13 = call double @sin(double %12)
store double %13, double* %6
%14 = load [3 x double]*, [3 x double]** %4
%15 = getelementptr inbounds [3 x double], [3 x double]* %14, i64 0
%16 = getelementptr inbounds [3 x double], [3 x double]* %15, i64 0, i64 0
store double 1.000000e+00, double* %16
%17 = load [3 x double]*, [3 x double]** %4
%18 = getelementptr inbounds [3 x double], [3 x double]* %17, i64 0
%19 = getelementptr inbounds [3 x double], [3 x double]* %18, i64 0, i64 1
store double 0.000000e+00, double* %19
%20 = load [3 x double]*, [3 x double]** %4
%21 = getelementptr inbounds [3 x double], [3 x double]* %20, i64 0
%22 = getelementptr inbounds [3 x double], [3 x double]* %21, i64 0, i64 2
store double 0.000000e+00, double* %22
%23 = load [3 x double]*, [3 x double]** %4
%24 = getelementptr inbounds [3 x double], [3 x double]* %23, i64 1
%25 = getelementptr inbounds [3 x double], [3 x double]* %24, i64 0, i64 0
store double 0.000000e+00, double* %25
%26 = load double, double* %5
%27 = load double, double* %5
%28 = fmul double %26, %27
%29 = fdiv double 1.000000e+00, %28
%30 = load [3 x double]*, [3 x double]** %4
%31 = getelementptr inbounds [3 x double], [3 x double]* %30, i64 1
%32 = getelementptr inbounds [3 x double], [3 x double]* %31, i64 0, i64 1
store double %29, double* %32
%33 = load [3 x double]*, [3 x double]** %4
%34 = getelementptr inbounds [3 x double], [3 x double]* %33, i64 1
%35 = getelementptr inbounds [3 x double], [3 x double]* %34, i64 0, i64 2
store double 0.000000e+00, double* %35
%36 = load [3 x double]*, [3 x double]** %4
%37 = getelementptr inbounds [3 x double], [3 x double]* %36, i64 2
%38 = getelementptr inbounds [3 x double], [3 x double]* %37, i64 0, i64 0
store double 0.000000e+00, double* %38
%39 = load [3 x double]*, [3 x double]** %4
%40 = getelementptr inbounds [3 x double], [3 x double]* %39, i64 2
%41 = getelementptr inbounds [3 x double], [3 x double]* %40, i64 0, i64 1
store double 0.000000e+00, double* %41
%42 = load double, double* %5
%43 = load double, double* %5
%44 = fmul double %42, %43
%45 = load double, double* %6
%46 = fmul double %44, %45
%47 = load double, double* %6
%48 = fmul double %46, %47
%49 = fdiv double 1.000000e+00, %48
%50 = load [3 x double]*, [3 x double]** %4
%51 = getelementptr inbounds [3 x double], [3 x double]* %50, i64 2
%52 = getelementptr inbounds [3 x double], [3 x double]* %51, i64 0, i64 2
store double %49, double* %52
ret void
}

LLVM IR (-O2):
define void @geom_igam_sph_rtp(double* nocapture %0, [3 x double]* nocapture writeonly %1) {
%3 = load double, double* %0
%4 = getelementptr inbounds double, double* %0, i64 1
%5 = load double, double* %4
%6 = tail call double @sin(double %5)
%7 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 0, i64 0
store double 1.000000e+00, double* %7
%8 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 0, i64 1
%9 = fmul double %3, %3
%10 = fdiv double 1.000000e+00, %9
%11 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 1, i64 1
%12 = bitcast double* %8 to i8*
store double %10, double* %11
%13 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 1, i64 2
%14 = fmul double %9, %6
%15 = fmul double %6, %14
%16 = fdiv double 1.000000e+00, %15
%17 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 2, i64 2
%18 = bitcast double* %13 to i8*
store double %16, double* %17
ret void
}