#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_mul_vec4(float const **, float *, float *);
float vec3_norm(float *);
void box_get_size(const float b[4][4], float out[3]) {
  float v[3][4] = {{1, 0, 0, 0}, {0, 1, 0, 0}, {0, 0, 1, 0}};
  int i;
  for (i = 0; i < 3; i++) {
    mat4_mul_vec4(b, v[i], v[i]);
    out[i] = vec3_norm(v[i]);
  }
}


x86 assembly (clang, -O0):
<box_get_size>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x30,%edx
call   1040 <memset@plt>
movss  0xea8(%rip),%xmm0
movss  %xmm0,-0x40(%rbp)
movss  0xe9b(%rip),%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  0xe8e(%rip),%xmm0
movss  %xmm0,-0x18(%rbp)
movl   $0x0,-0x44(%rbp)
cmpl   $0x3,-0x44(%rbp)
jge    11de <box_get_size+0xae>
mov    -0x8(%rbp),%rdi
movslq -0x44(%rbp),%rax
lea    -0x40(%rbp),%rsi
shl    $0x4,%rax
add    %rax,%rsi
movslq -0x44(%rbp),%rax
lea    -0x40(%rbp),%rdx
shl    $0x4,%rax
add    %rax,%rdx
call   1030 <mat4_mul_vec4@plt>
movslq -0x44(%rbp),%rax
lea    -0x40(%rbp),%rdi
shl    $0x4,%rax
add    %rax,%rdi
call   1050 <vec3_norm@plt>
mov    -0x10(%rbp),%rax
movslq -0x44(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    117e <box_get_size+0x4e>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<box_get_size>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x30,%rsp
mov    %rsi,%r15
mov    %rdi,%rbx
xorps  %xmm0,%xmm0
movaps %xmm0,(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,0x20(%rsp)
lea    0x20(%rsp),%r14
lea    0x10(%rsp),%r12
movl   $0x3f800000,(%rsp)
movl   $0x3f800000,0x14(%rsp)
3f
movl   $0x3f800000,0x28(%rsp)
3f
mov    %rsp,%r13
mov    %r13,%rsi
mov    %r13,%rdx
call   1030 <mat4_mul_vec4@plt>
mov    %r13,%rdi
call   1040 <vec3_norm@plt>
movss  %xmm0,(%r15)
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %r12,%rdx
call   1030 <mat4_mul_vec4@plt>
mov    %r12,%rdi
call   1040 <vec3_norm@plt>
movss  %xmm0,0x4(%r15)
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r14,%rdx
call   1030 <mat4_mul_vec4@plt>
mov    %r14,%rdi
call   1040 <vec3_norm@plt>
movss  %xmm0,0x8(%r15)
add    $0x30,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @box_get_size([4 x float]* %0, float* nocapture writeonly %1) {
%3 = alloca [3 x [4 x float]]
%4 = bitcast [3 x [4 x float]]* %3 to i8*
%5 = getelementptr inbounds [3 x [4 x float]], [3 x [4 x float]]* %3, i64 0, i64 0, i64 0
store float 1.000000e+00, float* %5
%6 = getelementptr inbounds [3 x [4 x float]], [3 x [4 x float]]* %3, i64 0, i64 1, i64 1
store float 1.000000e+00, float* %6
%7 = getelementptr inbounds [3 x [4 x float]], [3 x [4 x float]]* %3, i64 0, i64 2, i64 2
store float 1.000000e+00, float* %7
%8 = bitcast [4 x float]* %0 to float**
%9 = call i32 @mat4_mul_vec4(float** %8, float* %5, float* %5)
%10 = call float @vec3_norm(float* %5)
store float %10, float* %1
%11 = getelementptr inbounds [3 x [4 x float]], [3 x [4 x float]]* %3, i64 0, i64 1, i64 0
%12 = call i32 @mat4_mul_vec4(float** %8, float* %11, float* %11)
%13 = call float @vec3_norm(float* %11)
%14 = getelementptr inbounds float, float* %1, i64 1
store float %13, float* %14
%15 = getelementptr inbounds [3 x [4 x float]], [3 x [4 x float]]* %3, i64 0, i64 2, i64 0
%16 = call i32 @mat4_mul_vec4(float** %8, float* %15, float* %15)
%17 = call float @vec3_norm(float* %15)
%18 = getelementptr inbounds float, float* %1, i64 2
store float %17, float* %18
ret void
}