#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 double ldmin(long double, long double);
long double ldmina(long double a[], int length) {
  long double min = a[0];
  int i;
  for (i = 0; i < length; i++) {
    min = ldmin(min, a[i]);
  }
  return min;
}


x86 assembly (clang, -O0):
<ldmina>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
fldt   (%rax)
fstpt  -0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    116b <ldmina+0x5b>
fldt   -0x20(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x24(%rbp),%rcx
shl    $0x4,%rcx
fldt   (%rax,%rcx,1)
mov    %rsp,%rax
fstpt  0x10(%rax)
fstpt  (%rax)
call   1030 <ldmin@plt>
fstpt  -0x20(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    112f <ldmina+0x1f>
fldt   -0x20(%rbp)
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ldmina>:
push   %rbp
push   %rbx
sub    $0x28,%rsp
fldt   (%rdi)
test   %esi,%esi
jle    1158 <ldmina+0x48>
mov    %esi,%ebp
mov    %rdi,%rbx
fld    %st(0)
fstpt  0x10(%rsp)
fstpt  (%rsp)
call   1030 <ldmin@plt>
cmp    $0x1,%ebp
je     1158 <ldmina+0x48>
mov    %ebp,%ebp
add    $0xffffffffffffffff,%rbp
add    $0x10,%rbx
xchg   %ax,%ax
fldt   (%rbx)
fstpt  0x10(%rsp)
fstpt  (%rsp)
call   1030 <ldmin@plt>
add    $0x10,%rbx
add    $0xffffffffffffffff,%rbp
jne    1140 <ldmina+0x30>
add    $0x28,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define x86_fp80 @ldmina(x86_fp80* %0, i32 %1) {
%3 = alloca x86_fp80*
%4 = alloca i32
%5 = alloca x86_fp80
%6 = alloca i32
store x86_fp80* %0, x86_fp80** %3
store i32 %1, i32* %4
%7 = load x86_fp80*, x86_fp80** %3
%8 = getelementptr inbounds x86_fp80, x86_fp80* %7, i64 0
%9 = load x86_fp80, x86_fp80* %8
store x86_fp80 %9, x86_fp80* %5
store i32 0, i32* %6
br label %10
10: ; preds = %22, %2
%11 = load i32, i32* %6
%12 = load i32, i32* %4
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %25
14: ; preds = %10
%15 = load x86_fp80, x86_fp80* %5
%16 = load x86_fp80*, x86_fp80** %3
%17 = load i32, i32* %6
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds x86_fp80, x86_fp80* %16, i64 %18
%20 = load x86_fp80, x86_fp80* %19
%21 = call x86_fp80 @ldmin(x86_fp80 %15, x86_fp80 %20)
store x86_fp80 %21, x86_fp80* %5
br label %22
22: ; preds = %14
%23 = load i32, i32* %6
%24 = add nsw i32 %23, 1
store i32 %24, i32* %6
br label %10
25: ; preds = %10
%26 = load x86_fp80, x86_fp80* %5
ret x86_fp80 %26
}

LLVM IR (-O2):
define x86_fp80 @ldmina(x86_fp80* nocapture %0, i32 %1) {
%3 = load x86_fp80, x86_fp80* %0
%4 = icmp sgt i32 %1, 0
br i1 %4, label %5, label %17
5: ; preds = %2
%6 = zext i32 %1 to i64
%7 = tail call x86_fp80 @ldmin(x86_fp80 %3, x86_fp80 %3)
%8 = icmp eq i32 %1, 1
br i1 %8, label %17, label %9
9: ; preds = %5, %9
%10 = phi i64 [ %15, %9 ], [ 1, %5 ]
%11 = phi x86_fp80 [ %14, %9 ], [ %7, %5 ]
%12 = getelementptr inbounds x86_fp80, x86_fp80* %0, i64 %10
%13 = load x86_fp80, x86_fp80* %12
%14 = tail call x86_fp80 @ldmin(x86_fp80 %11, x86_fp80 %13)
%15 = add nuw nsw i64 %10, 1
%16 = icmp eq i64 %15, %6
br i1 %16, label %17, label %9
17: ; preds = %9, %5, %2
%18 = phi x86_fp80 [ %3, %2 ], [ %7, %5 ], [ %14, %9 ]
ret x86_fp80 %18
}