#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int BUFSIZ;
float M_PI;
double cosf(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, float *, float *,
                          float *, ...);
int /*<<< orphan*/ printf(char *, ...);
double sinf(int);
int /*<<< orphan*/ sscanf(char *, char *, float *, float *, ...);
int main() {
  FILE *input;
  FILE *output;
  FILE *hindge;
  FILE *stl;
  FILE *fpm;
  char buff[BUFSIZ];
  char buff2[BUFSIZ];
  char loop_type[10];
  int i;
  int flag;
  float normal[3], p1[3], p2[3], p3[3], p4[3], tmp1[3], tmp2[3], tmp3[3],
      moment_1, moment_2, moment_3;
  float angle_read, angle_1, angle_2, angle_3, angle_optimized, length,
      surf_ang;
  p3[2] = 0;
  p4[2] = 0;
  hindge = fopen("./constant/triSurface/hindge.dat", "r");
  if (hindge == NULL) {
    printf("Error! locations of the hindge point is not specified");
    return 1;
  } else {
    fscanf(hindge, "%f %f %f \n", &p1[1], &p1[2], &p1[3]);
    fscanf(hindge, "%f %f %f \n %f %f", &p2[1], &p2[2], &p2[3], &surf_ang,
           &length);
    printf("The hindge points are (%f %f %f) and (%f %f %f)\n", p1[1], p1[2],
           p1[3], p2[1], p2[2], p2[3]);
    fclose(hindge);
  }
  input = fopen("./forceBalance.dat", "r");
  if (input == NULL) {
    printf("Error! Unable to locate forceBalance.dat");
    return 1;
  } else {
    i = 0;
    flag = 0;
    while (fgets(buff, sizeof buff, input) != NULL) {
      if (i < 1) {
        sscanf(buff, "%f %f \n", &angle_1, &moment_1);
        angle_optimized = angle_1 + 4;
        printf("i = %i Angle 1 = %f\n", i, angle_1);
      } else {
        angle_2 = angle_1;
        moment_2 = moment_1;
        sscanf(buff, "%f %f \n", &angle_1, &moment_1);
        printf("i= %i Angle 1:%f Angle 2: %f\n", i, angle_1, angle_2);
      }
      if (moment_1 * moment_2 < 0)
        flag = 1;
      i++;
    }
    printf("The Flag is %i\n Angle 1: %f Angle 2: %f\n", flag, angle_1,
           angle_2);
    fclose(input);
    if (flag == 0)
      angle_optimized = angle_1 + moment_1 * 1e5;
    else {
      fpm = fopen("./FPM.dat", "a+");
      printf("Opening False Position Method Files...\n");
      angle_3 = 0;
      moment_3 = 0;
      while (fgets(buff, sizeof buff, fpm) != NULL)
        sscanf(buff, "%f %f %f %f \n", &angle_2, &angle_3, &moment_2,
               &moment_3);
      printf("Angle 2 : %f Angle 3: %f \n", angle_2, angle_3);
      if (moment_1 * moment_2 <= 0) {
        angle_optimized =
            (angle_1 * moment_2 - angle_2 * moment_1) / (moment_2 - moment_1);
        fprintf(fpm, "%f %f %f %f \n", angle_1, angle_2, moment_1, moment_2);
        printf("%f %f %f %f \n", angle_1, angle_2, moment_1, moment_2);
        printf("Case 1\n");
      } else {
        angle_optimized =
            (angle_1 * moment_3 - angle_3 * moment_1) / (moment_3 - moment_1);
        fprintf(fpm, "%f %f %f %f \n", angle_1, angle_3, moment_1, moment_3);
        printf("Case 2\n");
      }
      fclose(fpm);
    }
    printf("angle_optimized is %f degree\n", angle_optimized);
    if (angle_optimized <= surf_ang + 5)
      angle_optimized = surf_ang + 5;
    if (angle_optimized >= surf_ang + 175)
      angle_optimized = surf_ang + 175;
    printf("angle_optimized is %f degree\n", angle_optimized);
  }
  p3[1] = p1[1] + length * cosf(angle_optimized * M_PI / 180);
  p3[2] = p1[2];
  p3[3] = p1[3] + length * sinf(angle_optimized * M_PI / 180);
  p4[1] = p3[1];
  p4[2] = p2[2];
  p4[3] = p3[3];
  output = fopen("./constant/triSurface/flap.stl", "w");
  fprintf(output, "solid flap\n");
  fprintf(output, "\t facet normal %f 0.0 %f\n",
          cosf((90 + angle_optimized) * M_PI / 180),
          sinf((90 + angle_optimized) * M_PI / 180));
  fprintf(output, "\t\t outer loop\n");
  fprintf(output, "\t\t\t vertex %f %f %f\n", p1[1], p1[2], p1[3]);
  fprintf(output, "\t\t\t vertex %f %f %f\n", p2[1], p2[2], p2[3]);
  fprintf(output, "\t\t\t vertex %f %f %f\n", p3[1], p3[2], p3[3]);
  fprintf(output, "\t\t endloop\n\t endfacet\n");
  fprintf(output, "\t facet normal %f 0.0 %f\n",
          cosf((90 + angle_optimized) * M_PI / 180),
          sinf((90 + angle_optimized) * M_PI / 180));
  fprintf(output, "\t\t outer loop\n");
  fprintf(output, "\t\t\t vertex %f %f %f\n", p4[1], p4[2], p4[3]);
  fprintf(output, "\t\t\t vertex %f %f %f\n", p2[1], p2[2], p2[3]);
  fprintf(output, "\t\t\t vertex %f %f %f\n", p3[1], p3[2], p3[3]);
  fprintf(output, "\t\t endloop\n\t endfacet\n");
  fprintf(output, "endsolid flap");
  fclose(output);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x140,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e2f(%rip),%rax
mov    (%rax),%eax
mov    %rax,-0xf8(%rbp)
mov    %rsp,%rcx
mov    %rcx,-0x38(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0xf0(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x40(%rbp)
mov    0x2df9(%rip),%rax
mov    (%rax),%eax
mov    %rax,-0x48(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x84(%rbp)
ff
xorps  %xmm0,%xmm0
movss  %xmm0,-0x90(%rbp)
ff
lea    0xe1a(%rip),%rdi
lea    0xe34(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1241 <main+0xb1>
lea    0xe1b(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x1,-0x4(%rbp)
movl   $0x1,-0xe8(%rbp)
jmp    1bf1 <main+0xa61>
mov    -0x20(%rbp),%rdi
lea    -0x74(%rbp),%rdx
add    $0x4,%rdx
lea    -0x74(%rbp),%rcx
add    $0x8,%rcx
lea    -0x74(%rbp),%r8
add    $0xc,%r8
lea    0xf23(%rip),%rsi
mov    $0x0,%al
call   1070 <fscanf@plt>
mov    -0x20(%rbp),%rdi
lea    -0x80(%rbp),%rdx
add    $0x4,%rdx
lea    -0x80(%rbp),%rcx
add    $0x8,%rcx
lea    -0x80(%rbp),%r8
add    $0xc,%r8
lea    0xde7(%rip),%rsi
lea    -0xe4(%rbp),%r9
lea    -0xe0(%rbp),%rax
sub    $0x10,%rsp
mov    %rax,(%rsp)
mov    $0x0,%al
call   1070 <fscanf@plt>
add    $0x10,%rsp
movss  -0x70(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x6c(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movss  -0x68(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
movss  -0x7c(%rbp),%xmm3
cvtss2sd %xmm3,%xmm3
movss  -0x78(%rbp),%xmm4
cvtss2sd %xmm4,%xmm4
movss  -0x74(%rbp),%xmm5
cvtss2sd %xmm5,%xmm5
lea    0xd9a(%rip),%rdi
mov    $0x6,%al
call   1060 <printf@plt>
mov    -0x20(%rbp),%rdi
call   1040 <fclose@plt>
lea    0xdb4(%rip),%rdi
lea    0xd33(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1342 <main+0x1b2>
lea    0xda5(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x1,-0x4(%rbp)
movl   $0x1,-0xe8(%rbp)
jmp    1bf1 <main+0xa61>
movl   $0x0,-0x58(%rbp)
movl   $0x0,-0x5c(%rbp)
mov    -0xf0(%rbp),%rdi
mov    -0xf8(%rbp),%rax
mov    %eax,%esi
mov    -0x10(%rbp),%rdx
call   1080 <fgets@plt>
cmp    $0x0,%rax
je     1477 <main+0x2e7>
cmpl   $0x1,-0x58(%rbp)
jge    13da <main+0x24a>
mov    -0xf0(%rbp),%rdi
lea    0xdff(%rip),%rsi
lea    -0xd0(%rbp),%rdx
lea    -0xc0(%rbp),%rcx
mov    $0x0,%al
call   10a0 <sscanf@plt>
movss  0xc70(%rip),%xmm0
addss  -0xd0(%rbp),%xmm0
ff
movss  %xmm0,-0xdc(%rbp)
ff
mov    -0x58(%rbp),%esi
movss  -0xd0(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
lea    0xd25(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
jmp    1446 <main+0x2b6>
mov    -0xf0(%rbp),%rdi
movss  -0xd0(%rbp),%xmm0
ff
movss  %xmm0,-0xd4(%rbp)
ff
movss  -0xc0(%rbp),%xmm0
ff
movss  %xmm0,-0xc4(%rbp)
lea    0xd82(%rip),%rsi
lea    -0xd0(%rbp),%rdx
lea    -0xc0(%rbp),%rcx
mov    $0x0,%al
call   10a0 <sscanf@plt>
mov    -0x58(%rbp),%esi
movss  -0xd0(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
movss  -0xd4(%rbp),%xmm1
ff
cvtss2sd %xmm1,%xmm1
lea    0xcc9(%rip),%rdi
mov    $0x2,%al
call   1060 <printf@plt>
movss  -0xc0(%rbp),%xmm1
ff
mulss  -0xc4(%rbp),%xmm1
ff
xorps  %xmm0,%xmm0
ucomiss %xmm1,%xmm0
jbe    1469 <main+0x2d9>
movl   $0x1,-0x5c(%rbp)
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
jmp    1350 <main+0x1c0>
mov    -0x5c(%rbp),%esi
movss  -0xd0(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
movss  -0xd4(%rbp),%xmm1
ff
cvtss2sd %xmm1,%xmm1
lea    0xc8d(%rip),%rdi
mov    $0x2,%al
call   1060 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1040 <fclose@plt>
cmpl   $0x0,-0x5c(%rbp)
jne    14ec <main+0x35c>
movss  -0xd0(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm1
movss  -0xc0(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
movsd  0xb2d(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xdc(%rbp)
ff
jmp    1750 <main+0x5c0>
lea    0xc5c(%rip),%rdi
lea    0xc5f(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x30(%rbp)
lea    0xc52(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
xorps  %xmm0,%xmm0
movss  %xmm0,-0xd8(%rbp)
ff
xorps  %xmm0,%xmm0
movss  %xmm0,-0xc8(%rbp)
ff
mov    -0xf0(%rbp),%rdi
mov    -0xf8(%rbp),%rax
mov    %eax,%esi
mov    -0x30(%rbp),%rdx
call   1080 <fgets@plt>
cmp    $0x0,%rax
je     1580 <main+0x3f0>
mov    -0xf0(%rbp),%rdi
lea    0xc2c(%rip),%rsi
lea    -0xd4(%rbp),%rdx
lea    -0xd8(%rbp),%rcx
lea    -0xc4(%rbp),%r8
lea    -0xc8(%rbp),%r9
mov    $0x0,%al
call   10a0 <sscanf@plt>
jmp    1527 <main+0x397>
movss  -0xd4(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
movss  -0xd8(%rbp),%xmm1
ff
cvtss2sd %xmm1,%xmm1
lea    0xbf3(%rip),%rdi
mov    $0x2,%al
call   1060 <printf@plt>
movss  -0xc0(%rbp),%xmm1
ff
mulss  -0xc4(%rbp),%xmm1
ff
xorps  %xmm0,%xmm0
ucomiss %xmm1,%xmm0
jb     16a6 <main+0x516>
movss  -0xd0(%rbp),%xmm0
ff
movss  -0xc4(%rbp),%xmm2
ff
movss  -0xd4(%rbp),%xmm1
ff
mulss  -0xc0(%rbp),%xmm1
ff
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  -0xc4(%rbp),%xmm1
ff
subss  -0xc0(%rbp),%xmm1
ff
divss  %xmm1,%xmm0
movss  %xmm0,-0xdc(%rbp)
ff
mov    -0x30(%rbp),%rdi
movss  -0xd0(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
movss  -0xd4(%rbp),%xmm1
ff
cvtss2sd %xmm1,%xmm1
movss  -0xc0(%rbp),%xmm2
ff
cvtss2sd %xmm2,%xmm2
movss  -0xc4(%rbp),%xmm3
ff
cvtss2sd %xmm3,%xmm3
lea    0xb36(%rip),%rsi
mov    $0x4,%al
call   1090 <fprintf@plt>
movss  -0xd0(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
movss  -0xd4(%rbp),%xmm1
ff
cvtss2sd %xmm1,%xmm1
movss  -0xc0(%rbp),%xmm2
ff
cvtss2sd %xmm2,%xmm2
movss  -0xc4(%rbp),%xmm3
ff
cvtss2sd %xmm3,%xmm3
lea    0xaf8(%rip),%rdi
mov    $0x4,%al
call   1060 <printf@plt>
lea    0xb13(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    1747 <main+0x5b7>
movss  -0xd0(%rbp),%xmm0
ff
movss  -0xc8(%rbp),%xmm2
ff
movss  -0xd8(%rbp),%xmm1
ff
mulss  -0xc0(%rbp),%xmm1
ff
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  -0xc8(%rbp),%xmm1
ff
subss  -0xc0(%rbp),%xmm1
ff
divss  %xmm1,%xmm0
movss  %xmm0,-0xdc(%rbp)
ff
mov    -0x30(%rbp),%rdi
movss  -0xd0(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
movss  -0xd8(%rbp),%xmm1
ff
cvtss2sd %xmm1,%xmm1
movss  -0xc0(%rbp),%xmm2
ff
cvtss2sd %xmm2,%xmm2
movss  -0xc8(%rbp),%xmm3
ff
cvtss2sd %xmm3,%xmm3
lea    0xa52(%rip),%rsi
mov    $0x4,%al
call   1090 <fprintf@plt>
lea    0xa75(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x30(%rbp),%rdi
call   1040 <fclose@plt>
movss  -0xdc(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
lea    0xa5a(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
movss  -0xdc(%rbp),%xmm1
ff
movss  0x88e(%rip),%xmm0
addss  -0xe4(%rbp),%xmm0
ff
ucomiss %xmm1,%xmm0
jb     17a3 <main+0x613>
movss  0x875(%rip),%xmm0
addss  -0xe4(%rbp),%xmm0
ff
movss  %xmm0,-0xdc(%rbp)
ff
movss  -0xdc(%rbp),%xmm0
ff
movss  0x859(%rip),%xmm1
addss  -0xe4(%rbp),%xmm1
ff
ucomiss %xmm1,%xmm0
jb     17dc <main+0x64c>
movss  0x840(%rip),%xmm0
addss  -0xe4(%rbp),%xmm0
ff
movss  %xmm0,-0xdc(%rbp)
ff
movss  -0xdc(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
lea    0x9ce(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
movss  -0x70(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x138(%rbp)
ff
movss  -0xe0(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x130(%rbp)
ff
movss  -0xdc(%rbp),%xmm0
ff
mov    0x27be(%rip),%rax
mulss  (%rax),%xmm0
movss  0x7da(%rip),%xmm1
divss  %xmm1,%xmm0
cvttss2si %xmm0,%edi
call   1050 <cosf@plt>
movsd  -0x138(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movsd  -0x130(%rbp),%xmm0
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x88(%rbp)
ff
movss  -0x6c(%rbp),%xmm0
movss  %xmm0,-0x84(%rbp)
ff
movss  -0x68(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x128(%rbp)
ff
movss  -0xe0(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x120(%rbp)
ff
movss  -0xdc(%rbp),%xmm0
ff
mov    0x273d(%rip),%rax
mulss  (%rax),%xmm0
movss  0x759(%rip),%xmm1
divss  %xmm1,%xmm0
cvttss2si %xmm0,%edi
call   1030 <sinf@plt>
movsd  -0x128(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movsd  -0x120(%rbp),%xmm0
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x80(%rbp)
movss  -0x88(%rbp),%xmm0
ff
movss  %xmm0,-0x94(%rbp)
ff
movss  -0x78(%rbp),%xmm0
movss  %xmm0,-0x90(%rbp)
ff
movss  -0x80(%rbp),%xmm0
movss  %xmm0,-0x8c(%rbp)
ff
lea    0x8c2(%rip),%rdi
lea    0x8da(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0x8c8(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x118(%rbp)
movss  0x6c6(%rip),%xmm0
addss  -0xdc(%rbp),%xmm0
ff
mov    0x268b(%rip),%rax
mulss  (%rax),%xmm0
movss  0x6a7(%rip),%xmm1
divss  %xmm1,%xmm0
cvttss2si %xmm0,%edi
call   1050 <cosf@plt>
movsd  %xmm0,-0x110(%rbp)
ff
movss  0x68e(%rip),%xmm0
addss  -0xdc(%rbp),%xmm0
ff
mov    0x2653(%rip),%rax
mulss  (%rax),%xmm0
movss  0x66f(%rip),%xmm1
divss  %xmm1,%xmm0
cvttss2si %xmm0,%edi
call   1030 <sinf@plt>
mov    -0x118(%rbp),%rdi
movaps %xmm0,%xmm1
movsd  -0x110(%rbp),%xmm0
ff
lea    0x841(%rip),%rsi
mov    $0x2,%al
call   1090 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    0x849(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x18(%rbp),%rdi
movss  -0x70(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x6c(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movss  -0x68(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
lea    0x82b(%rip),%rsi
mov    $0x3,%al
call   1090 <fprintf@plt>
mov    -0x18(%rbp),%rdi
movss  -0x7c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x78(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movss  -0x74(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
lea    0x7fe(%rip),%rsi
mov    $0x3,%al
call   1090 <fprintf@plt>
mov    -0x18(%rbp),%rdi
movss  -0x88(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
movss  -0x84(%rbp),%xmm1
ff
cvtss2sd %xmm1,%xmm1
movss  -0x80(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
lea    0x7cb(%rip),%rsi
mov    $0x3,%al
call   1090 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    0x7ce(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x108(%rbp)
movss  0x582(%rip),%xmm0
addss  -0xdc(%rbp),%xmm0
ff
mov    0x2547(%rip),%rax
mulss  (%rax),%xmm0
movss  0x563(%rip),%xmm1
divss  %xmm1,%xmm0
cvttss2si %xmm0,%edi
call   1050 <cosf@plt>
movsd  %xmm0,-0x100(%rbp)
ff
movss  0x54a(%rip),%xmm0
addss  -0xdc(%rbp),%xmm0
ff
mov    0x250f(%rip),%rax
mulss  (%rax),%xmm0
movss  0x52b(%rip),%xmm1
divss  %xmm1,%xmm0
cvttss2si %xmm0,%edi
call   1030 <sinf@plt>
mov    -0x108(%rbp),%rdi
movaps %xmm0,%xmm1
movsd  -0x100(%rbp),%xmm0
ff
lea    0x6fd(%rip),%rsi
mov    $0x2,%al
call   1090 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    0x705(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x18(%rbp),%rdi
movss  -0x94(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
movss  -0x90(%rbp),%xmm1
ff
cvtss2sd %xmm1,%xmm1
movss  -0x8c(%rbp),%xmm2
ff
cvtss2sd %xmm2,%xmm2
lea    0x6de(%rip),%rsi
mov    $0x3,%al
call   1090 <fprintf@plt>
mov    -0x18(%rbp),%rdi
movss  -0x7c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x78(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movss  -0x74(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
lea    0x6b1(%rip),%rsi
mov    $0x3,%al
call   1090 <fprintf@plt>
mov    -0x18(%rbp),%rdi
movss  -0x88(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
movss  -0x84(%rbp),%xmm1
ff
cvtss2sd %xmm1,%xmm1
movss  -0x80(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
lea    0x67e(%rip),%rsi
mov    $0x3,%al
call   1090 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    0x681(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    0x686(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
movl   $0x0,-0xe8(%rbp)
mov    -0x38(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
mov    0x2e10(%rip),%rax
mov    (%rax),%r12d
mov    %rsp,%rbx
lea    0xf(%r12),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
lea    0xe38(%rip),%rdi
lea    0xe52(%rip),%rsi
call   10c0 <fopen@plt>
test   %rax,%rax
je     1476 <main+0x2c6>
mov    %rax,%r15
lea    -0x70(%rbp),%rdx
lea    -0x6c(%rbp),%rcx
lea    -0x68(%rbp),%r8
lea    0xf50(%rip),%rsi
mov    %rax,%rdi
xor    %eax,%eax
call   1080 <fscanf@plt>
lea    -0x44(%rbp),%rdx
lea    -0x40(%rbp),%rcx
lea    -0x3c(%rbp),%r8
sub    $0x8,%rsp
lea    -0x90(%rbp),%r10
lea    0xe3e(%rip),%rsi
lea    -0x8c(%rbp),%r9
mov    %r15,%rdi
xor    %eax,%eax
push   %r10
call   1080 <fscanf@plt>
add    $0x10,%rsp
movss  -0x70(%rbp),%xmm0
movss  -0x6c(%rbp),%xmm1
cvtss2sd %xmm0,%xmm0
cvtss2sd %xmm1,%xmm1
movss  -0x68(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
movss  -0x44(%rbp),%xmm3
movss  -0x40(%rbp),%xmm4
cvtss2sd %xmm3,%xmm3
cvtss2sd %xmm4,%xmm4
movss  -0x3c(%rbp),%xmm5
cvtss2sd %xmm5,%xmm5
lea    0xdfb(%rip),%rdi
mov    $0x6,%al
call   1070 <printf@plt>
mov    %r15,%rdi
call   1050 <fclose@plt>
lea    0xe16(%rip),%rdi
lea    0xd95(%rip),%rsi
call   10c0 <fopen@plt>
test   %rax,%rax
je     147f <main+0x2cf>
mov    %rax,%r15
mov    %rbx,%rdi
mov    %r12d,%esi
mov    %rax,%rdx
call   1090 <fgets@plt>
lea    0xe94(%rip),%rsi
lea    -0x2c(%rbp),%rdx
lea    -0x30(%rbp),%rcx
mov    %rbx,%rdi
xor    %eax,%eax
call   10b0 <sscanf@plt>
movss  -0x2c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe03(%rip),%rdi
xor    %esi,%esi
mov    $0x1,%al
call   1070 <printf@plt>
mov    %rbx,%rdi
mov    %r12d,%esi
mov    %r15,%rdx
call   1090 <fgets@plt>
mov    $0x1,%r14d
xor    %r13d,%r13d
movss  -0x2c(%rbp),%xmm0
movss  %xmm0,-0x38(%rbp)
movss  %xmm0,-0x3c(%rbp)
movss  -0x30(%rbp),%xmm0
movss  %xmm0,-0x60(%rbp)
movss  %xmm0,-0x68(%rbp)
mov    %rbx,%rdi
lea    0xe2a(%rip),%rsi
lea    -0x2c(%rbp),%rdx
lea    -0x30(%rbp),%rcx
xor    %eax,%eax
call   10b0 <sscanf@plt>
movss  -0x2c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x38(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xda8(%rip),%rdi
mov    %r14d,%esi
movsd  %xmm1,-0x38(%rbp)
mov    $0x2,%al
call   1070 <printf@plt>
movss  -0x60(%rbp),%xmm1
mulss  -0x30(%rbp),%xmm1
xorps  %xmm0,%xmm0
ucomiss %xmm1,%xmm0
mov    $0x1,%eax
cmova  %eax,%r13d
add    $0x1,%r14d
mov    %rbx,%rdi
mov    %r12d,%esi
mov    %r15,%rdx
call   1090 <fgets@plt>
test   %rax,%rax
jne    1310 <main+0x160>
movss  -0x2c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xd73(%rip),%rdi
mov    %r13d,%esi
movsd  -0x38(%rbp),%xmm1
mov    $0x2,%al
call   1070 <printf@plt>
mov    %r15,%rdi
call   1050 <fclose@plt>
test   %r13d,%r13d
je     1497 <main+0x2e7>
lea    0xd75(%rip),%rdi
lea    0xd78(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,%r14
lea    0xe43(%rip),%rdi
call   1040 <puts@plt>
movl   $0x0,-0x64(%rbp)
movl   $0x0,-0x78(%rbp)
mov    %rbx,%rdi
mov    %r12d,%esi
mov    %r14,%rdx
call   1090 <fgets@plt>
test   %rax,%rax
je     14c1 <main+0x311>
lea    -0x68(%rbp),%r15
lea    -0x78(%rbp),%r13
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %rbx,%rdi
lea    0xd22(%rip),%rsi
lea    -0x3c(%rbp),%rdx
lea    -0x64(%rbp),%rcx
mov    %r15,%r8
mov    %r13,%r9
xor    %eax,%eax
call   10b0 <sscanf@plt>
mov    %rbx,%rdi
mov    %r12d,%esi
mov    %r14,%rdx
call   1090 <fgets@plt>
test   %rax,%rax
jne    1430 <main+0x280>
movss  -0x3c(%rbp),%xmm0
movss  -0x64(%rbp),%xmm1
cvtss2sd %xmm0,%xmm0
cvtss2sd %xmm1,%xmm1
jmp    14c9 <main+0x319>
lea    0xbc2(%rip),%rdi
jmp    1486 <main+0x2d6>
lea    0xc44(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0x1,%eax
jmp    193b <main+0x78b>
movss  -0x2c(%rbp),%xmm0
movss  -0x30(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  0xb53(%rip),%xmm1
cvtss2sd %xmm0,%xmm0
addsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
jmp    15e3 <main+0x433>
xorps  %xmm1,%xmm1
movsd  -0x38(%rbp),%xmm0
lea    0xc9a(%rip),%rdi
mov    $0x2,%al
call   1070 <printf@plt>
movss  -0x30(%rbp),%xmm2
movss  -0x68(%rbp),%xmm1
movaps %xmm2,%xmm0
mulss  %xmm1,%xmm0
xorps  %xmm3,%xmm3
ucomiss %xmm0,%xmm3
movss  -0x2c(%rbp),%xmm5
jae    1550 <main+0x3a0>
movss  -0x78(%rbp),%xmm1
movss  -0x64(%rbp),%xmm4
movaps %xmm2,%xmm3
mulss  %xmm4,%xmm3
xorps  %xmm0,%xmm0
cvtss2sd %xmm5,%xmm0
mulss  %xmm1,%xmm5
subss  %xmm3,%xmm5
xorps  %xmm3,%xmm3
cvtss2sd %xmm1,%xmm3
subss  %xmm2,%xmm1
divss  %xmm1,%xmm5
movaps %xmm5,-0x60(%rbp)
xorps  %xmm1,%xmm1
cvtss2sd %xmm4,%xmm1
cvtss2sd %xmm2,%xmm2
lea    0xc22(%rip),%rsi
mov    %r14,%rdi
mov    $0x4,%al
call   10a0 <fprintf@plt>
lea    0xd0f(%rip),%rdi
jmp    15d2 <main+0x422>
movss  -0x3c(%rbp),%xmm4
movaps %xmm2,%xmm3
mulss  %xmm4,%xmm3
xorps  %xmm0,%xmm0
cvtss2sd %xmm5,%xmm0
mulss  %xmm1,%xmm5
subss  %xmm3,%xmm5
xorps  %xmm3,%xmm3
cvtss2sd %xmm1,%xmm3
subss  %xmm2,%xmm1
divss  %xmm1,%xmm5
movaps %xmm5,-0x60(%rbp)
xorps  %xmm1,%xmm1
cvtss2sd %xmm4,%xmm1
cvtss2sd %xmm2,%xmm2
lea    0xbcc(%rip),%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x4,%al
call   10a0 <fprintf@plt>
movss  -0x2c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x3c(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movss  -0x30(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
movss  -0x68(%rbp),%xmm3
cvtss2sd %xmm3,%xmm3
mov    %rbx,%rdi
mov    $0x4,%al
call   1070 <printf@plt>
lea    0xc8f(%rip),%rdi
call   1040 <puts@plt>
mov    %r14,%rdi
call   1050 <fclose@plt>
movaps -0x60(%rbp),%xmm0
movaps %xmm0,-0x60(%rbp)
cvtss2sd %xmm0,%xmm0
lea    0xb93(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1,%al
call   1070 <printf@plt>
movss  -0x8c(%rbp),%xmm0
ff
movss  0x9fc(%rip),%xmm1
addss  %xmm0,%xmm1
movaps -0x60(%rbp),%xmm3
movaps %xmm3,%xmm2
cmpless %xmm1,%xmm2
andps  %xmm2,%xmm1
andnps %xmm3,%xmm2
orps   %xmm1,%xmm2
addss  0x9df(%rip),%xmm0
movaps %xmm0,%xmm3
cmpless %xmm2,%xmm3
movaps %xmm3,%xmm1
andnps %xmm2,%xmm1
andps  %xmm0,%xmm3
orps   %xmm1,%xmm3
movaps %xmm3,-0x60(%rbp)
xorps  %xmm0,%xmm0
cvtss2sd %xmm3,%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1070 <printf@plt>
movss  -0x70(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x38(%rbp)
movss  -0x90(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
mov    0x2969(%rip),%r15
movss  (%r15),%xmm0
mulss  -0x60(%rbp),%xmm0
divss  0x97f(%rip),%xmm0
cvttss2si %xmm0,%edi
call   1060 <cosf@plt>
mulsd  -0x88(%rbp),%xmm0
ff
addsd  -0x38(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x38(%rbp)
movss  -0x6c(%rbp),%xmm0
movss  %xmm0,-0x80(%rbp)
movss  (%r15),%xmm0
mulss  -0x60(%rbp),%xmm0
divss  0x944(%rip),%xmm0
cvttss2si %xmm0,%edi
call   1030 <sinf@plt>
movss  -0x40(%rbp),%xmm0
movss  %xmm0,-0x88(%rbp)
ff
lea    0xaba(%rip),%rdi
lea    0xad2(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,%rbx
lea    0xac5(%rip),%rdi
mov    $0xb,%esi
mov    $0x1,%edx
mov    %rax,%rcx
call   10d0 <fwrite@plt>
movaps -0x60(%rbp),%xmm1
addss  0x8f7(%rip),%xmm1
movaps %xmm1,-0x60(%rbp)
movss  (%r15),%xmm0
mulss  %xmm1,%xmm0
divss  0x8de(%rip),%xmm0
cvttss2si %xmm0,%edi
call   1060 <cosf@plt>
movsd  %xmm0,-0x98(%rbp)
ff
movss  (%r15),%xmm0
mulss  -0x60(%rbp),%xmm0
divss  0x8bb(%rip),%xmm0
cvttss2si %xmm0,%edi
call   1030 <sinf@plt>
movaps %xmm0,%xmm1
lea    0xa68(%rip),%rsi
mov    %rbx,%rdi
movsd  -0x98(%rbp),%xmm0
ff
mov    $0x2,%al
call   10a0 <fprintf@plt>
lea    0xa69(%rip),%r12
mov    $0xe,%esi
mov    $0x1,%edx
mov    %r12,%rdi
mov    %rbx,%rcx
call   10d0 <fwrite@plt>
movss  -0x70(%rbp),%xmm0
movss  -0x6c(%rbp),%xmm1
cvtss2sd %xmm0,%xmm0
cvtss2sd %xmm1,%xmm1
movss  -0x68(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
lea    0xa41(%rip),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x3,%al
call   10a0 <fprintf@plt>
movss  -0x44(%rbp),%xmm0
movss  -0x40(%rbp),%xmm1
cvtss2sd %xmm0,%xmm0
cvtss2sd %xmm1,%xmm1
movss  -0x3c(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x3,%al
call   10a0 <fprintf@plt>
movss  -0x38(%rbp),%xmm0
xorps  %xmm2,%xmm2
cvtss2sd %xmm0,%xmm2
movsd  %xmm2,-0x38(%rbp)
movss  -0x80(%rbp),%xmm0
xorps  %xmm1,%xmm1
cvtss2sd %xmm0,%xmm1
movsd  %xmm1,-0x80(%rbp)
mov    %rbx,%rdi
mov    %r14,%rsi
movaps %xmm2,%xmm0
mov    $0x3,%al
call   10a0 <fprintf@plt>
lea    0x9e8(%rip),%r13
mov    $0x16,%esi
mov    $0x1,%edx
mov    %r13,%rdi
mov    %rbx,%rcx
call   10d0 <fwrite@plt>
movss  (%r15),%xmm0
mulss  -0x60(%rbp),%xmm0
divss  0x7c3(%rip),%xmm0
cvttss2si %xmm0,%edi
call   1060 <cosf@plt>
movaps -0x60(%rbp),%xmm1
mulss  (%r15),%xmm1
movsd  %xmm0,-0x60(%rbp)
divss  0x7a4(%rip),%xmm1
cvttss2si %xmm1,%edi
call   1030 <sinf@plt>
movaps %xmm0,%xmm1
mov    %rbx,%rdi
lea    0x94e(%rip),%rsi
movsd  -0x60(%rbp),%xmm0
mov    $0x2,%al
call   10a0 <fprintf@plt>
mov    $0xe,%esi
mov    $0x1,%edx
mov    %r12,%rdi
mov    %rbx,%rcx
call   10d0 <fwrite@plt>
movss  -0x88(%rbp),%xmm0
ff
xorps  %xmm1,%xmm1
cvtss2sd %xmm0,%xmm1
mov    %rbx,%rdi
mov    %r14,%rsi
movsd  -0x38(%rbp),%xmm0
mov    $0x3,%al
call   10a0 <fprintf@plt>
movss  -0x44(%rbp),%xmm0
movss  -0x40(%rbp),%xmm1
cvtss2sd %xmm0,%xmm0
cvtss2sd %xmm1,%xmm1
movss  -0x3c(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x3,%al
call   10a0 <fprintf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
movsd  -0x38(%rbp),%xmm0
movsd  -0x80(%rbp),%xmm1
mov    $0x3,%al
call   10a0 <fprintf@plt>
mov    $0x16,%esi
mov    $0x1,%edx
mov    %r13,%rdi
mov    %rbx,%rcx
call   10d0 <fwrite@plt>
lea    0x906(%rip),%rdi
mov    $0xd,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   10d0 <fwrite@plt>
mov    %rbx,%rdi
call   1050 <fclose@plt>
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@BUFSIZ = global i32 0
@.str = [33 x i8] c"./constant/triSurface/hindge.dat\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [54 x i8] c"Error! locations of the hindge point is not specified\00"
@.str.3 = [11 x i8] c"%f %f %f \0A\00"
@.str.4 = [17 x i8] c"%f %f %f \0A %f %f\00"
@.str.5 = [49 x i8] c"The hindge points are (%f %f %f) and (%f %f %f)\0A\00"
@.str.6 = [19 x i8] c"./forceBalance.dat\00"
@.str.7 = [41 x i8] c"Error! Unable to locate forceBalance.dat\00"
@.str.8 = [8 x i8] c"%f %f \0A\00"
@.str.9 = [21 x i8] c"i = %i Angle 1 = %f\0A\00"
@.str.10 = [30 x i8] c"i= %i Angle 1:%f Angle 2: %f\0A\00"
@.str.11 = [41 x i8] c"The Flag is %i\0A Angle 1: %f Angle 2: %f\0A\00"
@.str.12 = [10 x i8] c"./FPM.dat\00"
@.str.13 = [3 x i8] c"a+\00"
@.str.14 = [40 x i8] c"Opening False Position Method Files...\0A\00"
@.str.15 = [14 x i8] c"%f %f %f %f \0A\00"
@.str.16 = [27 x i8] c"Angle 2 : %f Angle 3: %f \0A\00"
@.str.17 = [8 x i8] c"Case 1\0A\00"
@.str.18 = [8 x i8] c"Case 2\0A\00"
@.str.19 = [30 x i8] c"angle_optimized is %f degree\0A\00"
@M_PI = global float 0.000000e+00
@.str.20 = [31 x i8] c"./constant/triSurface/flap.stl\00"
@.str.21 = [2 x i8] c"w\00"
@.str.22 = [12 x i8] c"solid flap\0A\00"
@.str.23 = [26 x i8] c"\09 facet normal %f 0.0 %f\0A\00"
@.str.24 = [15 x i8] c"\09\09 outer loop\0A\00"
@.str.25 = [21 x i8] c"\09\09\09 vertex %f %f %f\0A\00"
@.str.26 = [23 x i8] c"\09\09 endloop\0A\09 endfacet\0A\00"
@.str.27 = [14 x i8] c"endsolid flap\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i8*
%8 = alloca i64
%9 = alloca i64
%10 = alloca [10 x i8]
%11 = alloca i32
%12 = alloca i32
%13 = alloca [3 x float]
%14 = alloca [3 x float]
%15 = alloca [3 x float]
%16 = alloca [3 x float]
%17 = alloca [3 x float]
%18 = alloca [3 x float]
%19 = alloca [3 x float]
%20 = alloca [3 x float]
%21 = alloca float
%22 = alloca float
%23 = alloca float
%24 = alloca float
%25 = alloca float
%26 = alloca float
%27 = alloca float
%28 = alloca float
%29 = alloca float
%30 = alloca float
%31 = alloca i32
store i32 0, i32* %1
%32 = load i32, i32* @BUFSIZ
%33 = zext i32 %32 to i64
%34 = call i8* @llvm.stacksave()
store i8* %34, i8** %7
%35 = alloca i8, i64 %33
store i64 %33, i64* %8
%36 = load i32, i32* @BUFSIZ
%37 = zext i32 %36 to i64
%38 = alloca i8, i64 %37
store i64 %37, i64* %9
%39 = getelementptr inbounds [3 x float], [3 x float]* %16, i64 0, i64 2
store float 0.000000e+00, float* %39
%40 = getelementptr inbounds [3 x float], [3 x float]* %17, i64 0, i64 2
store float 0.000000e+00, float* %40
%41 = call i32* @fopen(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %41, i32** %4
%42 = load i32*, i32** %4
%43 = icmp eq i32* %42, null
br i1 %43, label %44, label %46
44: ; preds = %0
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %1
store i32 1, i32* %31
br label %393
46: ; preds = %0
%47 = load i32*, i32** %4
%48 = getelementptr inbounds [3 x float], [3 x float]* %14, i64 0, i64 1
%49 = getelementptr inbounds [3 x float], [3 x float]* %14, i64 0, i64 2
%50 = getelementptr inbounds [3 x float], [3 x float]* %14, i64 0, i64 3
%51 = call i32 (i32*, i8*, float*, float*, float*, ...) @fscanf(i32* %47, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), float* %48, float* %49, float* %50)
%52 = load i32*, i32** %4
%53 = getelementptr inbounds [3 x float], [3 x float]* %15, i64 0, i64 1
%54 = getelementptr inbounds [3 x float], [3 x float]* %15, i64 0, i64 2
%55 = getelementptr inbounds [3 x float], [3 x float]* %15, i64 0, i64 3
%56 = call i32 (i32*, i8*, float*, float*, float*, ...) @fscanf(i32* %52, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), float* %53, float* %54, float* %55, float* %30, float* %29)
%57 = getelementptr inbounds [3 x float], [3 x float]* %14, i64 0, i64 1
%58 = load float, float* %57
%59 = fpext float %58 to double
%60 = getelementptr inbounds [3 x float], [3 x float]* %14, i64 0, i64 2
%61 = load float, float* %60
%62 = fpext float %61 to double
%63 = getelementptr inbounds [3 x float], [3 x float]* %14, i64 0, i64 3
%64 = load float, float* %63
%65 = fpext float %64 to double
%66 = getelementptr inbounds [3 x float], [3 x float]* %15, i64 0, i64 1
%67 = load float, float* %66
%68 = fpext float %67 to double
%69 = getelementptr inbounds [3 x float], [3 x float]* %15, i64 0, i64 2
%70 = load float, float* %69
%71 = fpext float %70 to double
%72 = getelementptr inbounds [3 x float], [3 x float]* %15, i64 0, i64 3
%73 = load float, float* %72
%74 = fpext float %73 to double
%75 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.5, i64 0, i64 0), double %59, double %62, double %65, double %68, double %71, double %74)
%76 = load i32*, i32** %4
%77 = call i32 @fclose(i32* %76)
br label %78
78: ; preds = %46
%79 = call i32* @fopen(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %79, i32** %2
%80 = load i32*, i32** %2
%81 = icmp eq i32* %80, null
br i1 %81, label %82, label %84
82: ; preds = %78
%83 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.7, i64 0, i64 0))
store i32 1, i32* %1
store i32 1, i32* %31
br label %393
84: ; preds = %78
store i32 0, i32* %11
store i32 0, i32* %12
br label %85
85: ; preds = %117, %84
%86 = trunc i64 %33 to i32
%87 = load i32*, i32** %2
%88 = call i32* @fgets(i8* %35, i32 %86, i32* %87)
%89 = icmp ne i32* %88, null
br i1 %89, label %90, label %120
90: ; preds = %85
%91 = load i32, i32* %11
%92 = icmp slt i32 %91, 1
br i1 %92, label %93, label %101
93: ; preds = %90
%94 = call i32 (i8*, i8*, float*, float*, ...) @sscanf(i8* %35, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0), float* %25, float* %21)
%95 = load float, float* %25
%96 = fadd float %95, 4.000000e+00
store float %96, float* %28
%97 = load i32, i32* %11
%98 = load float, float* %25
%99 = fpext float %98 to double
%100 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.9, i64 0, i64 0), i32 %97, double %99)
br label %111
101: ; preds = %90
%102 = load float, float* %25
store float %102, float* %26
%103 = load float, float* %21
store float %103, float* %22
%104 = call i32 (i8*, i8*, float*, float*, ...) @sscanf(i8* %35, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0), float* %25, float* %21)
%105 = load i32, i32* %11
%106 = load float, float* %25
%107 = fpext float %106 to double
%108 = load float, float* %26
%109 = fpext float %108 to double
%110 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.10, i64 0, i64 0), i32 %105, double %107, double %109)
br label %111
111: ; preds = %101, %93
%112 = load float, float* %21
%113 = load float, float* %22
%114 = fmul float %112, %113
%115 = fcmp olt float %114, 0.000000e+00
br i1 %115, label %116, label %117
116: ; preds = %111
store i32 1, i32* %12
br label %117
117: ; preds = %116, %111
%118 = load i32, i32* %11
%119 = add nsw i32 %118, 1
store i32 %119, i32* %11
br label %85
120: ; preds = %85
%121 = load i32, i32* %12
%122 = load float, float* %25
%123 = fpext float %122 to double
%124 = load float, float* %26
%125 = fpext float %124 to double
%126 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.11, i64 0, i64 0), i32 %121, double %123, double %125)
%127 = load i32*, i32** %2
%128 = call i32 @fclose(i32* %127)
%129 = load i32, i32* %12
%130 = icmp eq i32 %129, 0
br i1 %130, label %131, label %138
131: ; preds = %120
%132 = load float, float* %25
%133 = fpext float %132 to double
%134 = load float, float* %21
%135 = fpext float %134 to double
%136 = call double @llvm.fmuladd.f64(double %135, double 1.000000e+05, double %133)
%137 = fptrunc double %136 to float
store float %137, float* %28
br label %216
138: ; preds = %120
%139 = call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0))
store i32* %139, i32** %6
%140 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.14, i64 0, i64 0))
store float 0.000000e+00, float* %27
store float 0.000000e+00, float* %23
br label %141
141: ; preds = %146, %138
%142 = trunc i64 %33 to i32
%143 = load i32*, i32** %6
%144 = call i32* @fgets(i8* %35, i32 %142, i32* %143)
%145 = icmp ne i32* %144, null
br i1 %145, label %146, label %148
146: ; preds = %141
%147 = call i32 (i8*, i8*, float*, float*, ...) @sscanf(i8* %35, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.15, i64 0, i64 0), float* %26, float* %27, float* %22, float* %23)
br label %141
148: ; preds = %141
%149 = load float, float* %26
%150 = fpext float %149 to double
%151 = load float, float* %27
%152 = fpext float %151 to double
%153 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.16, i64 0, i64 0), double %150, double %152)
%154 = load float, float* %21
%155 = load float, float* %22
%156 = fmul float %154, %155
%157 = fcmp ole float %156, 0.000000e+00
br i1 %157, label %158, label %190
158: ; preds = %148
%159 = load float, float* %25
%160 = load float, float* %22
%161 = load float, float* %26
%162 = load float, float* %21
%163 = fmul float %161, %162
%164 = fneg float %163
%165 = call float @llvm.fmuladd.f32(float %159, float %160, float %164)
%166 = load float, float* %22
%167 = load float, float* %21
%168 = fsub float %166, %167
%169 = fdiv float %165, %168
store float %169, float* %28
%170 = load i32*, i32** %6
%171 = load float, float* %25
%172 = fpext float %171 to double
%173 = load float, float* %26
%174 = fpext float %173 to double
%175 = load float, float* %21
%176 = fpext float %175 to double
%177 = load float, float* %22
%178 = fpext float %177 to double
%179 = call i32 (i32*, i8*, ...) @fprintf(i32* %170, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.15, i64 0, i64 0), double %172, double %174, double %176, double %178)
%180 = load float, float* %25
%181 = fpext float %180 to double
%182 = load float, float* %26
%183 = fpext float %182 to double
%184 = load float, float* %21
%185 = fpext float %184 to double
%186 = load float, float* %22
%187 = fpext float %186 to double
%188 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.15, i64 0, i64 0), double %181, double %183, double %185, double %187)
%189 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.17, i64 0, i64 0))
br label %213
190: ; preds = %148
%191 = load float, float* %25
%192 = load float, float* %23
%193 = load float, float* %27
%194 = load float, float* %21
%195 = fmul float %193, %194
%196 = fneg float %195
%197 = call float @llvm.fmuladd.f32(float %191, float %192, float %196)
%198 = load float, float* %23
%199 = load float, float* %21
%200 = fsub float %198, %199
%201 = fdiv float %197, %200
store float %201, float* %28
%202 = load i32*, i32** %6
%203 = load float, float* %25
%204 = fpext float %203 to double
%205 = load float, float* %27
%206 = fpext float %205 to double
%207 = load float, float* %21
%208 = fpext float %207 to double
%209 = load float, float* %23
%210 = fpext float %209 to double
%211 = call i32 (i32*, i8*, ...) @fprintf(i32* %202, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.15, i64 0, i64 0), double %204, double %206, double %208, double %210)
%212 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.18, i64 0, i64 0))
br label %213
213: ; preds = %190, %158
%214 = load i32*, i32** %6
%215 = call i32 @fclose(i32* %214)
br label %216
216: ; preds = %213, %131
%217 = load float, float* %28
%218 = fpext float %217 to double
%219 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.19, i64 0, i64 0), double %218)
%220 = load float, float* %28
%221 = load float, float* %30
%222 = fadd float %221, 5.000000e+00
%223 = fcmp ole float %220, %222
br i1 %223, label %224, label %227
224: ; preds = %216
%225 = load float, float* %30
%226 = fadd float %225, 5.000000e+00
store float %226, float* %28
br label %227
227: ; preds = %224, %216
%228 = load float, float* %28
%229 = load float, float* %30
%230 = fadd float %229, 1.750000e+02
%231 = fcmp oge float %228, %230
br i1 %231, label %232, label %235
232: ; preds = %227
%233 = load float, float* %30
%234 = fadd float %233, 1.750000e+02
store float %234, float* %28
br label %235
235: ; preds = %232, %227
%236 = load float, float* %28
%237 = fpext float %236 to double
%238 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.19, i64 0, i64 0), double %237)
br label %239
239: ; preds = %235
%240 = getelementptr inbounds [3 x float], [3 x float]* %14, i64 0, i64 1
%241 = load float, float* %240
%242 = fpext float %241 to double
%243 = load float, float* %29
%244 = fpext float %243 to double
%245 = load float, float* %28
%246 = load float, float* @M_PI
%247 = fmul float %245, %246
%248 = fdiv float %247, 1.800000e+02
%249 = fptosi float %248 to i32
%250 = call double @cosf(i32 %249)
%251 = call double @llvm.fmuladd.f64(double %244, double %250, double %242)
%252 = fptrunc double %251 to float
%253 = getelementptr inbounds [3 x float], [3 x float]* %16, i64 0, i64 1
store float %252, float* %253
%254 = getelementptr inbounds [3 x float], [3 x float]* %14, i64 0, i64 2
%255 = load float, float* %254
%256 = getelementptr inbounds [3 x float], [3 x float]* %16, i64 0, i64 2
store float %255, float* %256
%257 = getelementptr inbounds [3 x float], [3 x float]* %14, i64 0, i64 3
%258 = load float, float* %257
%259 = fpext float %258 to double
%260 = load float, float* %29
%261 = fpext float %260 to double
%262 = load float, float* %28
%263 = load float, float* @M_PI
%264 = fmul float %262, %263
%265 = fdiv float %264, 1.800000e+02
%266 = fptosi float %265 to i32
%267 = call double @sinf(i32 %266)
%268 = call double @llvm.fmuladd.f64(double %261, double %267, double %259)
%269 = fptrunc double %268 to float
%270 = getelementptr inbounds [3 x float], [3 x float]* %16, i64 0, i64 3
store float %269, float* %270
%271 = getelementptr inbounds [3 x float], [3 x float]* %16, i64 0, i64 1
%272 = load float, float* %271
%273 = getelementptr inbounds [3 x float], [3 x float]* %17, i64 0, i64 1
store float %272, float* %273
%274 = getelementptr inbounds [3 x float], [3 x float]* %15, i64 0, i64 2
%275 = load float, float* %274
%276 = getelementptr inbounds [3 x float], [3 x float]* %17, i64 0, i64 2
store float %275, float* %276
%277 = getelementptr inbounds [3 x float], [3 x float]* %16, i64 0, i64 3
%278 = load float, float* %277
%279 = getelementptr inbounds [3 x float], [3 x float]* %17, i64 0, i64 3
store float %278, float* %279
%280 = call i32* @fopen(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.20, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.21, i64 0, i64 0))
store i32* %280, i32** %3
%281 = load i32*, i32** %3
%282 = call i32 (i32*, i8*, ...) @fprintf(i32* %281, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.22, i64 0, i64 0))
%283 = load i32*, i32** %3
%284 = load float, float* %28
%285 = fadd float 9.000000e+01, %284
%286 = load float, float* @M_PI
%287 = fmul float %285, %286
%288 = fdiv float %287, 1.800000e+02
%289 = fptosi float %288 to i32
%290 = call double @cosf(i32 %289)
%291 = load float, float* %28
%292 = fadd float 9.000000e+01, %291
%293 = load float, float* @M_PI
%294 = fmul float %292, %293
%295 = fdiv float %294, 1.800000e+02
%296 = fptosi float %295 to i32
%297 = call double @sinf(i32 %296)
%298 = call i32 (i32*, i8*, ...) @fprintf(i32* %283, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.23, i64 0, i64 0), double %290, double %297)
%299 = load i32*, i32** %3
%300 = call i32 (i32*, i8*, ...) @fprintf(i32* %299, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.24, i64 0, i64 0))
%301 = load i32*, i32** %3
%302 = getelementptr inbounds [3 x float], [3 x float]* %14, i64 0, i64 1
%303 = load float, float* %302
%304 = fpext float %303 to double
%305 = getelementptr inbounds [3 x float], [3 x float]* %14, i64 0, i64 2
%306 = load float, float* %305
%307 = fpext float %306 to double
%308 = getelementptr inbounds [3 x float], [3 x float]* %14, i64 0, i64 3
%309 = load float, float* %308
%310 = fpext float %309 to double
%311 = call i32 (i32*, i8*, ...) @fprintf(i32* %301, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.25, i64 0, i64 0), double %304, double %307, double %310)
%312 = load i32*, i32** %3
%313 = getelementptr inbounds [3 x float], [3 x float]* %15, i64 0, i64 1
%314 = load float, float* %313
%315 = fpext float %314 to double
%316 = getelementptr inbounds [3 x float], [3 x float]* %15, i64 0, i64 2
%317 = load float, float* %316
%318 = fpext float %317 to double
%319 = getelementptr inbounds [3 x float], [3 x float]* %15, i64 0, i64 3
%320 = load float, float* %319
%321 = fpext float %320 to double
%322 = call i32 (i32*, i8*, ...) @fprintf(i32* %312, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.25, i64 0, i64 0), double %315, double %318, double %321)
%323 = load i32*, i32** %3
%324 = getelementptr inbounds [3 x float], [3 x float]* %16, i64 0, i64 1
%325 = load float, float* %324
%326 = fpext float %325 to double
%327 = getelementptr inbounds [3 x float], [3 x float]* %16, i64 0, i64 2
%328 = load float, float* %327
%329 = fpext float %328 to double
%330 = getelementptr inbounds [3 x float], [3 x float]* %16, i64 0, i64 3
%331 = load float, float* %330
%332 = fpext float %331 to double
%333 = call i32 (i32*, i8*, ...) @fprintf(i32* %323, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.25, i64 0, i64 0), double %326, double %329, double %332)
%334 = load i32*, i32** %3
%335 = call i32 (i32*, i8*, ...) @fprintf(i32* %334, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.26, i64 0, i64 0))
%336 = load i32*, i32** %3
%337 = load float, float* %28
%338 = fadd float 9.000000e+01, %337
%339 = load float, float* @M_PI
%340 = fmul float %338, %339
%341 = fdiv float %340, 1.800000e+02
%342 = fptosi float %341 to i32
%343 = call double @cosf(i32 %342)
%344 = load float, float* %28
%345 = fadd float 9.000000e+01, %344
%346 = load float, float* @M_PI
%347 = fmul float %345, %346
%348 = fdiv float %347, 1.800000e+02
%349 = fptosi float %348 to i32
%350 = call double @sinf(i32 %349)
%351 = call i32 (i32*, i8*, ...) @fprintf(i32* %336, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.23, i64 0, i64 0), double %343, double %350)
%352 = load i32*, i32** %3
%353 = call i32 (i32*, i8*, ...) @fprintf(i32* %352, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.24, i64 0, i64 0))
%354 = load i32*, i32** %3
%355 = getelementptr inbounds [3 x float], [3 x float]* %17, i64 0, i64 1
%356 = load float, float* %355
%357 = fpext float %356 to double
%358 = getelementptr inbounds [3 x float], [3 x float]* %17, i64 0, i64 2
%359 = load float, float* %358
%360 = fpext float %359 to double
%361 = getelementptr inbounds [3 x float], [3 x float]* %17, i64 0, i64 3
%362 = load float, float* %361
%363 = fpext float %362 to double
%364 = call i32 (i32*, i8*, ...) @fprintf(i32* %354, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.25, i64 0, i64 0), double %357, double %360, double %363)
%365 = load i32*, i32** %3
%366 = getelementptr inbounds [3 x float], [3 x float]* %15, i64 0, i64 1
%367 = load float, float* %366
%368 = fpext float %367 to double
%369 = getelementptr inbounds [3 x float], [3 x float]* %15, i64 0, i64 2
%370 = load float, float* %369
%371 = fpext float %370 to double
%372 = getelementptr inbounds [3 x float], [3 x float]* %15, i64 0, i64 3
%373 = load float, float* %372
%374 = fpext float %373 to double
%375 = call i32 (i32*, i8*, ...) @fprintf(i32* %365, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.25, i64 0, i64 0), double %368, double %371, double %374)
%376 = load i32*, i32** %3
%377 = getelementptr inbounds [3 x float], [3 x float]* %16, i64 0, i64 1
%378 = load float, float* %377
%379 = fpext float %378 to double
%380 = getelementptr inbounds [3 x float], [3 x float]* %16, i64 0, i64 2
%381 = load float, float* %380
%382 = fpext float %381 to double
%383 = getelementptr inbounds [3 x float], [3 x float]* %16, i64 0, i64 3
%384 = load float, float* %383
%385 = fpext float %384 to double
%386 = call i32 (i32*, i8*, ...) @fprintf(i32* %376, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.25, i64 0, i64 0), double %379, double %382, double %385)
%387 = load i32*, i32** %3
%388 = call i32 (i32*, i8*, ...) @fprintf(i32* %387, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.26, i64 0, i64 0))
%389 = load i32*, i32** %3
%390 = call i32 (i32*, i8*, ...) @fprintf(i32* %389, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.27, i64 0, i64 0))
%391 = load i32*, i32** %3
%392 = call i32 @fclose(i32* %391)
store i32 0, i32* %31
br label %393
393: ; preds = %239, %82, %44
%394 = load i8*, i8** %7
%395 = load i32, i32* %31
switch i32 %395, label %398 [
i32 0, label %396
i32 1, label %396
]
396: ; preds = %393, %393
%397 = load i32, i32* %1
ret i32 %397
398: ; preds = %393
unreachable
}

LLVM IR (-O2):
@BUFSIZ = global i32 0
@.str = [33 x i8] c"./constant/triSurface/hindge.dat\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [54 x i8] c"Error! locations of the hindge point is not specified\00"
@.str.3 = [11 x i8] c"%f %f %f \0A\00"
@.str.4 = [17 x i8] c"%f %f %f \0A %f %f\00"
@.str.5 = [49 x i8] c"The hindge points are (%f %f %f) and (%f %f %f)\0A\00"
@.str.6 = [19 x i8] c"./forceBalance.dat\00"
@.str.7 = [41 x i8] c"Error! Unable to locate forceBalance.dat\00"
@.str.8 = [8 x i8] c"%f %f \0A\00"
@.str.9 = [21 x i8] c"i = %i Angle 1 = %f\0A\00"
@.str.10 = [30 x i8] c"i= %i Angle 1:%f Angle 2: %f\0A\00"
@.str.11 = [41 x i8] c"The Flag is %i\0A Angle 1: %f Angle 2: %f\0A\00"
@.str.12 = [10 x i8] c"./FPM.dat\00"
@.str.13 = [3 x i8] c"a+\00"
@.str.15 = [14 x i8] c"%f %f %f %f \0A\00"
@.str.16 = [27 x i8] c"Angle 2 : %f Angle 3: %f \0A\00"
@.str.19 = [30 x i8] c"angle_optimized is %f degree\0A\00"
@M_PI = global float 0.000000e+00
@.str.20 = [31 x i8] c"./constant/triSurface/flap.stl\00"
@.str.21 = [2 x i8] c"w\00"
@.str.22 = [12 x i8] c"solid flap\0A\00"
@.str.23 = [26 x i8] c"\09 facet normal %f 0.0 %f\0A\00"
@.str.24 = [15 x i8] c"\09\09 outer loop\0A\00"
@.str.25 = [21 x i8] c"\09\09\09 vertex %f %f %f\0A\00"
@.str.26 = [23 x i8] c"\09\09 endloop\0A\09 endfacet\0A\00"
@.str.27 = [14 x i8] c"endsolid flap\00"
@str = [39 x i8] c"Opening False Position Method Files...\00"
@str.28 = [7 x i8] c"Case 2\00"
@str.29 = [7 x i8] c"Case 1\00"
define i32 @main() {
%1 = alloca [3 x float]
%2 = alloca [3 x float]
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
%11 = load i32, i32* @BUFSIZ
%12 = zext i32 %11 to i64
%13 = alloca i8, i64 %12
%14 = bitcast [3 x float]* %1 to i8*
%15 = bitcast [3 x float]* %2 to i8*
%16 = bitcast float* %3 to i8*
%17 = bitcast float* %4 to i8*
%18 = bitcast float* %5 to i8*
%19 = bitcast float* %6 to i8*
%20 = bitcast float* %7 to i8*
%21 = bitcast float* %8 to i8*
%22 = bitcast float* %9 to i8*
%23 = bitcast float* %10 to i8*
%24 = tail call i32* @fopen(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%25 = icmp eq i32* %24, null
br i1 %25, label %26, label %28
26: ; preds = %0
%27 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @.str.2, i64 0, i64 0))
br label %246
28: ; preds = %0
%29 = getelementptr inbounds [3 x float], [3 x float]* %1, i64 0, i64 1
%30 = getelementptr inbounds [3 x float], [3 x float]* %1, i64 0, i64 2
%31 = getelementptr inbounds [3 x float], [3 x float]* %1, i64 0, i64 3
%32 = call i32 (i32*, i8*, float*, float*, float*, ...) @fscanf(i32* %24, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), float* %29, float* %30, float* %31)
%33 = getelementptr inbounds [3 x float], [3 x float]* %2, i64 0, i64 1
%34 = getelementptr inbounds [3 x float], [3 x float]* %2, i64 0, i64 2
%35 = getelementptr inbounds [3 x float], [3 x float]* %2, i64 0, i64 3
%36 = call i32 (i32*, i8*, float*, float*, float*, ...) @fscanf(i32* %24, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), float* %33, float* %34, float* %35, float* %10, float* %9)
%37 = load float, float* %29
%38 = fpext float %37 to double
%39 = load float, float* %30
%40 = fpext float %39 to double
%41 = load float, float* %31
%42 = fpext float %41 to double
%43 = load float, float* %33
%44 = fpext float %43 to double
%45 = load float, float* %34
%46 = fpext float %45 to double
%47 = load float, float* %35
%48 = fpext float %47 to double
%49 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @.str.5, i64 0, i64 0), double %38, double %40, double %42, double %44, double %46, double %48)
%50 = call i32 @fclose(i32* %24)
%51 = call i32* @fopen(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%52 = icmp eq i32* %51, null
br i1 %52, label %62, label %53
53: ; preds = %28
%54 = call i32* @fgets(i8* %13, i32 %11, i32* %51)
%55 = icmp ne i32* %54, null
%56 = call i32 (i8*, i8*, float*, float*, ...) @sscanf(i8* %13, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0), float* %6, float* %3)
%57 = load float, float* %6
%58 = fpext float %57 to double
%59 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.9, i64 0, i64 0), i32 0, double %58)
%60 = call i32* @fgets(i8* %13, i32 %11, i32* %51)
%61 = icmp ne i32* %60, null
br label %64
62: ; preds = %28
%63 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.7, i64 0, i64 0))
br label %246
64: ; preds = %53, %64
%65 = phi i32 [ %78, %64 ], [ 1, %53 ]
%66 = phi i32 [ %77, %64 ], [ 0, %53 ]
%67 = load float, float* %6
store float %67, float* %7
%68 = load float, float* %3
store float %68, float* %4
%69 = call i32 (i8*, i8*, float*, float*, ...) @sscanf(i8* %13, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0), float* %6, float* %3)
%70 = load float, float* %6
%71 = fpext float %70 to double
%72 = fpext float %67 to double
%73 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.10, i64 0, i64 0), i32 %65, double %71, double %72)
%74 = load float, float* %3
%75 = fmul float %74, %68
%76 = fcmp olt float %75, 0.000000e+00
%77 = select i1 %76, i32 1, i32 %66
%78 = add nuw nsw i32 %65, 1
%79 = call i32* @fgets(i8* %13, i32 %11, i32* %51)
%80 = icmp eq i32* %79, null
br i1 %80, label %81, label %64
81: ; preds = %64
%82 = fpext float %67 to double
%83 = load float, float* %6
%84 = fpext float %83 to double
%85 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.11, i64 0, i64 0), i32 %77, double %84, double %82)
%86 = call i32 @fclose(i32* %51)
%87 = icmp eq i32 %77, 0
br i1 %87, label %88, label %95
88: ; preds = %81
%89 = load float, float* %6
%90 = fpext float %89 to double
%91 = load float, float* %3
%92 = fpext float %91 to double
%93 = call double @llvm.fmuladd.f64(double %92, double 1.000000e+05, double %90)
%94 = fptrunc double %93 to float
br label %157
95: ; preds = %81
%96 = call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0))
%97 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str, i64 0, i64 0))
store float 0.000000e+00, float* %8
store float 0.000000e+00, float* %5
%98 = call i32* @fgets(i8* %13, i32 %11, i32* %96)
%99 = icmp eq i32* %98, null
br i1 %99, label %109, label %100
100: ; preds = %95, %100
%101 = call i32 (i8*, i8*, float*, float*, ...) @sscanf(i8* %13, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.15, i64 0, i64 0), float* %7, float* %8, float* %4, float* %5)
%102 = call i32* @fgets(i8* %13, i32 %11, i32* %96)
%103 = icmp eq i32* %102, null
br i1 %103, label %104, label %100
104: ; preds = %100
%105 = load float, float* %7
%106 = load float, float* %8
%107 = fpext float %105 to double
%108 = fpext float %106 to double
br label %109
109: ; preds = %104, %95
%110 = phi double [ %107, %104 ], [ %82, %95 ]
%111 = phi double [ %108, %104 ], [ 0.000000e+00, %95 ]
%112 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.16, i64 0, i64 0), double %110, double %111)
%113 = load float, float* %3
%114 = load float, float* %4
%115 = fmul float %113, %114
%116 = fcmp ugt float %115, 0.000000e+00
%117 = load float, float* %6
br i1 %116, label %139, label %118
118: ; preds = %109
%119 = load float, float* %7
%120 = fneg float %119
%121 = fmul float %113, %120
%122 = call float @llvm.fmuladd.f32(float %117, float %114, float %121)
%123 = fsub float %114, %113
%124 = fdiv float %122, %123
%125 = fpext float %117 to double
%126 = fpext float %119 to double
%127 = fpext float %113 to double
%128 = fpext float %114 to double
%129 = call i32 (i32*, i8*, ...) @fprintf(i32* %96, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.15, i64 0, i64 0), double %125, double %126, double %127, double %128)
%130 = load float, float* %6
%131 = fpext float %130 to double
%132 = load float, float* %7
%133 = fpext float %132 to double
%134 = load float, float* %3
%135 = fpext float %134 to double
%136 = load float, float* %4
%137 = fpext float %136 to double
%138 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.15, i64 0, i64 0), double %131, double %133, double %135, double %137)
br label %152
139: ; preds = %109
%140 = load float, float* %5
%141 = load float, float* %8
%142 = fneg float %141
%143 = fmul float %113, %142
%144 = call float @llvm.fmuladd.f32(float %117, float %140, float %143)
%145 = fsub float %140, %113
%146 = fdiv float %144, %145
%147 = fpext float %117 to double
%148 = fpext float %141 to double
%149 = fpext float %113 to double
%150 = fpext float %140 to double
%151 = call i32 (i32*, i8*, ...) @fprintf(i32* %96, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.15, i64 0, i64 0), double %147, double %148, double %149, double %150)
br label %152
152: ; preds = %139, %118
%153 = phi i8* [ getelementptr inbounds ([7 x i8], [7 x i8]* @str.28, i64 0, i64 0), %139 ], [ getelementptr inbounds ([7 x i8], [7 x i8]* @str.29, i64 0, i64 0), %118 ]
%154 = phi float [ %146, %139 ], [ %124, %118 ]
%155 = call i32 @puts(i8* dereferenceable(1) %153)
%156 = call i32 @fclose(i32* %96)
br label %157
157: ; preds = %152, %88
%158 = phi float [ %94, %88 ], [ %154, %152 ]
%159 = fpext float %158 to double
%160 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.19, i64 0, i64 0), double %159)
%161 = load float, float* %10
%162 = fadd float %161, 5.000000e+00
%163 = fcmp ole float %158, %162
%164 = select i1 %163, float %162, float %158
%165 = fadd float %161, 1.750000e+02
%166 = fcmp oge float %164, %165
%167 = select i1 %166, float %165, float %164
%168 = fpext float %167 to double
%169 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.19, i64 0, i64 0), double %168)
%170 = load float, float* %29
%171 = fpext float %170 to double
%172 = load float, float* %9
%173 = fpext float %172 to double
%174 = load float, float* @M_PI
%175 = fmul float %174, %167
%176 = fdiv float %175, 1.800000e+02
%177 = fptosi float %176 to i32
%178 = call double @cosf(i32 %177)
%179 = call double @llvm.fmuladd.f64(double %173, double %178, double %171)
%180 = fptrunc double %179 to float
%181 = load float, float* %30
%182 = load float, float* @M_PI
%183 = fmul float %167, %182
%184 = fdiv float %183, 1.800000e+02
%185 = fptosi float %184 to i32
%186 = call double @sinf(i32 %185)
%187 = load float, float* %34
%188 = call i32* @fopen(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.20, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.21, i64 0, i64 0))
%189 = call i64 @fwrite(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.22, i64 0, i64 0), i64 11, i64 1, i32* %188)
%190 = fadd float %167, 9.000000e+01
%191 = load float, float* @M_PI
%192 = fmul float %190, %191
%193 = fdiv float %192, 1.800000e+02
%194 = fptosi float %193 to i32
%195 = call double @cosf(i32 %194)
%196 = load float, float* @M_PI
%197 = fmul float %190, %196
%198 = fdiv float %197, 1.800000e+02
%199 = fptosi float %198 to i32
%200 = call double @sinf(i32 %199)
%201 = call i32 (i32*, i8*, ...) @fprintf(i32* %188, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.23, i64 0, i64 0), double %195, double %200)
%202 = call i64 @fwrite(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.24, i64 0, i64 0), i64 14, i64 1, i32* %188)
%203 = load float, float* %29
%204 = fpext float %203 to double
%205 = load float, float* %30
%206 = fpext float %205 to double
%207 = load float, float* %31
%208 = fpext float %207 to double
%209 = call i32 (i32*, i8*, ...) @fprintf(i32* %188, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.25, i64 0, i64 0), double %204, double %206, double %208)
%210 = load float, float* %33
%211 = fpext float %210 to double
%212 = load float, float* %34
%213 = fpext float %212 to double
%214 = load float, float* %35
%215 = fpext float %214 to double
%216 = call i32 (i32*, i8*, ...) @fprintf(i32* %188, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.25, i64 0, i64 0), double %211, double %213, double %215)
%217 = fpext float %180 to double
%218 = fpext float %181 to double
%219 = call i32 (i32*, i8*, ...) @fprintf(i32* %188, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.25, i64 0, i64 0), double %217, double %218, double poison)
%220 = call i64 @fwrite(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.26, i64 0, i64 0), i64 22, i64 1, i32* %188)
%221 = load float, float* @M_PI
%222 = fmul float %190, %221
%223 = fdiv float %222, 1.800000e+02
%224 = fptosi float %223 to i32
%225 = call double @cosf(i32 %224)
%226 = load float, float* @M_PI
%227 = fmul float %190, %226
%228 = fdiv float %227, 1.800000e+02
%229 = fptosi float %228 to i32
%230 = call double @sinf(i32 %229)
%231 = call i32 (i32*, i8*, ...) @fprintf(i32* %188, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.23, i64 0, i64 0), double %225, double %230)
%232 = call i64 @fwrite(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.24, i64 0, i64 0), i64 14, i64 1, i32* %188)
%233 = fpext float %187 to double
%234 = call i32 (i32*, i8*, ...) @fprintf(i32* %188, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.25, i64 0, i64 0), double %217, double %233, double poison)
%235 = load float, float* %33
%236 = fpext float %235 to double
%237 = load float, float* %34
%238 = fpext float %237 to double
%239 = load float, float* %35
%240 = fpext float %239 to double
%241 = call i32 (i32*, i8*, ...) @fprintf(i32* %188, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.25, i64 0, i64 0), double %236, double %238, double %240)
%242 = call i32 (i32*, i8*, ...) @fprintf(i32* %188, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.25, i64 0, i64 0), double %217, double %218, double poison)
%243 = call i64 @fwrite(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.26, i64 0, i64 0), i64 22, i64 1, i32* %188)
%244 = call i64 @fwrite(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.27, i64 0, i64 0), i64 13, i64 1, i32* %188)
%245 = call i32 @fclose(i32* %188)
br label %246
246: ; preds = %157, %62, %26
%247 = phi i32 [ 1, %26 ], [ 1, %62 ], [ 0, %157 ]
ret i32 %247
}