#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 */
struct matrix {
  int dummy;
};

/* Variables and functions */
scalar_t__ matrix_multiply(struct matrix **, struct matrix **);
int eigenvectors_construct_u(struct matrix *vector, struct matrix *x,
                             struct matrix **res) {
  int result;
  result = 0;
  struct matrix *retval;
  struct matrix *params[2] = {x, vector};
  if (matrix_multiply(params, &retval) < 0)
    result = -1;
  else
    *res = retval;
  return result;
}


x86 assembly (clang, -O0):
<eigenvectors_construct_u>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x38(%rbp)
lea    -0x40(%rbp),%rdi
lea    -0x28(%rbp),%rsi
call   1030 <matrix_multiply@plt>
cmp    $0x0,%rax
jge    115e <eigenvectors_construct_u+0x4e>
movl   $0xffffffff,-0x1c(%rbp)
jmp    1169 <eigenvectors_construct_u+0x59>
mov    -0x28(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x1c(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<eigenvectors_construct_u>:
push   %rbx
sub    $0x20,%rsp
mov    %rdx,%rbx
mov    %rsi,0x10(%rsp)
mov    %rdi,0x18(%rsp)
lea    0x10(%rsp),%rdi
lea    0x8(%rsp),%rsi
call   1030 <matrix_multiply@plt>
test   %rax,%rax
js     1142 <eigenvectors_construct_u+0x32>
mov    0x8(%rsp),%rax
mov    %rax,(%rbx)
xor    %eax,%eax
jmp    1147 <eigenvectors_construct_u+0x37>
mov    $0xffffffff,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.matrix = type { i32 }
define i32 @eigenvectors_construct_u(%struct.matrix* %0, %struct.matrix* %1, %struct.matrix** %2) {
%4 = alloca %struct.matrix*
%5 = alloca %struct.matrix*
%6 = alloca %struct.matrix**
%7 = alloca i32
%8 = alloca %struct.matrix*
%9 = alloca [2 x %struct.matrix*]
store %struct.matrix* %0, %struct.matrix** %4
store %struct.matrix* %1, %struct.matrix** %5
store %struct.matrix** %2, %struct.matrix*** %6
store i32 0, i32* %7
%10 = getelementptr inbounds [2 x %struct.matrix*], [2 x %struct.matrix*]* %9, i64 0, i64 0
%11 = load %struct.matrix*, %struct.matrix** %5
store %struct.matrix* %11, %struct.matrix** %10
%12 = getelementptr inbounds %struct.matrix*, %struct.matrix** %10, i64 1
%13 = load %struct.matrix*, %struct.matrix** %4
store %struct.matrix* %13, %struct.matrix** %12
%14 = getelementptr inbounds [2 x %struct.matrix*], [2 x %struct.matrix*]* %9, i64 0, i64 0
%15 = call i64 @matrix_multiply(%struct.matrix** %14, %struct.matrix** %8)
%16 = icmp slt i64 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %3
store i32 -1, i32* %7
br label %21
18: ; preds = %3
%19 = load %struct.matrix*, %struct.matrix** %8
%20 = load %struct.matrix**, %struct.matrix*** %6
store %struct.matrix* %19, %struct.matrix** %20
br label %21
21: ; preds = %18, %17
%22 = load i32, i32* %7
ret i32 %22
}

LLVM IR (-O2):
%struct.matrix = type { i32 }
define i32 @eigenvectors_construct_u(%struct.matrix* %0, %struct.matrix* %1, %struct.matrix** nocapture writeonly %2) {
%4 = alloca %struct.matrix*
%5 = alloca [2 x %struct.matrix*]
%6 = bitcast %struct.matrix** %4 to i8*
%7 = bitcast [2 x %struct.matrix*]* %5 to i8*
%8 = getelementptr inbounds [2 x %struct.matrix*], [2 x %struct.matrix*]* %5, i64 0, i64 0
store %struct.matrix* %1, %struct.matrix** %8
%9 = getelementptr inbounds [2 x %struct.matrix*], [2 x %struct.matrix*]* %5, i64 0, i64 1
store %struct.matrix* %0, %struct.matrix** %9
%10 = call i64 @matrix_multiply(%struct.matrix** %8, %struct.matrix** %4)
%11 = icmp slt i64 %10, 0
br i1 %11, label %14, label %12
12: ; preds = %3
%13 = load %struct.matrix*, %struct.matrix** %4
store %struct.matrix* %13, %struct.matrix** %2
br label %14
14: ; preds = %3, %12
%15 = phi i32 [ 0, %12 ], [ -1, %3 ]
ret i32 %15
}