#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 /*<<< orphan*/ doubleminpos(double *, size_t, double *);
double logf(double);
void darrlog(double *in, size_t size) {
  double minpos, *fpt, forneg;
  doubleminpos(in, size, &minpos);
  minpos -= minpos * 0.1;
  {
    forneg = logf(minpos);
    fpt = in + size;
    do {
      if (*in > 0)
        *in = logf(*in);
      else
        *in = forneg;
    } while (++in < fpt);
  }
}


x86 assembly (clang, -O0):
<darrlog>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0x18(%rbp),%rdx
call   1040 <doubleminpos@plt>
movsd  -0x18(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xe96(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1030 <logf@plt>
movsd  %xmm0,-0x28(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    11c8 <darrlog+0xa8>
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
call   1030 <logf@plt>
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
jmp    11d5 <darrlog+0xb5>
movsd  -0x28(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
jmp    11da <darrlog+0xba>
mov    -0x8(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x8(%rbp)
cmp    -0x20(%rbp),%rax
jb     1199 <darrlog+0x79>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<darrlog>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0x10(%rsp),%rdx
call   1040 <doubleminpos@plt>
movsd  0x10(%rsp),%xmm1
movsd  0xebb(%rip),%xmm0
mulsd  %xmm1,%xmm0
addsd  %xmm1,%xmm0
call   1030 <logf@plt>
movapd %xmm0,%xmm2
lea    (%rbx,%r14,8),%r14
xorpd  %xmm3,%xmm3
movsd  %xmm0,0x8(%rsp)
jmp    117d <darrlog+0x5d>
cs nopw 0x0(%rax,%rax,1)
movsd  %xmm0,(%rbx)
add    $0x8,%rbx
cmp    %r14,%rbx
jae    11a0 <darrlog+0x80>
movsd  (%rbx),%xmm1
ucomisd %xmm3,%xmm1
movapd %xmm2,%xmm0
jbe    1170 <darrlog+0x50>
movapd %xmm1,%xmm0
call   1030 <logf@plt>
xorpd  %xmm3,%xmm3
movsd  0x8(%rsp),%xmm2
jmp    1170 <darrlog+0x50>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @darrlog(double* %0, i64 %1) {
%3 = alloca double*
%4 = alloca i64
%5 = alloca double
%6 = alloca double*
%7 = alloca double
store double* %0, double** %3
store i64 %1, i64* %4
%8 = load double*, double** %3
%9 = load i64, i64* %4
%10 = call i32 @doubleminpos(double* %8, i64 %9, double* %5)
%11 = load double, double* %5
%12 = load double, double* %5
%13 = fneg double %11
%14 = call double @llvm.fmuladd.f64(double %13, double 1.000000e-01, double %12)
store double %14, double* %5
%15 = load double, double* %5
%16 = call double @logf(double %15)
store double %16, double* %7
%17 = load double*, double** %3
%18 = load i64, i64* %4
%19 = getelementptr inbounds double, double* %17, i64 %18
store double* %19, double** %6
br label %20
20: ; preds = %33, %2
%21 = load double*, double** %3
%22 = load double, double* %21
%23 = fcmp ogt double %22, 0.000000e+00
br i1 %23, label %24, label %29
24: ; preds = %20
%25 = load double*, double** %3
%26 = load double, double* %25
%27 = call double @logf(double %26)
%28 = load double*, double** %3
store double %27, double* %28
br label %32
29: ; preds = %20
%30 = load double, double* %7
%31 = load double*, double** %3
store double %30, double* %31
br label %32
32: ; preds = %29, %24
br label %33
33: ; preds = %32
%34 = load double*, double** %3
%35 = getelementptr inbounds double, double* %34, i32 1
store double* %35, double** %3
%36 = load double*, double** %6
%37 = icmp ult double* %35, %36
br i1 %37, label %20, label %38
38: ; preds = %33
ret void
}

LLVM IR (-O2):
define void @darrlog(double* %0, i64 %1) {
%3 = alloca double
%4 = bitcast double* %3 to i8*
%5 = call i32 @doubleminpos(double* %0, i64 %1, double* %3)
%6 = load double, double* %3
%7 = fneg double %6
%8 = call double @llvm.fmuladd.f64(double %7, double 1.000000e-01, double %6)
%9 = call double @logf(double %8)
%10 = getelementptr inbounds double, double* %0, i64 %1
br label %11
11: ; preds = %17, %2
%12 = phi double* [ %0, %2 ], [ %19, %17 ]
%13 = load double, double* %12
%14 = fcmp ogt double %13, 0.000000e+00
br i1 %14, label %15, label %17
15: ; preds = %11
%16 = call double @logf(double %13)
br label %17
17: ; preds = %11, %15
%18 = phi double [ %16, %15 ], [ %9, %11 ]
store double %18, double* %12
%19 = getelementptr inbounds double, double* %12, i64 1
%20 = icmp ult double* %19, %10
br i1 %20, label %11, label %21
21: ; preds = %17
ret void
}