#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 AnimationList {
  int dummy;
};

/* Variables and functions */
void *FindAnimation(char *, struct AnimationList *);
int /*<<< orphan*/ _GetMatrix(void *, double, double **);
int GetMatrix(struct AnimationList *al, char *name, double time,
              double m[4][4]) {
  int x, y;
  void *a = FindAnimation(name, al);
  if (a) {
    _GetMatrix(a, time, m);
    return 1;
  }
  for (x = 0; x < 4; x++) {
    for (y = 0; y < 4; y++) {
      if (x == y)
        m[x][y] = 1.0;
      else
        m[x][y] = 0.0;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<GetMatrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movsd  %xmm0,-0x20(%rbp)
mov    %rdx,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <FindAnimation@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
je     1173 <GetMatrix+0x53>
mov    -0x38(%rbp),%rdi
movsd  -0x20(%rbp),%xmm0
mov    -0x28(%rbp),%rsi
call   1040 <_GetMatrix@plt>
movl   $0x1,-0x4(%rbp)
jmp    120e <GetMatrix+0xee>
movl   $0x0,-0x2c(%rbp)
cmpl   $0x4,-0x2c(%rbp)
jge    1207 <GetMatrix+0xe7>
movl   $0x0,-0x30(%rbp)
cmpl   $0x4,-0x30(%rbp)
jge    11f4 <GetMatrix+0xd4>
mov    -0x2c(%rbp),%eax
cmp    -0x30(%rbp),%eax
jne    11c6 <GetMatrix+0xa6>
mov    -0x28(%rbp),%rax
movslq -0x2c(%rbp),%rcx
shl    $0x5,%rcx
add    %rcx,%rax
movslq -0x30(%rbp),%rcx
movsd  0xe44(%rip),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
jmp    11e1 <GetMatrix+0xc1>
mov    -0x28(%rbp),%rax
movslq -0x2c(%rbp),%rcx
shl    $0x5,%rcx
add    %rcx,%rax
movslq -0x30(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
jmp    11e6 <GetMatrix+0xc6>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    118b <GetMatrix+0x6b>
jmp    11f9 <GetMatrix+0xd9>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    117a <GetMatrix+0x5a>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetMatrix>:
push   %rbx
sub    $0x10,%rsp
mov    %rdx,%rbx
movsd  %xmm0,0x8(%rsp)
mov    %rdi,%rax
mov    %rsi,%rdi
mov    %rax,%rsi
call   1030 <FindAnimation@plt>
test   %rax,%rax
je     1159 <GetMatrix+0x39>
mov    %rax,%rdi
movsd  0x8(%rsp),%xmm0
mov    %rbx,%rsi
call   1040 <_GetMatrix@plt>
mov    $0x1,%eax
jmp    118f <GetMatrix+0x6f>
movabs $0x3ff0000000000000,%rax
mov    %rax,(%rbx)
xorps  %xmm0,%xmm0
movups %xmm0,0x8(%rbx)
movups %xmm0,0x18(%rbx)
mov    %rax,0x28(%rbx)
movups %xmm0,0x30(%rbx)
movups %xmm0,0x40(%rbx)
mov    %rax,0x50(%rbx)
movups %xmm0,0x58(%rbx)
movups %xmm0,0x68(%rbx)
mov    %rax,0x78(%rbx)
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.AnimationList = type { i32 }
define i32 @GetMatrix(%struct.AnimationList* %0, i8* %1, double %2, [4 x double]* %3) {
%5 = alloca i32
%6 = alloca %struct.AnimationList*
%7 = alloca i8*
%8 = alloca double
%9 = alloca [4 x double]*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i8*
store %struct.AnimationList* %0, %struct.AnimationList** %6
store i8* %1, i8** %7
store double %2, double* %8
store [4 x double]* %3, [4 x double]** %9
%13 = load i8*, i8** %7
%14 = load %struct.AnimationList*, %struct.AnimationList** %6
%15 = call i8* @FindAnimation(i8* %13, %struct.AnimationList* %14)
store i8* %15, i8** %12
%16 = load i8*, i8** %12
%17 = icmp ne i8* %16, null
br i1 %17, label %18, label %24
18: ; preds = %4
%19 = load i8*, i8** %12
%20 = load double, double* %8
%21 = load [4 x double]*, [4 x double]** %9
%22 = bitcast [4 x double]* %21 to double**
%23 = call i32 @_GetMatrix(i8* %19, double %20, double** %22)
store i32 1, i32* %5
br label %61
24: ; preds = %4
store i32 0, i32* %10
br label %25
25: ; preds = %57, %24
%26 = load i32, i32* %10
%27 = icmp slt i32 %26, 4
br i1 %27, label %28, label %60
28: ; preds = %25
store i32 0, i32* %11
br label %29
29: ; preds = %53, %28
%30 = load i32, i32* %11
%31 = icmp slt i32 %30, 4
br i1 %31, label %32, label %56
32: ; preds = %29
%33 = load i32, i32* %10
%34 = load i32, i32* %11
%35 = icmp eq i32 %33, %34
br i1 %35, label %36, label %44
36: ; preds = %32
%37 = load [4 x double]*, [4 x double]** %9
%38 = load i32, i32* %10
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds [4 x double], [4 x double]* %37, i64 %39
%41 = load i32, i32* %11
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds [4 x double], [4 x double]* %40, i64 0, i64 %42
store double 1.000000e+00, double* %43
br label %52
44: ; preds = %32
%45 = load [4 x double]*, [4 x double]** %9
%46 = load i32, i32* %10
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds [4 x double], [4 x double]* %45, i64 %47
%49 = load i32, i32* %11
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds [4 x double], [4 x double]* %48, i64 0, i64 %50
store double 0.000000e+00, double* %51
br label %52
52: ; preds = %44, %36
br label %53
53: ; preds = %52
%54 = load i32, i32* %11
%55 = add nsw i32 %54, 1
store i32 %55, i32* %11
br label %29
56: ; preds = %29
br label %57
57: ; preds = %56
%58 = load i32, i32* %10
%59 = add nsw i32 %58, 1
store i32 %59, i32* %10
br label %25
60: ; preds = %25
store i32 0, i32* %5
br label %61
61: ; preds = %60, %18
%62 = load i32, i32* %5
ret i32 %62
}

LLVM IR (-O2):
%struct.AnimationList = type { i32 }
define i32 @GetMatrix(%struct.AnimationList* %0, i8* %1, double %2, [4 x double]* %3) {
%5 = tail call i8* @FindAnimation(i8* %1, %struct.AnimationList* %0)
%6 = icmp eq i8* %5, null
br i1 %6, label %10, label %7
7: ; preds = %4
%8 = bitcast [4 x double]* %3 to double**
%9 = tail call i32 @_GetMatrix(i8* %5, double %2, double** %8)
br label %21
10: ; preds = %4
%11 = getelementptr inbounds [4 x double], [4 x double]* %3, i64 0, i64 0
store double 1.000000e+00, double* %11
%12 = getelementptr inbounds [4 x double], [4 x double]* %3, i64 0, i64 1
%13 = getelementptr inbounds [4 x double], [4 x double]* %3, i64 1, i64 1
%14 = bitcast double* %12 to i8*
store double 1.000000e+00, double* %13
%15 = getelementptr inbounds [4 x double], [4 x double]* %3, i64 1, i64 2
%16 = getelementptr inbounds [4 x double], [4 x double]* %3, i64 2, i64 2
%17 = bitcast double* %15 to i8*
store double 1.000000e+00, double* %16
%18 = getelementptr inbounds [4 x double], [4 x double]* %3, i64 2, i64 3
%19 = getelementptr inbounds [4 x double], [4 x double]* %3, i64 3, i64 3
%20 = bitcast double* %18 to i8*
store double 1.000000e+00, double* %19
br label %21
21: ; preds = %10, %7
%22 = phi i32 [ 1, %7 ], [ 0, %10 ]
ret i32 %22
}