#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 cos(double);
int sin(double);
void geom_dgam_sph_tpr(double x[], double dgam[2][3][3]) {
  int k, i, j;
  for (k = 0; k < 2; k++)
    for (i = 0; i < 3; i++)
      for (j = 0; j < 3; j++)
        dgam[k][i][j] = 0.0;
  dgam[0][1][1] = 2 * sin(x[0]) * cos(x[0]);
}


x86 assembly (clang, -O0):
<geom_dgam_sph_tpr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x2,-0x14(%rbp)
jge    11bd <geom_dgam_sph_tpr+0x9d>
movl   $0x0,-0x18(%rbp)
cmpl   $0x3,-0x18(%rbp)
jge    11aa <geom_dgam_sph_tpr+0x8a>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x3,-0x1c(%rbp)
jge    1197 <geom_dgam_sph_tpr+0x77>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
imul   $0x48,%rcx,%rcx
add    %rcx,%rax
movslq -0x18(%rbp),%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movslq -0x1c(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1159 <geom_dgam_sph_tpr+0x39>
jmp    119c <geom_dgam_sph_tpr+0x7c>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1148 <geom_dgam_sph_tpr+0x28>
jmp    11af <geom_dgam_sph_tpr+0x8f>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1137 <geom_dgam_sph_tpr+0x17>
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
call   1030 <sin@plt>
shl    $0x1,%eax
mov    %eax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
call   1040 <cos@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%eax
imul   %ecx,%eax
cvtsi2sd %eax,%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x20(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<geom_dgam_sph_tpr>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %rdi,%r14
xorps  %xmm0,%xmm0
movups %xmm0,0x80(%rsi)
movups %xmm0,0x70(%rsi)
movups %xmm0,0x60(%rsi)
movups %xmm0,0x50(%rsi)
movups %xmm0,0x40(%rsi)
movups %xmm0,0x30(%rsi)
movups %xmm0,0x20(%rsi)
movups %xmm0,0x10(%rsi)
movups %xmm0,(%rsi)
movsd  (%rdi),%xmm0
call   1030 <sin@plt>
mov    %eax,%ebp
movsd  (%r14),%xmm0
call   1040 <cos@plt>
imul   %ebp,%eax
add    %eax,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x20(%rbx)
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @geom_dgam_sph_tpr(double* %0, [3 x [3 x double]]* %1) {
%3 = alloca double*
%4 = alloca [3 x [3 x double]]*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store double* %0, double** %3
store [3 x [3 x double]]* %1, [3 x [3 x double]]** %4
store i32 0, i32* %5
br label %8
8: ; preds = %38, %2
%9 = load i32, i32* %5
%10 = icmp slt i32 %9, 2
br i1 %10, label %11, label %41
11: ; preds = %8
store i32 0, i32* %6
br label %12
12: ; preds = %34, %11
%13 = load i32, i32* %6
%14 = icmp slt i32 %13, 3
br i1 %14, label %15, label %37
15: ; preds = %12
store i32 0, i32* %7
br label %16
16: ; preds = %30, %15
%17 = load i32, i32* %7
%18 = icmp slt i32 %17, 3
br i1 %18, label %19, label %33
19: ; preds = %16
%20 = load [3 x [3 x double]]*, [3 x [3 x double]]** %4
%21 = load i32, i32* %5
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %20, i64 %22
%24 = load i32, i32* %6
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %23, i64 0, i64 %25
%27 = load i32, i32* %7
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [3 x double], [3 x double]* %26, i64 0, i64 %28
store double 0.000000e+00, double* %29
br label %30
30: ; preds = %19
%31 = load i32, i32* %7
%32 = add nsw i32 %31, 1
store i32 %32, i32* %7
br label %16
33: ; preds = %16
br label %34
34: ; preds = %33
%35 = load i32, i32* %6
%36 = add nsw i32 %35, 1
store i32 %36, i32* %6
br label %12
37: ; preds = %12
br label %38
38: ; preds = %37
%39 = load i32, i32* %5
%40 = add nsw i32 %39, 1
store i32 %40, i32* %5
br label %8
41: ; preds = %8
%42 = load double*, double** %3
%43 = getelementptr inbounds double, double* %42, i64 0
%44 = load double, double* %43
%45 = call i32 @sin(double %44)
%46 = mul nsw i32 2, %45
%47 = load double*, double** %3
%48 = getelementptr inbounds double, double* %47, i64 0
%49 = load double, double* %48
%50 = call i32 @cos(double %49)
%51 = mul nsw i32 %46, %50
%52 = sitofp i32 %51 to double
%53 = load [3 x [3 x double]]*, [3 x [3 x double]]** %4
%54 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %53, i64 0
%55 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %54, i64 0, i64 1
%56 = getelementptr inbounds [3 x double], [3 x double]* %55, i64 0, i64 1
store double %52, double* %56
ret void
}

LLVM IR (-O2):
define void @geom_dgam_sph_tpr(double* nocapture %0, [3 x [3 x double]]* nocapture writeonly %1) {
%3 = bitcast [3 x [3 x double]]* %1 to i8*
%4 = load double, double* %0
%5 = tail call i32 @sin(double %4)
%6 = shl nsw i32 %5, 1
%7 = load double, double* %0
%8 = tail call i32 @cos(double %7)
%9 = mul nsw i32 %6, %8
%10 = sitofp i32 %9 to double
%11 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %1, i64 0, i64 1, i64 1
store double %10, double* %11
ret void
}