#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 sqrt(double);
int arParamObserv2Ideal(const double dist_factor[4], const double ox,
                        const double oy, double *ix, double *iy) {
  double z02, z0, p, q, z, px, py;
  int i;
  px = ox - dist_factor[0];
  py = oy - dist_factor[1];
  p = dist_factor[2] / 100000000.0;
  z02 = px * px + py * py;
  q = z0 = sqrt(px * px + py * py);
  for (i = 1;; i++) {
    if (z0 != 0.0) {
      z = z0 - ((1.0 - p * z02) * z0 - q) / (1.0 - 3.0 * p * z02);
      px = px * z / z0;
      py = py * z / z0;
    } else {
      px = 0.0;
      py = 0.0;
      break;
    }
    if (i == 3)
      break;
    z02 = px * px + py * py;
    z0 = sqrt(px * px + py * py);
  }
  *ix = px / dist_factor[3] + dist_factor[0];
  *iy = py / dist_factor[3] + dist_factor[1];
  return (0);
}


x86 assembly (clang, -O0):
<arParamObserv2Ideal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
mov    %rsi,-0x20(%rbp)
mov    %rdx,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm0
mov    -0x8(%rbp),%rax
subsd  (%rax),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x18(%rbp),%xmm0
mov    -0x8(%rbp),%rax
subsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
movsd  0xe9c(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x58(%rbp),%xmm0
movsd  -0x58(%rbp),%xmm2
movsd  -0x60(%rbp),%xmm1
mulsd  -0x60(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x58(%rbp),%xmm0
movsd  -0x58(%rbp),%xmm2
movsd  -0x60(%rbp),%xmm1
mulsd  -0x60(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1030 <sqrt@plt>
movsd  %xmm0,-0x38(%rbp)
movsd  %xmm0,-0x48(%rbp)
movl   $0x1,-0x64(%rbp)
movsd  -0x38(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    11dd <arParamObserv2Ideal+0xcd>
jp     11dd <arParamObserv2Ideal+0xcd>
jmp    12af <arParamObserv2Ideal+0x19f>
movsd  -0x38(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm2
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm1
movsd  0xdf9(%rip),%xmm2
addsd  %xmm2,%xmm1
movsd  -0x38(%rbp),%xmm3
movsd  -0x48(%rbp),%xmm2
movq   %xmm2,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm2
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
movsd  0xdcc(%rip),%xmm2
mulsd  -0x40(%rbp),%xmm2
movsd  -0x30(%rbp),%xmm3
movq   %xmm2,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm2
mulsd  %xmm3,%xmm2
movsd  0xd97(%rip),%xmm3
addsd  %xmm3,%xmm2
divsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x58(%rbp),%xmm0
mulsd  -0x50(%rbp),%xmm0
divsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x60(%rbp),%xmm0
mulsd  -0x50(%rbp),%xmm0
divsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
jmp    12c4 <arParamObserv2Ideal+0x1b4>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x58(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x60(%rbp)
jmp    1328 <arParamObserv2Ideal+0x218>
cmpl   $0x3,-0x64(%rbp)
jne    12d3 <arParamObserv2Ideal+0x1c3>
jmp    1328 <arParamObserv2Ideal+0x218>
movsd  -0x58(%rbp),%xmm0
movsd  -0x58(%rbp),%xmm2
movsd  -0x60(%rbp),%xmm1
mulsd  -0x60(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x58(%rbp),%xmm0
movsd  -0x58(%rbp),%xmm2
movsd  -0x60(%rbp),%xmm1
mulsd  -0x60(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1030 <sqrt@plt>
movsd  %xmm0,-0x38(%rbp)
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    11c0 <arParamObserv2Ideal+0xb0>
movsd  -0x58(%rbp),%xmm0
mov    -0x8(%rbp),%rax
divsd  0x18(%rax),%xmm0
mov    -0x8(%rbp),%rax
addsd  (%rax),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x60(%rbp),%xmm0
mov    -0x8(%rbp),%rax
divsd  0x18(%rax),%xmm0
mov    -0x8(%rbp),%rax
addsd  0x8(%rax),%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,(%rax)
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<arParamObserv2Ideal>:
push   %r15
push   %r14
push   %rbx
sub    $0x50,%rsp
mov    %rdx,%r14
mov    %rsi,%r15
movapd %xmm0,%xmm3
mov    %rdi,%rbx
movupd (%rdi),%xmm0
unpcklpd %xmm1,%xmm3
subpd  %xmm0,%xmm3
movsd  0x10(%rdi),%xmm4
movapd %xmm3,%xmm0
mulpd  %xmm3,%xmm0
unpckhpd %xmm0,%xmm0
movapd %xmm3,%xmm1
mulsd  %xmm3,%xmm1
addsd  %xmm0,%xmm1
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm1
jb     115f <arParamObserv2Ideal+0x4f>
sqrtsd %xmm1,%xmm6
jmp    1192 <arParamObserv2Ideal+0x82>
movapd %xmm1,%xmm0
movapd %xmm3,0x20(%rsp)
movapd %xmm4,0x10(%rsp)
movapd %xmm1,(%rsp)
call   1030 <sqrt@plt>
movapd (%rsp),%xmm1
movapd 0x10(%rsp),%xmm4
movapd 0x20(%rsp),%xmm3
movapd %xmm0,%xmm6
xorpd  %xmm0,%xmm0
xorpd  %xmm5,%xmm5
ucomisd %xmm0,%xmm6
jne    11a2 <arParamObserv2Ideal+0x92>
jnp    1393 <arParamObserv2Ideal+0x283>
divsd  0xe56(%rip),%xmm4
movapd 0xe6e(%rip),%xmm7
xorpd  %xmm4,%xmm7
mulsd  0xe4a(%rip),%xmm4
movapd %xmm7,%xmm0
mulsd  %xmm1,%xmm0
movsd  0xe41(%rip),%xmm8
addsd  %xmm8,%xmm0
mulsd  %xmm6,%xmm0
subsd  %xmm6,%xmm0
mulsd  %xmm4,%xmm1
addsd  %xmm8,%xmm1
divsd  %xmm1,%xmm0
movapd %xmm6,%xmm1
subsd  %xmm0,%xmm1
unpcklpd %xmm1,%xmm1
mulpd  %xmm1,%xmm3
movapd %xmm6,%xmm0
unpcklpd %xmm6,%xmm0
divpd  %xmm0,%xmm3
movapd %xmm3,%xmm0
mulpd  %xmm3,%xmm0
unpckhpd %xmm0,%xmm0
movapd %xmm3,%xmm2
mulsd  %xmm3,%xmm2
addsd  %xmm0,%xmm2
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm2
jb     1230 <arParamObserv2Ideal+0x120>
xorps  %xmm0,%xmm0
sqrtsd %xmm2,%xmm0
jmp    1284 <arParamObserv2Ideal+0x174>
movapd %xmm2,%xmm0
movapd %xmm3,0x20(%rsp)
movapd %xmm4,0x10(%rsp)
movapd %xmm6,(%rsp)
movapd %xmm7,0x40(%rsp)
movapd %xmm2,0x30(%rsp)
call   1030 <sqrt@plt>
xorpd  %xmm1,%xmm1
movapd 0x30(%rsp),%xmm2
movsd  0xda7(%rip),%xmm8
movapd 0x40(%rsp),%xmm7
movapd (%rsp),%xmm6
xorpd  %xmm5,%xmm5
movapd 0x10(%rsp),%xmm4
movapd 0x20(%rsp),%xmm3
ucomisd %xmm1,%xmm0
jne    1290 <arParamObserv2Ideal+0x180>
jnp    1393 <arParamObserv2Ideal+0x283>
xorpd  0xd88(%rip),%xmm6
movapd %xmm7,%xmm1
mulsd  %xmm2,%xmm1
addsd  %xmm8,%xmm1
mulsd  %xmm0,%xmm1
addsd  %xmm6,%xmm1
mulsd  %xmm4,%xmm2
addsd  %xmm8,%xmm2
divsd  %xmm2,%xmm1
movapd %xmm0,%xmm2
subsd  %xmm1,%xmm2
unpcklpd %xmm2,%xmm2
mulpd  %xmm2,%xmm3
unpcklpd %xmm0,%xmm0
divpd  %xmm0,%xmm3
movapd %xmm3,%xmm0
mulpd  %xmm3,%xmm0
unpckhpd %xmm0,%xmm0
movapd %xmm3,%xmm1
mulsd  %xmm3,%xmm1
addsd  %xmm0,%xmm1
xorpd  %xmm2,%xmm2
ucomisd %xmm2,%xmm1
jb     12fd <arParamObserv2Ideal+0x1ed>
xorps  %xmm0,%xmm0
sqrtsd %xmm1,%xmm0
jmp    1351 <arParamObserv2Ideal+0x241>
movapd %xmm1,%xmm0
movapd %xmm3,0x20(%rsp)
movapd %xmm4,0x10(%rsp)
movapd %xmm6,(%rsp)
movapd %xmm7,0x40(%rsp)
movapd %xmm1,0x30(%rsp)
call   1030 <sqrt@plt>
xorpd  %xmm2,%xmm2
movapd 0x30(%rsp),%xmm1
movsd  0xcda(%rip),%xmm8
movapd 0x40(%rsp),%xmm7
movapd (%rsp),%xmm6
xorpd  %xmm5,%xmm5
movapd 0x10(%rsp),%xmm4
movapd 0x20(%rsp),%xmm3
ucomisd %xmm2,%xmm0
jne    1359 <arParamObserv2Ideal+0x249>
jnp    1393 <arParamObserv2Ideal+0x283>
mulsd  %xmm1,%xmm7
addsd  %xmm8,%xmm7
mulsd  %xmm0,%xmm7
addsd  %xmm6,%xmm7
mulsd  %xmm1,%xmm4
addsd  %xmm8,%xmm4
divsd  %xmm4,%xmm7
movapd %xmm0,%xmm1
subsd  %xmm7,%xmm1
unpcklpd %xmm1,%xmm1
mulpd  %xmm1,%xmm3
unpcklpd %xmm0,%xmm0
divpd  %xmm0,%xmm3
movapd %xmm3,%xmm5
movsd  0x18(%rbx),%xmm0
movapd %xmm5,%xmm1
divsd  %xmm0,%xmm1
addsd  (%rbx),%xmm1
movsd  %xmm1,(%r15)
unpckhpd %xmm5,%xmm5
divsd  0x18(%rbx),%xmm5
addsd  0x8(%rbx),%xmm5
movsd  %xmm5,(%r14)
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @arParamObserv2Ideal(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*
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca i32
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
%19 = load double, double* %7
%20 = load double*, double** %6
%21 = getelementptr inbounds double, double* %20, i64 0
%22 = load double, double* %21
%23 = fsub double %19, %22
store double %23, double* %16
%24 = load double, double* %8
%25 = load double*, double** %6
%26 = getelementptr inbounds double, double* %25, i64 1
%27 = load double, double* %26
%28 = fsub double %24, %27
store double %28, double* %17
%29 = load double*, double** %6
%30 = getelementptr inbounds double, double* %29, i64 2
%31 = load double, double* %30
%32 = fdiv double %31, 1.000000e+08
store double %32, double* %13
%33 = load double, double* %16
%34 = load double, double* %16
%35 = load double, double* %17
%36 = load double, double* %17
%37 = fmul double %35, %36
%38 = call double @llvm.fmuladd.f64(double %33, double %34, double %37)
store double %38, double* %11
%39 = load double, double* %16
%40 = load double, double* %16
%41 = load double, double* %17
%42 = load double, double* %17
%43 = fmul double %41, %42
%44 = call double @llvm.fmuladd.f64(double %39, double %40, double %43)
%45 = call double @sqrt(double %44)
store double %45, double* %12
store double %45, double* %14
store i32 1, i32* %18
br label %46
46: ; preds = %95, %5
%47 = load double, double* %12
%48 = fcmp une double %47, 0.000000e+00
br i1 %48, label %49, label %76
49: ; preds = %46
%50 = load double, double* %12
%51 = load double, double* %13
%52 = load double, double* %11
%53 = fneg double %51
%54 = call double @llvm.fmuladd.f64(double %53, double %52, double 1.000000e+00)
%55 = load double, double* %12
%56 = load double, double* %14
%57 = fneg double %56
%58 = call double @llvm.fmuladd.f64(double %54, double %55, double %57)
%59 = load double, double* %13
%60 = fmul double 3.000000e+00, %59
%61 = load double, double* %11
%62 = fneg double %60
%63 = call double @llvm.fmuladd.f64(double %62, double %61, double 1.000000e+00)
%64 = fdiv double %58, %63
%65 = fsub double %50, %64
store double %65, double* %15
%66 = load double, double* %16
%67 = load double, double* %15
%68 = fmul double %66, %67
%69 = load double, double* %12
%70 = fdiv double %68, %69
store double %70, double* %16
%71 = load double, double* %17
%72 = load double, double* %15
%73 = fmul double %71, %72
%74 = load double, double* %12
%75 = fdiv double %73, %74
store double %75, double* %17
br label %77
76: ; preds = %46
store double 0.000000e+00, double* %16
store double 0.000000e+00, double* %17
br label %98
77: ; preds = %49
%78 = load i32, i32* %18
%79 = icmp eq i32 %78, 3
br i1 %79, label %80, label %81
80: ; preds = %77
br label %98
81: ; preds = %77
%82 = load double, double* %16
%83 = load double, double* %16
%84 = load double, double* %17
%85 = load double, double* %17
%86 = fmul double %84, %85
%87 = call double @llvm.fmuladd.f64(double %82, double %83, double %86)
store double %87, double* %11
%88 = load double, double* %16
%89 = load double, double* %16
%90 = load double, double* %17
%91 = load double, double* %17
%92 = fmul double %90, %91
%93 = call double @llvm.fmuladd.f64(double %88, double %89, double %92)
%94 = call double @sqrt(double %93)
store double %94, double* %12
br label %95
95: ; preds = %81
%96 = load i32, i32* %18
%97 = add nsw i32 %96, 1
store i32 %97, i32* %18
br label %46
98: ; preds = %80, %76
%99 = load double, double* %16
%100 = load double*, double** %6
%101 = getelementptr inbounds double, double* %100, i64 3
%102 = load double, double* %101
%103 = fdiv double %99, %102
%104 = load double*, double** %6
%105 = getelementptr inbounds double, double* %104, i64 0
%106 = load double, double* %105
%107 = fadd double %103, %106
%108 = load double*, double** %9
store double %107, double* %108
%109 = load double, double* %17
%110 = load double*, double** %6
%111 = getelementptr inbounds double, double* %110, i64 3
%112 = load double, double* %111
%113 = fdiv double %109, %112
%114 = load double*, double** %6
%115 = getelementptr inbounds double, double* %114, i64 1
%116 = load double, double* %115
%117 = fadd double %113, %116
%118 = load double*, double** %10
store double %117, double* %118
ret i32 0
}

LLVM IR (-O2):
define i32 @arParamObserv2Ideal(double* nocapture %0, double %1, double %2, double* nocapture writeonly %3, double* nocapture writeonly %4) {
%6 = bitcast double* %0 to <2 x double>*
%7 = load <2 x double>, <2 x double>* %6
%8 = insertelement <2 x double> poison, double %1, i64 0
%9 = insertelement <2 x double> %8, double %2, i64 1
%10 = fsub <2 x double> %9, %7
%11 = getelementptr inbounds double, double* %0, i64 2
%12 = load double, double* %11
%13 = fdiv double %12, 1.000000e+08
%14 = fmul <2 x double> %10, %10
%15 = extractelement <2 x double> %14, i64 1
%16 = extractelement <2 x double> %10, i64 0
%17 = tail call double @llvm.fmuladd.f64(double %16, double %16, double %15)
%18 = tail call double @sqrt(double %17)
%19 = fneg double %13
%20 = fcmp une double %18, 0.000000e+00
br i1 %20, label %21, label %71
21: ; preds = %5
%22 = fneg double %18
%23 = fmul double %13, -3.000000e+00
%24 = tail call double @llvm.fmuladd.f64(double %19, double %17, double 1.000000e+00)
%25 = tail call double @llvm.fmuladd.f64(double %24, double %18, double %22)
%26 = tail call double @llvm.fmuladd.f64(double %23, double %17, double 1.000000e+00)
%27 = fdiv double %25, %26
%28 = fsub double %18, %27
%29 = insertelement <2 x double> poison, double %28, i64 0
%30 = shufflevector <2 x double> %29, <2 x double> poison, <2 x i32> zeroinitializer
%31 = fmul <2 x double> %10, %30
%32 = insertelement <2 x double> poison, double %18, i64 0
%33 = shufflevector <2 x double> %32, <2 x double> poison, <2 x i32> zeroinitializer
%34 = fdiv <2 x double> %31, %33
%35 = fmul <2 x double> %34, %34
%36 = extractelement <2 x double> %35, i64 1
%37 = extractelement <2 x double> %34, i64 0
%38 = tail call double @llvm.fmuladd.f64(double %37, double %37, double %36)
%39 = tail call double @sqrt(double %38)
%40 = fcmp une double %39, 0.000000e+00
br i1 %40, label %41, label %71
41: ; preds = %21
%42 = tail call double @llvm.fmuladd.f64(double %19, double %38, double 1.000000e+00)
%43 = tail call double @llvm.fmuladd.f64(double %42, double %39, double %22)
%44 = tail call double @llvm.fmuladd.f64(double %23, double %38, double 1.000000e+00)
%45 = fdiv double %43, %44
%46 = fsub double %39, %45
%47 = insertelement <2 x double> poison, double %46, i64 0
%48 = shufflevector <2 x double> %47, <2 x double> poison, <2 x i32> zeroinitializer
%49 = fmul <2 x double> %34, %48
%50 = insertelement <2 x double> poison, double %39, i64 0
%51 = shufflevector <2 x double> %50, <2 x double> poison, <2 x i32> zeroinitializer
%52 = fdiv <2 x double> %49, %51
%53 = fmul <2 x double> %52, %52
%54 = extractelement <2 x double> %53, i64 1
%55 = extractelement <2 x double> %52, i64 0
%56 = tail call double @llvm.fmuladd.f64(double %55, double %55, double %54)
%57 = tail call double @sqrt(double %56)
%58 = fcmp une double %57, 0.000000e+00
br i1 %58, label %59, label %71
59: ; preds = %41
%60 = tail call double @llvm.fmuladd.f64(double %19, double %56, double 1.000000e+00)
%61 = tail call double @llvm.fmuladd.f64(double %60, double %57, double %22)
%62 = tail call double @llvm.fmuladd.f64(double %23, double %56, double 1.000000e+00)
%63 = fdiv double %61, %62
%64 = fsub double %57, %63
%65 = insertelement <2 x double> poison, double %64, i64 0
%66 = shufflevector <2 x double> %65, <2 x double> poison, <2 x i32> zeroinitializer
%67 = fmul <2 x double> %52, %66
%68 = insertelement <2 x double> poison, double %57, i64 0
%69 = shufflevector <2 x double> %68, <2 x double> poison, <2 x i32> zeroinitializer
%70 = fdiv <2 x double> %67, %69
br label %71
71: ; preds = %21, %41, %59, %5
%72 = phi <2 x double> [ zeroinitializer, %5 ], [ zeroinitializer, %21 ], [ zeroinitializer, %41 ], [ %70, %59 ]
%73 = getelementptr inbounds double, double* %0, i64 1
%74 = getelementptr inbounds double, double* %0, i64 3
%75 = load double, double* %74
%76 = extractelement <2 x double> %72, i64 0
%77 = fdiv double %76, %75
%78 = load double, double* %0
%79 = fadd double %77, %78
store double %79, double* %3
%80 = load double, double* %74
%81 = extractelement <2 x double> %72, i64 1
%82 = fdiv double %81, %80
%83 = load double, double* %73
%84 = fadd double %82, %83
store double %84, double* %4
ret i32 0
}