#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 didxmaxval(int, int, int *, int, int, double *);
double didxminval(int, int, int *, int, int, double *);
void update_bbox(int l, int u, int *idx, int nd, double *xi, int sd,
                 double *ixmin, double *ixmax, double *oxmin, double *oxmax) {
  for (int k = 0; k < nd; k++) {
    if (k == sd) {
      oxmin[k] = didxminval(l, u, idx, k, nd, xi);
      oxmax[k] = didxmaxval(l, u, idx, k, nd, xi);
    } else {
      oxmin[k] = ixmin[k];
      oxmax[k] = ixmax[k];
    }
  }
}


x86 assembly (clang, -O0):
<update_bbox>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0x28(%rbp),%rax
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9d,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1206 <update_bbox+0xe6>
mov    -0x28(%rbp),%eax
cmp    -0x24(%rbp),%eax
jne    11bf <update_bbox+0x9f>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%rdx
mov    -0x28(%rbp),%ecx
mov    -0x14(%rbp),%r8d
mov    -0x20(%rbp),%r9
call   1030 <didxminval@plt>
mov    0x20(%rbp),%rax
movslq -0x28(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%rdx
mov    -0x28(%rbp),%ecx
mov    -0x14(%rbp),%r8d
mov    -0x20(%rbp),%r9
call   1040 <didxmaxval@plt>
mov    0x28(%rbp),%rax
movslq -0x28(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
jmp    11f3 <update_bbox+0xd3>
mov    0x10(%rbp),%rax
movslq -0x28(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    0x20(%rbp),%rax
movslq -0x28(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    0x18(%rbp),%rax
movslq -0x28(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    0x28(%rbp),%rax
movslq -0x28(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
jmp    11f8 <update_bbox+0xd8>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1154 <update_bbox+0x34>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<update_bbox>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %r9d,0xc(%rsp)
mov    %r8,0x30(%rsp)
mov    %rdx,0x28(%rsp)
mov    %esi,0x14(%rsp)
mov    %edi,0x10(%rsp)
mov    %ecx,0x8(%rsp)
test   %ecx,%ecx
jle    121e <update_bbox+0xfe>
mov    0x88(%rsp),%rax
mov    0xc(%rsp),%edx
mov    0x8(%rsp),%esi
xor    %r12d,%r12d
mov    %rdx,0x18(%rsp)
mov    %rsi,0x20(%rsp)
mov    0x14(%rsp),%r14d
mov    0x28(%rsp),%rbp
mov    0xc(%rsp),%r13d
mov    0x8(%rsp),%r15d
mov    0x30(%rsp),%rbx
jmp    11c3 <update_bbox+0xa3>
nopl   0x0(%rax)
mov    0x70(%rsp),%rcx
movsd  (%rcx,%r12,8),%xmm0
mov    0x80(%rsp),%rcx
movsd  %xmm0,(%rcx,%r12,8)
mov    0x78(%rsp),%rcx
movsd  (%rcx,%r12,8),%xmm0
movsd  %xmm0,(%rax,%r12,8)
add    $0x1,%r12
cmp    %r12,%rsi
je     121e <update_bbox+0xfe>
cmp    %r12,%rdx
jne    1190 <update_bbox+0x70>
mov    0x10(%rsp),%edi
mov    %r14d,%esi
mov    %rbp,%rdx
mov    %r13d,%ecx
mov    %r15d,%r8d
mov    %rbx,%r9
call   1030 <didxminval@plt>
mov    0x80(%rsp),%rax
mov    0x18(%rsp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    0x10(%rsp),%edi
mov    %r14d,%esi
mov    %rbp,%rdx
mov    %r13d,%ecx
mov    %r15d,%r8d
mov    %rbx,%r9
call   1040 <didxmaxval@plt>
mov    0x20(%rsp),%rsi
mov    0x18(%rsp),%rdx
mov    0x88(%rsp),%rax
jmp    11b4 <update_bbox+0x94>
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @update_bbox(i32 %0, i32 %1, i32* %2, i32 %3, double* %4, i32 %5, double* %6, double* %7, double* %8, double* %9) {
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32*
%14 = alloca i32
%15 = alloca double*
%16 = alloca i32
%17 = alloca double*
%18 = alloca double*
%19 = alloca double*
%20 = alloca double*
%21 = alloca i32
store i32 %0, i32* %11
store i32 %1, i32* %12
store i32* %2, i32** %13
store i32 %3, i32* %14
store double* %4, double** %15
store i32 %5, i32* %16
store double* %6, double** %17
store double* %7, double** %18
store double* %8, double** %19
store double* %9, double** %20
store i32 0, i32* %21
br label %22
22: ; preds = %73, %10
%23 = load i32, i32* %21
%24 = load i32, i32* %14
%25 = icmp slt i32 %23, %24
br i1 %25, label %26, label %76
26: ; preds = %22
%27 = load i32, i32* %21
%28 = load i32, i32* %16
%29 = icmp eq i32 %27, %28
br i1 %29, label %30, label %53
30: ; preds = %26
%31 = load i32, i32* %11
%32 = load i32, i32* %12
%33 = load i32*, i32** %13
%34 = load i32, i32* %21
%35 = load i32, i32* %14
%36 = load double*, double** %15
%37 = call double @didxminval(i32 %31, i32 %32, i32* %33, i32 %34, i32 %35, double* %36)
%38 = load double*, double** %19
%39 = load i32, i32* %21
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds double, double* %38, i64 %40
store double %37, double* %41
%42 = load i32, i32* %11
%43 = load i32, i32* %12
%44 = load i32*, i32** %13
%45 = load i32, i32* %21
%46 = load i32, i32* %14
%47 = load double*, double** %15
%48 = call double @didxmaxval(i32 %42, i32 %43, i32* %44, i32 %45, i32 %46, double* %47)
%49 = load double*, double** %20
%50 = load i32, i32* %21
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds double, double* %49, i64 %51
store double %48, double* %52
br label %72
53: ; preds = %26
%54 = load double*, double** %17
%55 = load i32, i32* %21
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds double, double* %54, i64 %56
%58 = load double, double* %57
%59 = load double*, double** %19
%60 = load i32, i32* %21
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds double, double* %59, i64 %61
store double %58, double* %62
%63 = load double*, double** %18
%64 = load i32, i32* %21
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds double, double* %63, i64 %65
%67 = load double, double* %66
%68 = load double*, double** %20
%69 = load i32, i32* %21
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds double, double* %68, i64 %70
store double %67, double* %71
br label %72
72: ; preds = %53, %30
br label %73
73: ; preds = %72
%74 = load i32, i32* %21
%75 = add nsw i32 %74, 1
store i32 %75, i32* %21
br label %22
76: ; preds = %22
ret void
}

LLVM IR (-O2):
define void @update_bbox(i32 %0, i32 %1, i32* %2, i32 %3, double* %4, i32 %5, double* nocapture %6, double* nocapture %7, double* nocapture writeonly %8, double* nocapture writeonly %9) {
%11 = icmp sgt i32 %3, 0
br i1 %11, label %12, label %16
12: ; preds = %10
%13 = zext i32 %5 to i64
%14 = zext i32 %3 to i64
%15 = getelementptr inbounds double, double* %8, i64 %13
br label %17
16: ; preds = %29, %10
ret void
17: ; preds = %12, %29
%18 = phi i64 [ 0, %12 ], [ %32, %29 ]
%19 = icmp eq i64 %18, %13
br i1 %19, label %20, label %23
20: ; preds = %17
%21 = tail call double @didxminval(i32 %0, i32 %1, i32* %2, i32 %5, i32 %3, double* %4)
store double %21, double* %15
%22 = tail call double @didxmaxval(i32 %0, i32 %1, i32* %2, i32 %5, i32 %3, double* %4)
br label %29
23: ; preds = %17
%24 = getelementptr inbounds double, double* %6, i64 %18
%25 = load double, double* %24
%26 = getelementptr inbounds double, double* %8, i64 %18
store double %25, double* %26
%27 = getelementptr inbounds double, double* %7, i64 %18
%28 = load double, double* %27
br label %29
29: ; preds = %20, %23
%30 = phi double [ %22, %20 ], [ %28, %23 ]
%31 = getelementptr inbounds double, double* %9, i64 %18
store double %30, double* %31
%32 = add nuw nsw i64 %18, 1
%33 = icmp eq i64 %32, %14
br i1 %33, label %16, label %17
}