#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 M_PI;
double atan(double);
double log(double);
double psim_func(double x) {
  double psim;
  psim = 2.0 * log((1.0 + x) / 2.0) + log((1.0 + (x * x)) / 2.0) -
         2.0 * atan(x) + (M_PI / 2.0);
  return (psim);
}


x86 assembly (clang, -O0):
<psim_func>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  0xed3(%rip),%xmm0
addsd  -0x8(%rbp),%xmm0
movsd  0xebe(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1040 <log@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xea2(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  0xe8e(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1040 <log@plt>
movaps %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <atan@plt>
movaps %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
addsd  %xmm1,%xmm1
subsd  %xmm1,%xmm0
mov    0x2e37(%rip),%rax
movsd  (%rax),%xmm1
movsd  0xe43(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<psim_func>:
sub    $0x18,%rsp
movsd  %xmm0,0x10(%rsp)
addsd  0xece(%rip),%xmm0
mulsd  0xece(%rip),%xmm0
call   1040 <log@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
mulsd  %xmm0,%xmm0
addsd  0xea9(%rip),%xmm0
mulsd  0xea9(%rip),%xmm0
call   1040 <log@plt>
movsd  0x8(%rsp),%xmm1
addsd  %xmm1,%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
call   1030 <atan@plt>
addsd  %xmm0,%xmm0
movsd  0x8(%rsp),%xmm1
subsd  %xmm0,%xmm1
mov    0x2e50(%rip),%rax
movsd  0xe68(%rip),%xmm0
mulsd  (%rax),%xmm0
addsd  %xmm1,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
@M_PI = global double 0.000000e+00
define double @psim_func(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %2
%4 = load double, double* %2
%5 = fadd double 1.000000e+00, %4
%6 = fdiv double %5, 2.000000e+00
%7 = call double @log(double %6)
%8 = load double, double* %2
%9 = load double, double* %2
%10 = call double @llvm.fmuladd.f64(double %8, double %9, double 1.000000e+00)
%11 = fdiv double %10, 2.000000e+00
%12 = call double @log(double %11)
%13 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %7, double %12)
%14 = load double, double* %2
%15 = call double @atan(double %14)
%16 = call double @llvm.fmuladd.f64(double -2.000000e+00, double %15, double %13)
%17 = load double, double* @M_PI
%18 = fdiv double %17, 2.000000e+00
%19 = fadd double %16, %18
store double %19, double* %3
%20 = load double, double* %3
ret double %20
}

LLVM IR (-O2):
@M_PI = global double 0.000000e+00
define double @psim_func(double %0) {
%2 = fadd double %0, 1.000000e+00
%3 = fmul double %2, 5.000000e-01
%4 = tail call double @log(double %3)
%5 = tail call double @llvm.fmuladd.f64(double %0, double %0, double 1.000000e+00)
%6 = fmul double %5, 5.000000e-01
%7 = tail call double @log(double %6)
%8 = tail call double @llvm.fmuladd.f64(double %4, double 2.000000e+00, double %7)
%9 = tail call double @atan(double %0)
%10 = tail call double @llvm.fmuladd.f64(double %9, double -2.000000e+00, double %8)
%11 = load double, double* @M_PI
%12 = fmul double %11, 5.000000e-01
%13 = fadd double %10, %12
ret double %13
}