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


x86 assembly (clang, -O0):
<larrlog>:
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   1030 <longminpos@plt>
mov    -0x18(%rbp),%rdi
call   1040 <logf@plt>
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
jle    118a <larrlog+0x6a>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
call   1040 <logf@plt>
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
jmp    1195 <larrlog+0x75>
mov    -0x28(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
jmp    119a <larrlog+0x7a>
mov    -0x8(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x8(%rbp)
cmp    -0x20(%rbp),%rax
jb     1161 <larrlog+0x41>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<larrlog>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%r15
mov    %rdi,%rbx
lea    0x8(%rsp),%rdx
call   1030 <longminpos@plt>
mov    0x8(%rsp),%rdi
call   1040 <logf@plt>
mov    %rax,%r14
lea    (%rbx,%r15,8),%r15
jmp    115c <larrlog+0x3c>
nopl   0x0(%rax)
mov    %rax,(%rbx)
add    $0x8,%rbx
cmp    %r15,%rbx
jae    116e <larrlog+0x4e>
mov    (%rbx),%rdi
mov    %r14,%rax
test   %rdi,%rdi
jle    1150 <larrlog+0x30>
call   1040 <logf@plt>
jmp    1150 <larrlog+0x30>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @larrlog(i64* %0, i64 %1) {
%3 = alloca i64*
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64*
%7 = alloca i64
store i64* %0, i64** %3
store i64 %1, i64* %4
%8 = load i64*, i64** %3
%9 = load i64, i64* %4
%10 = call i32 @longminpos(i64* %8, i64 %9, i64* %5)
%11 = load i64, i64* %5
%12 = call i64 @logf(i64 %11)
store i64 %12, i64* %7
%13 = load i64*, i64** %3
%14 = load i64, i64* %4
%15 = getelementptr inbounds i64, i64* %13, i64 %14
store i64* %15, i64** %6
br label %16
16: ; preds = %29, %2
%17 = load i64*, i64** %3
%18 = load i64, i64* %17
%19 = icmp sgt i64 %18, 0
br i1 %19, label %20, label %25
20: ; preds = %16
%21 = load i64*, i64** %3
%22 = load i64, i64* %21
%23 = call i64 @logf(i64 %22)
%24 = load i64*, i64** %3
store i64 %23, i64* %24
br label %28
25: ; preds = %16
%26 = load i64, i64* %7
%27 = load i64*, i64** %3
store i64 %26, i64* %27
br label %28
28: ; preds = %25, %20
br label %29
29: ; preds = %28
%30 = load i64*, i64** %3
%31 = getelementptr inbounds i64, i64* %30, i32 1
store i64* %31, i64** %3
%32 = load i64*, i64** %6
%33 = icmp ult i64* %31, %32
br i1 %33, label %16, label %34
34: ; preds = %29
ret void
}

LLVM IR (-O2):
define void @larrlog(i64* %0, i64 %1) {
%3 = alloca i64
%4 = bitcast i64* %3 to i8*
%5 = call i32 @longminpos(i64* %0, i64 %1, i64* %3)
%6 = load i64, i64* %3
%7 = call i64 @logf(i64 %6)
%8 = getelementptr inbounds i64, i64* %0, i64 %1
br label %9
9: ; preds = %15, %2
%10 = phi i64* [ %0, %2 ], [ %17, %15 ]
%11 = load i64, i64* %10
%12 = icmp sgt i64 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %9
%14 = call i64 @logf(i64 %11)
br label %15
15: ; preds = %9, %13
%16 = phi i64 [ %14, %13 ], [ %7, %9 ]
store i64 %16, i64* %10
%17 = getelementptr inbounds i64, i64* %10, i64 1
%18 = icmp ult i64* %17, %8
br i1 %18, label %9, label %19
19: ; preds = %15
ret void
}