#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*/ mat4_set_identity(float **);
int /*<<< orphan*/ vec3_copy(float const *, float *);
void bbox_from_extents(float box[4][4], const float pos[3], float hw, float hh,
                       float hd) {
  mat4_set_identity(box);
  vec3_copy(pos, box[3]);
  box[0][0] = hw;
  box[1][1] = hh;
  box[2][2] = hd;
}


x86 assembly (clang, -O0):
<bbox_from_extents>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movss  %xmm0,-0x14(%rbp)
movss  %xmm1,-0x18(%rbp)
movss  %xmm2,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <mat4_set_identity@plt>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
add    $0x30,%rsi
call   1040 <vec3_copy@plt>
movss  -0x14(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0x18(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x14(%rax)
movss  -0x1c(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x28(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bbox_from_extents>:
push   %r14
push   %rbx
sub    $0x18,%rsp
movss  %xmm2,0x14(%rsp)
movss  %xmm1,0x10(%rsp)
movss  %xmm0,0xc(%rsp)
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <mat4_set_identity@plt>
lea    0x30(%rbx),%rsi
mov    %r14,%rdi
call   1040 <vec3_copy@plt>
movss  0xc(%rsp),%xmm0
movss  %xmm0,(%rbx)
movss  0x10(%rsp),%xmm0
movss  %xmm0,0x14(%rbx)
movss  0x14(%rsp),%xmm0
movss  %xmm0,0x28(%rbx)
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @bbox_from_extents([4 x float]* %0, float* %1, float %2, float %3, float %4) {
%6 = alloca [4 x float]*
%7 = alloca float*
%8 = alloca float
%9 = alloca float
%10 = alloca float
store [4 x float]* %0, [4 x float]** %6
store float* %1, float** %7
store float %2, float* %8
store float %3, float* %9
store float %4, float* %10
%11 = load [4 x float]*, [4 x float]** %6
%12 = bitcast [4 x float]* %11 to float**
%13 = call i32 @mat4_set_identity(float** %12)
%14 = load float*, float** %7
%15 = load [4 x float]*, [4 x float]** %6
%16 = getelementptr inbounds [4 x float], [4 x float]* %15, i64 3
%17 = getelementptr inbounds [4 x float], [4 x float]* %16, i64 0, i64 0
%18 = call i32 @vec3_copy(float* %14, float* %17)
%19 = load float, float* %8
%20 = load [4 x float]*, [4 x float]** %6
%21 = getelementptr inbounds [4 x float], [4 x float]* %20, i64 0
%22 = getelementptr inbounds [4 x float], [4 x float]* %21, i64 0, i64 0
store float %19, float* %22
%23 = load float, float* %9
%24 = load [4 x float]*, [4 x float]** %6
%25 = getelementptr inbounds [4 x float], [4 x float]* %24, i64 1
%26 = getelementptr inbounds [4 x float], [4 x float]* %25, i64 0, i64 1
store float %23, float* %26
%27 = load float, float* %10
%28 = load [4 x float]*, [4 x float]** %6
%29 = getelementptr inbounds [4 x float], [4 x float]* %28, i64 2
%30 = getelementptr inbounds [4 x float], [4 x float]* %29, i64 0, i64 2
store float %27, float* %30
ret void
}

LLVM IR (-O2):
define void @bbox_from_extents([4 x float]* %0, float* %1, float %2, float %3, float %4) {
%6 = bitcast [4 x float]* %0 to float**
%7 = tail call i32 @mat4_set_identity(float** %6)
%8 = getelementptr inbounds [4 x float], [4 x float]* %0, i64 3, i64 0
%9 = tail call i32 @vec3_copy(float* %1, float* %8)
%10 = getelementptr inbounds [4 x float], [4 x float]* %0, i64 0, i64 0
store float %2, float* %10
%11 = getelementptr inbounds [4 x float], [4 x float]* %0, i64 1, i64 1
store float %3, float* %11
%12 = getelementptr inbounds [4 x float], [4 x float]* %0, i64 2, i64 2
store float %4, float* %12
ret void
}