#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 */
typedef int int64_t;

/* Variables and functions */
int64_t ROCKSTAR_fast3tree_find_largest_dim(float *min, float *max) {
  int64_t i, dim = 3 - 1;
  float d = max[3 - 1] - min[3 - 1], d2;
  for (i = 0; i < (3 - 1); i++) {
    d2 = max[i] - min[i];
    if (d2 > d) {
      d = d2;
      dim = i;
    }
  }
  return dim;
}


x86 assembly (clang, -O0):
<ROCKSTAR_fast3tree_find_largest_dim>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x2,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movss  0x8(%rax),%xmm0
mov    -0x8(%rbp),%rax
subss  0x8(%rax),%xmm0
movss  %xmm0,-0x1c(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x2,-0x14(%rbp)
jge    118c <ROCKSTAR_fast3tree_find_largest_dim+0x8c>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
subss  (%rax,%rcx,4),%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x20(%rbp),%xmm0
ucomiss -0x1c(%rbp),%xmm0
jbe    1179 <ROCKSTAR_fast3tree_find_largest_dim+0x79>
movss  -0x20(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    117e <ROCKSTAR_fast3tree_find_largest_dim+0x7e>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1131 <ROCKSTAR_fast3tree_find_largest_dim+0x31>
mov    -0x18(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ROCKSTAR_fast3tree_find_largest_dim>:
movss  0x8(%rsi),%xmm0
subss  0x8(%rdi),%xmm0
movss  (%rsi),%xmm1
subss  (%rdi),%xmm1
movss  0x4(%rsi),%xmm2
xor    %ecx,%ecx
ucomiss %xmm0,%xmm1
setbe  %cl
add    %ecx,%ecx
maxss  %xmm0,%xmm1
subss  0x4(%rdi),%xmm2
ucomiss %xmm1,%xmm2
mov    $0x1,%eax
cmovbe %ecx,%eax
ret

LLVM IR (-O0):
define i32 @ROCKSTAR_fast3tree_find_largest_dim(float* %0, float* %1) {
%3 = alloca float*
%4 = alloca float*
%5 = alloca i32
%6 = alloca i32
%7 = alloca float
%8 = alloca float
store float* %0, float** %3
store float* %1, float** %4
store i32 2, i32* %6
%9 = load float*, float** %4
%10 = getelementptr inbounds float, float* %9, i64 2
%11 = load float, float* %10
%12 = load float*, float** %3
%13 = getelementptr inbounds float, float* %12, i64 2
%14 = load float, float* %13
%15 = fsub float %11, %14
store float %15, float* %7
store i32 0, i32* %5
br label %16
16: ; preds = %38, %2
%17 = load i32, i32* %5
%18 = icmp slt i32 %17, 2
br i1 %18, label %19, label %41
19: ; preds = %16
%20 = load float*, float** %4
%21 = load i32, i32* %5
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds float, float* %20, i64 %22
%24 = load float, float* %23
%25 = load float*, float** %3
%26 = load i32, i32* %5
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds float, float* %25, i64 %27
%29 = load float, float* %28
%30 = fsub float %24, %29
store float %30, float* %8
%31 = load float, float* %8
%32 = load float, float* %7
%33 = fcmp ogt float %31, %32
br i1 %33, label %34, label %37
34: ; preds = %19
%35 = load float, float* %8
store float %35, float* %7
%36 = load i32, i32* %5
store i32 %36, i32* %6
br label %37
37: ; preds = %34, %19
br label %38
38: ; preds = %37
%39 = load i32, i32* %5
%40 = add nsw i32 %39, 1
store i32 %40, i32* %5
br label %16
41: ; preds = %16
%42 = load i32, i32* %6
ret i32 %42
}

LLVM IR (-O2):
define i32 @ROCKSTAR_fast3tree_find_largest_dim(float* nocapture %0, float* nocapture %1) {
%3 = getelementptr inbounds float, float* %1, i64 2
%4 = load float, float* %3
%5 = getelementptr inbounds float, float* %0, i64 2
%6 = load float, float* %5
%7 = fsub float %4, %6
%8 = load float, float* %1
%9 = load float, float* %0
%10 = fsub float %8, %9
%11 = fcmp ogt float %10, %7
%12 = select i1 %11, i32 0, i32 2
%13 = select i1 %11, float %10, float %7
%14 = getelementptr inbounds float, float* %1, i64 1
%15 = load float, float* %14
%16 = getelementptr inbounds float, float* %0, i64 1
%17 = load float, float* %16
%18 = fsub float %15, %17
%19 = fcmp ogt float %18, %13
%20 = select i1 %19, i32 1, i32 %12
ret i32 %20
}