#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 log(int);
void get_shear(double x, double *f, double *df, double Ur, double Zr) {
  *f = log(2. * 9.80665 * Zr / .12) + log(1 / (x * x)) - 0.40 * Ur / x;
  *df = 0.40 * Ur / (x * x) - 2. / x;
}


x86 assembly (clang, -O0):
<get_shear>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movsd  %xmm1,-0x20(%rbp)
movsd  %xmm2,-0x28(%rbp)
movsd  0xee9(%rip),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  0xed4(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <log@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x8(%rbp),%xmm1
mulsd  -0x8(%rbp),%xmm1
movsd  0xea8(%rip),%xmm0
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <log@plt>
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
addsd  %xmm1,%xmm0
movsd  0xe7f(%rip),%xmm1
mulsd  -0x20(%rbp),%xmm1
divsd  -0x8(%rbp),%xmm1
subsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  0xe61(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
mulsd  -0x8(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  0xe3e(%rip),%xmm1
divsd  -0x8(%rbp),%xmm1
subsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_shear>:
push   %r14
push   %rbx
sub    $0x28,%rsp
movsd  %xmm1,0x20(%rsp)
mov    %rsi,%r14
mov    %rdi,%rbx
movsd  %xmm0,0x8(%rsp)
mulsd  0xecf(%rip),%xmm2
divsd  0xecf(%rip),%xmm2
cvttsd2si %xmm2,%edi
call   1030 <log@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm1
mulsd  %xmm1,%xmm1
movsd  %xmm1,0x18(%rsp)
movsd  0xeb0(%rip),%xmm0
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <log@plt>
addsd  0x10(%rsp),%xmm0
movsd  0x20(%rsp),%xmm2
mulsd  0xe97(%rip),%xmm2
movapd %xmm2,%xmm1
movsd  0x8(%rsp),%xmm3
divsd  %xmm3,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,(%rbx)
divsd  0x18(%rsp),%xmm2
movsd  0xe7b(%rip),%xmm0
divsd  %xmm3,%xmm0
addsd  %xmm2,%xmm0
movsd  %xmm0,(%r14)
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @get_shear(double %0, double* %1, double* %2, double %3, double %4) {
%6 = alloca double
%7 = alloca double*
%8 = alloca double*
%9 = alloca double
%10 = alloca double
store double %0, double* %6
store double* %1, double** %7
store double* %2, double** %8
store double %3, double* %9
store double %4, double* %10
%11 = load double, double* %10
%12 = fmul double 1.961330e+01, %11
%13 = fdiv double %12, 1.200000e-01
%14 = fptosi double %13 to i32
%15 = call double @log(i32 %14)
%16 = load double, double* %6
%17 = load double, double* %6
%18 = fmul double %16, %17
%19 = fdiv double 1.000000e+00, %18
%20 = fptosi double %19 to i32
%21 = call double @log(i32 %20)
%22 = fadd double %15, %21
%23 = load double, double* %9
%24 = fmul double 4.000000e-01, %23
%25 = load double, double* %6
%26 = fdiv double %24, %25
%27 = fsub double %22, %26
%28 = load double*, double** %7
store double %27, double* %28
%29 = load double, double* %9
%30 = fmul double 4.000000e-01, %29
%31 = load double, double* %6
%32 = load double, double* %6
%33 = fmul double %31, %32
%34 = fdiv double %30, %33
%35 = load double, double* %6
%36 = fdiv double 2.000000e+00, %35
%37 = fsub double %34, %36
%38 = load double*, double** %8
store double %37, double* %38
ret void
}

LLVM IR (-O2):
define void @get_shear(double %0, double* nocapture writeonly %1, double* nocapture writeonly %2, double %3, double %4) {
%6 = fmul double %4, 1.961330e+01
%7 = fdiv double %6, 1.200000e-01
%8 = fptosi double %7 to i32
%9 = tail call double @log(i32 %8)
%10 = fmul double %0, %0
%11 = fdiv double 1.000000e+00, %10
%12 = fptosi double %11 to i32
%13 = tail call double @log(i32 %12)
%14 = fadd double %9, %13
%15 = fmul double %3, 4.000000e-01
%16 = fdiv double %15, %0
%17 = fsub double %14, %16
store double %17, double* %1
%18 = fdiv double %15, %10
%19 = fdiv double 2.000000e+00, %0
%20 = fsub double %18, %19
store double %20, double* %2
ret void
}