#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*/ floatminpos(float *, size_t, float *);
float logf(float);
void farrlog(float *in, size_t size) {
  float minpos, *fpt, forneg;
  floatminpos(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):
<farrlog>:
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    -0x14(%rbp),%rdx
call   1040 <floatminpos@plt>
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x14(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xe8e(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
call   1030 <logf@plt>
movss  %xmm0,-0x24(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jbe    11d3 <farrlog+0xb3>
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
call   1030 <logf@plt>
mov    -0x8(%rbp),%rax
movss  %xmm0,(%rax)
jmp    11e0 <farrlog+0xc0>
movss  -0x24(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,(%rax)
jmp    11e5 <farrlog+0xc5>
mov    -0x8(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x8(%rbp)
cmp    -0x20(%rbp),%rax
jb     11a5 <farrlog+0x85>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<farrlog>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0x4(%rsp),%rdx
call   1040 <floatminpos@plt>
movss  0x4(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xeba(%rip),%xmm1
mulsd  %xmm0,%xmm1
addsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
call   1030 <logf@plt>
movaps %xmm0,%xmm2
lea    (%rbx,%r14,4),%r14
xorps  %xmm3,%xmm3
movss  %xmm0,(%rsp)
jmp    117d <farrlog+0x5d>
nopl   0x0(%rax,%rax,1)
movss  %xmm0,(%rbx)
add    $0x4,%rbx
cmp    %r14,%rbx
jae    119b <farrlog+0x7b>
movss  (%rbx),%xmm1
ucomiss %xmm3,%xmm1
movaps %xmm2,%xmm0
jbe    1170 <farrlog+0x50>
movaps %xmm1,%xmm0
call   1030 <logf@plt>
xorps  %xmm3,%xmm3
movss  (%rsp),%xmm2
jmp    1170 <farrlog+0x50>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

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