#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, double, int,
                                      int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ VKModelCreateMaterial(int, int, double, double, char *);
int /*<<< orphan*/ VKModelCreateNode(int, int, double, double, double);
int /*<<< orphan*/ VKModelCreateProperty(int, int, int, double, 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, "single-bar");
  VKModelCreateMaterial(1, 1, 2.1e11, 7800.0, "steel");
  VKModelCreateProperty(1, 1, 1, 0.1, "steel property");
  VKModelCreateNode(1, 1, 0.0, 0.0, 0.0);
  VKModelCreateNode(1, 2, 1.0, 0.0, 0.0);
  VKModelCreateRod(1, 1, 1, 1, 2);
  VKModelCreateSpc(1, 1, VKDofCode(1, 1, 0), 1);
  VKModelCreateSpc(1, 2, VKDofCode(0, 1, 0), 2);
  VKModelCreateForce(1, 1, 2, 51.0, 1, 0, 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    0xe31(%rip),%rdi
call   1090 <printf@plt>
mov    $0x1,%edi
lea    0xe37(%rip),%rsi
call   10e0 <VKModelCreate@plt>
mov    $0x1,%esi
movsd  0xdfe(%rip),%xmm0
movsd  0xdfe(%rip),%xmm1
lea    0xe21(%rip),%rdx
mov    %esi,%edi
call   1040 <VKModelCreateMaterial@plt>
mov    $0x1,%edx
movsd  0xdd3(%rip),%xmm0
lea    0xe0c(%rip),%rcx
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  0xd94(%rip),%xmm0
xorps  %xmm2,%xmm2
movaps %xmm2,%xmm1
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,%esi
xor    %edx,%edx
mov    %esi,%edi
call   10d0 <VKDofCode@plt>
mov    %eax,%edx
mov    $0x1,%ecx
mov    %ecx,%edi
mov    %ecx,%esi
call   1080 <VKModelCreateSpc@plt>
xor    %edx,%edx
mov    $0x1,%esi
mov    %edx,%edi
call   10d0 <VKDofCode@plt>
mov    %eax,%edx
mov    $0x1,%edi
mov    $0x2,%ecx
mov    %ecx,%esi
call   1080 <VKModelCreateSpc@plt>
mov    $0x1,%ecx
mov    $0x2,%edx
movsd  0xd1a(%rip),%xmm0
xor    %r9d,%r9d
mov    %ecx,%edi
mov    %ecx,%esi
mov    %r9d,%r8d
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    0xd4b(%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   %rax
xor    %eax,%eax
call   1050 <VKApiVersion@plt>
lea    0xe49(%rip),%rdi
mov    %rax,%rsi
call   1090 <printf@plt>
lea    0xe51(%rip),%rsi
mov    $0x1,%edi
call   10e0 <VKModelCreate@plt>
lea    0xe4b(%rip),%rdx
movsd  0xdf9(%rip),%xmm0
movsd  0xdf9(%rip),%xmm1
mov    $0x1,%edi
mov    $0x1,%esi
call   1040 <VKModelCreateMaterial@plt>
lea    0xe2b(%rip),%rcx
movsd  0xde3(%rip),%xmm0
mov    $0x1,%edi
mov    $0x1,%esi
mov    $0x1,%edx
call   1030 <VKModelCreateProperty@plt>
xorps  %xmm0,%xmm0
xorps  %xmm1,%xmm1
xorps  %xmm2,%xmm2
mov    $0x1,%edi
mov    $0x1,%esi
call   10a0 <VKModelCreateNode@plt>
movsd  0xdb7(%rip),%xmm0
xorps  %xmm1,%xmm1
xorps  %xmm2,%xmm2
mov    $0x1,%edi
mov    $0x2,%esi
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    $0x1,%esi
xor    %edx,%edx
call   10d0 <VKDofCode@plt>
mov    $0x1,%edi
mov    $0x1,%esi
mov    %eax,%edx
mov    $0x1,%ecx
call   1080 <VKModelCreateSpc@plt>
xor    %edi,%edi
mov    $0x1,%esi
xor    %edx,%edx
call   10d0 <VKDofCode@plt>
mov    $0x1,%edi
mov    $0x2,%esi
mov    %eax,%edx
mov    $0x2,%ecx
call   1080 <VKModelCreateSpc@plt>
movsd  0xd38(%rip),%xmm0
mov    $0x1,%edi
mov    $0x1,%esi
mov    $0x2,%edx
mov    $0x1,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
call   10b0 <VKModelCreateForce@plt>
mov    $0x1,%edi
call   1070 <VKModelPerformStaticAnalysis@plt>
mov    %eax,%edi
call   10f0 <VKErrorMessage@plt>
lea    0xd40(%rip),%rdi
mov    %rax,%rsi
call   1090 <printf@plt>
mov    $0x1,%edi
call   10c0 <VKStaticAnalysisPrintResults@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [23 x i8] c"Valkyrie Version = %s\0A\00"
@.str.1 = [11 x i8] c"single-bar\00"
@.str.2 = [6 x i8] c"steel\00"
@.str.3 = [15 x i8] c"steel property\00"
@.str.4 = [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 ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 @VKModelCreateMaterial(i32 1, i32 1, double 2.100000e+11, double 7.800000e+03, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%11 = call i32 @VKModelCreateProperty(i32 1, i32 1, i32 1, double 1.000000e-01, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, 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+00, double 0.000000e+00, double 0.000000e+00)
%14 = call i32 @VKModelCreateRod(i32 1, i32 1, i32 1, i32 1, i32 2)
%15 = call i32 @VKDofCode(i32 1, i32 1, i32 0)
%16 = call i32 @VKModelCreateSpc(i32 1, i32 1, i32 %15, i32 1)
%17 = call i32 @VKDofCode(i32 0, i32 1, i32 0)
%18 = call i32 @VKModelCreateSpc(i32 1, i32 2, i32 %17, i32 2)
%19 = call i32 @VKModelCreateForce(i32 1, i32 1, i32 2, double 5.100000e+01, i32 1, i32 0, i32 0)
%20 = call i32 @VKModelPerformStaticAnalysis(i32 1)
store i32 %20, i32* %6
%21 = load i32, i32* %6
%22 = call i8* @VKErrorMessage(i32 %21)
%23 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i8* %22)
%24 = call i32 @VKStaticAnalysisPrintResults(i32 1)
ret i32 0
}

LLVM IR (-O2):
@.str = [23 x i8] c"Valkyrie Version = %s\0A\00"
@.str.1 = [11 x i8] c"single-bar\00"
@.str.2 = [6 x i8] c"steel\00"
@.str.3 = [15 x i8] c"steel property\00"
@.str.4 = [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 ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i32 @VKModelCreateMaterial(i32 1, i32 1, double 2.100000e+11, double 7.800000e+03, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%7 = tail call i32 @VKModelCreateProperty(i32 1, i32 1, i32 1, double 1.000000e-01, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, 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+00, double 0.000000e+00, double 0.000000e+00)
%10 = tail call i32 @VKModelCreateRod(i32 1, i32 1, i32 1, i32 1, i32 2)
%11 = tail call i32 @VKDofCode(i32 1, i32 1, i32 0)
%12 = tail call i32 @VKModelCreateSpc(i32 1, i32 1, i32 %11, i32 1)
%13 = tail call i32 @VKDofCode(i32 0, i32 1, i32 0)
%14 = tail call i32 @VKModelCreateSpc(i32 1, i32 2, i32 %13, i32 2)
%15 = tail call i32 @VKModelCreateForce(i32 1, i32 1, i32 2, double 5.100000e+01, i32 1, i32 0, i32 0)
%16 = tail call i32 @VKModelPerformStaticAnalysis(i32 1)
%17 = tail call i8* @VKErrorMessage(i32 %16)
%18 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i8* %17)
%19 = tail call i32 @VKStaticAnalysisPrintResults(i32 1)
ret i32 0
}