#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 */
char *VKApiVersion();
int /*<<< orphan*/ VKDofCode(int, int, int /*<<< orphan*/);
char *VKErrorMessage(int);
int /*<<< orphan*/ VKModelCreate(int, char *);
int /*<<< orphan*/ VKModelCreateForce(int, int, int, int, int /*<<< orphan*/,
                                      int, int /*<<< orphan*/);
int /*<<< orphan*/ VKModelCreateMaterial(int, int, int, double, char *);
int /*<<< orphan*/ VKModelCreateNode(int, int, double, double, double);
int /*<<< orphan*/ VKModelCreateProperty(int, int, int, int, char *);
int /*<<< orphan*/ VKModelCreateRod(int, int, int, int, int);
int /*<<< orphan*/ VKModelCreateSpc(int, int, int /*<<< orphan*/, int);
int VKModelPerformStaticAnalysis(int);
int /*<<< orphan*/ VKStaticAnalysisPrintResults(int);
int /*<<< orphan*/ printf(char *, char *);
int main(int argc, char *argv[]) {
  printf("Valkyrie Version = %s\n", VKApiVersion());
  VKModelCreate(1, "three-bar");
  VKModelCreateMaterial(1, 1, 30e6, 7800.0, "");
  VKModelCreateProperty(1, 1, 1, 2, "");
  VKModelCreateNode(1, 1, 0.0, 0.0, 0.0);
  VKModelCreateNode(1, 2, 10.0, 0.0, 0.0);
  VKModelCreateNode(1, 3, 10.0, 10.0, 0.0);
  VKModelCreateNode(1, 4, 0.0, 10.0, 0.0);
  VKModelCreateRod(1, 1, 1, 1, 2);
  VKModelCreateRod(1, 2, 1, 1, 3);
  VKModelCreateRod(1, 3, 1, 1, 4);
  VKModelCreateSpc(1, 1, VKDofCode(1, 1, 0), 2);
  VKModelCreateSpc(1, 2, VKDofCode(1, 1, 0), 3);
  VKModelCreateSpc(1, 3, VKDofCode(1, 1, 0), 4);
  VKModelCreateForce(1, 1, 1, 10000, 0, -1, 0);
  int analysis_code = VKModelPerformStaticAnalysis(1);
  printf("Analysis message: %s\n", VKErrorMessage(analysis_code));
  VKStaticAnalysisPrintResults(1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1050 <VKApiVersion@plt>
mov    %rax,%rsi
lea    0xe19(%rip),%rdi
call   1090 <printf@plt>
mov    $0x1,%edi
lea    0xe1f(%rip),%rsi
call   10e0 <VKModelCreate@plt>
mov    $0x1,%esi
mov    $0x1c9c380,%edx
movsd  0xde9(%rip),%xmm0
lea    0xe20(%rip),%rcx
mov    %esi,%edi
call   1040 <VKModelCreateMaterial@plt>
mov    $0x1,%edx
mov    $0x2,%ecx
lea    0xe08(%rip),%r8
mov    %edx,%edi
mov    %edx,%esi
call   1030 <VKModelCreateProperty@plt>
mov    $0x1,%esi
xorps  %xmm2,%xmm2
mov    %esi,%edi
movaps %xmm2,%xmm0
movaps %xmm2,%xmm1
call   10a0 <VKModelCreateNode@plt>
mov    $0x1,%edi
mov    $0x2,%esi
movsd  0xd92(%rip),%xmm0
xorps  %xmm2,%xmm2
movaps %xmm2,%xmm1
call   10a0 <VKModelCreateNode@plt>
mov    $0x1,%edi
mov    $0x3,%esi
movsd  0xd75(%rip),%xmm1
xorps  %xmm2,%xmm2
movaps %xmm1,%xmm0
call   10a0 <VKModelCreateNode@plt>
mov    $0x1,%edi
mov    $0x4,%esi
xorps  %xmm2,%xmm2
movsd  0xd55(%rip),%xmm1
movaps %xmm2,%xmm0
call   10a0 <VKModelCreateNode@plt>
mov    $0x1,%ecx
mov    $0x2,%r8d
mov    %ecx,%edi
mov    %ecx,%esi
mov    %ecx,%edx
call   1060 <VKModelCreateRod@plt>
mov    $0x1,%ecx
mov    $0x2,%esi
mov    $0x3,%r8d
mov    %ecx,%edi
mov    %ecx,%edx
call   1060 <VKModelCreateRod@plt>
mov    $0x1,%ecx
mov    $0x3,%esi
mov    $0x4,%r8d
mov    %ecx,%edi
mov    %ecx,%edx
call   1060 <VKModelCreateRod@plt>
mov    $0x1,%esi
xor    %edx,%edx
mov    %esi,%edi
call   10d0 <VKDofCode@plt>
mov    %eax,%edx
mov    $0x1,%esi
mov    $0x2,%ecx
mov    %esi,%edi
call   1080 <VKModelCreateSpc@plt>
mov    $0x1,%esi
xor    %edx,%edx
mov    %esi,%edi
call   10d0 <VKDofCode@plt>
mov    %eax,%edx
mov    $0x1,%edi
mov    $0x2,%esi
mov    $0x3,%ecx
call   1080 <VKModelCreateSpc@plt>
mov    $0x1,%esi
xor    %edx,%edx
mov    %esi,%edi
call   10d0 <VKDofCode@plt>
mov    %eax,%edx
mov    $0x1,%edi
mov    $0x3,%esi
mov    $0x4,%ecx
call   1080 <VKModelCreateSpc@plt>
mov    $0x1,%edx
mov    $0x2710,%ecx
xor    %r8d,%r8d
mov    $0xffffffff,%r9d
mov    %edx,%edi
mov    %edx,%esi
movl   $0x0,(%rsp)
call   10b0 <VKModelCreateForce@plt>
mov    $0x1,%edi
call   1070 <VKModelPerformStaticAnalysis@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   10f0 <VKErrorMessage@plt>
mov    %rax,%rsi
lea    0xc8b(%rip),%rdi
call   1090 <printf@plt>
mov    $0x1,%edi
call   10c0 <VKStaticAnalysisPrintResults@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
xor    %eax,%eax
call   1050 <VKApiVersion@plt>
lea    0xe2d(%rip),%rdi
mov    %rax,%rsi
call   1090 <printf@plt>
lea    0xe35(%rip),%rsi
mov    $0x1,%edi
call   10e0 <VKModelCreate@plt>
lea    0xe43(%rip),%rbx
movsd  0xdf5(%rip),%xmm0
mov    $0x1,%edi
mov    $0x1,%esi
mov    $0x1c9c380,%edx
mov    %rbx,%rcx
call   1040 <VKModelCreateMaterial@plt>
mov    $0x1,%edi
mov    $0x1,%esi
mov    $0x1,%edx
mov    $0x2,%ecx
mov    %rbx,%r8
call   1030 <VKModelCreateProperty@plt>
xorps  %xmm0,%xmm0
xorps  %xmm1,%xmm1
xorps  %xmm2,%xmm2
mov    $0x1,%edi
mov    $0x1,%esi
call   10a0 <VKModelCreateNode@plt>
movsd  0xdaa(%rip),%xmm0
xorps  %xmm1,%xmm1
xorps  %xmm2,%xmm2
mov    $0x1,%edi
mov    $0x2,%esi
call   10a0 <VKModelCreateNode@plt>
xorps  %xmm2,%xmm2
mov    $0x1,%edi
mov    $0x3,%esi
movsd  0xd80(%rip),%xmm0
movaps %xmm0,%xmm1
call   10a0 <VKModelCreateNode@plt>
xorps  %xmm0,%xmm0
xorps  %xmm2,%xmm2
mov    $0x1,%edi
mov    $0x4,%esi
movsd  0xd60(%rip),%xmm1
call   10a0 <VKModelCreateNode@plt>
mov    $0x1,%edi
mov    $0x1,%esi
mov    $0x1,%edx
mov    $0x1,%ecx
mov    $0x2,%r8d
call   1060 <VKModelCreateRod@plt>
mov    $0x1,%edi
mov    $0x2,%esi
mov    $0x1,%edx
mov    $0x1,%ecx
mov    $0x3,%r8d
call   1060 <VKModelCreateRod@plt>
mov    $0x1,%edi
mov    $0x3,%esi
mov    $0x1,%edx
mov    $0x1,%ecx
mov    $0x4,%r8d
call   1060 <VKModelCreateRod@plt>
mov    $0x1,%edi
mov    $0x1,%esi
xor    %edx,%edx
call   10d0 <VKDofCode@plt>
mov    $0x1,%edi
mov    $0x1,%esi
mov    %eax,%edx
mov    $0x2,%ecx
call   1080 <VKModelCreateSpc@plt>
mov    $0x1,%edi
mov    $0x1,%esi
xor    %edx,%edx
call   10d0 <VKDofCode@plt>
mov    $0x1,%edi
mov    $0x2,%esi
mov    %eax,%edx
mov    $0x3,%ecx
call   1080 <VKModelCreateSpc@plt>
mov    $0x1,%edi
mov    $0x1,%esi
xor    %edx,%edx
call   10d0 <VKDofCode@plt>
mov    $0x1,%edi
mov    $0x3,%esi
mov    %eax,%edx
mov    $0x4,%ecx
call   1080 <VKModelCreateSpc@plt>
movl   $0x0,(%rsp)
mov    $0x1,%edi
mov    $0x1,%esi
mov    $0x1,%edx
mov    $0x2710,%ecx
xor    %r8d,%r8d
mov    $0xffffffff,%r9d
call   10b0 <VKModelCreateForce@plt>
mov    $0x1,%edi
call   1070 <VKModelPerformStaticAnalysis@plt>
mov    %eax,%edi
call   10f0 <VKErrorMessage@plt>
lea    0xc71(%rip),%rdi
mov    %rax,%rsi
call   1090 <printf@plt>
mov    $0x1,%edi
call   10c0 <VKStaticAnalysisPrintResults@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [23 x i8] c"Valkyrie Version = %s\0A\00"
@.str.1 = [10 x i8] c"three-bar\00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [22 x i8] c"Analysis message: %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i8* (...) @VKApiVersion()
%8 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %7)
%9 = call i32 @VKModelCreate(i32 1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 @VKModelCreateMaterial(i32 1, i32 1, i32 30000000, double 7.800000e+03, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0))
%11 = call i32 @VKModelCreateProperty(i32 1, i32 1, i32 1, i32 2, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0))
%12 = call i32 @VKModelCreateNode(i32 1, i32 1, double 0.000000e+00, double 0.000000e+00, double 0.000000e+00)
%13 = call i32 @VKModelCreateNode(i32 1, i32 2, double 1.000000e+01, double 0.000000e+00, double 0.000000e+00)
%14 = call i32 @VKModelCreateNode(i32 1, i32 3, double 1.000000e+01, double 1.000000e+01, double 0.000000e+00)
%15 = call i32 @VKModelCreateNode(i32 1, i32 4, double 0.000000e+00, double 1.000000e+01, double 0.000000e+00)
%16 = call i32 @VKModelCreateRod(i32 1, i32 1, i32 1, i32 1, i32 2)
%17 = call i32 @VKModelCreateRod(i32 1, i32 2, i32 1, i32 1, i32 3)
%18 = call i32 @VKModelCreateRod(i32 1, i32 3, i32 1, i32 1, i32 4)
%19 = call i32 @VKDofCode(i32 1, i32 1, i32 0)
%20 = call i32 @VKModelCreateSpc(i32 1, i32 1, i32 %19, i32 2)
%21 = call i32 @VKDofCode(i32 1, i32 1, i32 0)
%22 = call i32 @VKModelCreateSpc(i32 1, i32 2, i32 %21, i32 3)
%23 = call i32 @VKDofCode(i32 1, i32 1, i32 0)
%24 = call i32 @VKModelCreateSpc(i32 1, i32 3, i32 %23, i32 4)
%25 = call i32 @VKModelCreateForce(i32 1, i32 1, i32 1, i32 10000, i32 0, i32 -1, i32 0)
%26 = call i32 @VKModelPerformStaticAnalysis(i32 1)
store i32 %26, i32* %6
%27 = load i32, i32* %6
%28 = call i8* @VKErrorMessage(i32 %27)
%29 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i8* %28)
%30 = call i32 @VKStaticAnalysisPrintResults(i32 1)
ret i32 0
}

LLVM IR (-O2):
@.str = [23 x i8] c"Valkyrie Version = %s\0A\00"
@.str.1 = [10 x i8] c"three-bar\00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [22 x i8] c"Analysis message: %s\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i8* (...) @VKApiVersion()
%4 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = tail call i32 @VKModelCreate(i32 1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i32 @VKModelCreateMaterial(i32 1, i32 1, i32 30000000, double 7.800000e+03, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0))
%7 = tail call i32 @VKModelCreateProperty(i32 1, i32 1, i32 1, i32 2, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0))
%8 = tail call i32 @VKModelCreateNode(i32 1, i32 1, double 0.000000e+00, double 0.000000e+00, double 0.000000e+00)
%9 = tail call i32 @VKModelCreateNode(i32 1, i32 2, double 1.000000e+01, double 0.000000e+00, double 0.000000e+00)
%10 = tail call i32 @VKModelCreateNode(i32 1, i32 3, double 1.000000e+01, double 1.000000e+01, double 0.000000e+00)
%11 = tail call i32 @VKModelCreateNode(i32 1, i32 4, double 0.000000e+00, double 1.000000e+01, double 0.000000e+00)
%12 = tail call i32 @VKModelCreateRod(i32 1, i32 1, i32 1, i32 1, i32 2)
%13 = tail call i32 @VKModelCreateRod(i32 1, i32 2, i32 1, i32 1, i32 3)
%14 = tail call i32 @VKModelCreateRod(i32 1, i32 3, i32 1, i32 1, i32 4)
%15 = tail call i32 @VKDofCode(i32 1, i32 1, i32 0)
%16 = tail call i32 @VKModelCreateSpc(i32 1, i32 1, i32 %15, i32 2)
%17 = tail call i32 @VKDofCode(i32 1, i32 1, i32 0)
%18 = tail call i32 @VKModelCreateSpc(i32 1, i32 2, i32 %17, i32 3)
%19 = tail call i32 @VKDofCode(i32 1, i32 1, i32 0)
%20 = tail call i32 @VKModelCreateSpc(i32 1, i32 3, i32 %19, i32 4)
%21 = tail call i32 @VKModelCreateForce(i32 1, i32 1, i32 1, i32 10000, i32 0, i32 -1, i32 0)
%22 = tail call i32 @VKModelPerformStaticAnalysis(i32 1)
%23 = tail call i8* @VKErrorMessage(i32 %22)
%24 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i8* %23)
%25 = tail call i32 @VKStaticAnalysisPrintResults(i32 1)
ret i32 0
}