int main() {
  int AHRS_ID = 0;
  double AHRS_phi = 0;
  double AHRS_theta = 0;
  double AHRS_psi = 0;
  double AHRS_theta_b = 0;
  double AHRS_theta_f = 0;
  double AHRS_f_tau = 0.1;
  double PID_CMDtheta = 0;
  double PID_P = 100;
  double PID_I = 0;
  double PID_D = 100;
  double PID_CMDduty = 0;
  double PID_Integral = 0;
  double time_del = 0.001;
  int i1, j1;
  int i2, j2;
  int i4, j4;
  int UART1_News = 1;
  int UART2_News = 1;
  int UART4_News = 1;
  int readfromUART1 = 0;
  int readfromUART2 = 0;
  int readfromUART4 = 0;
  int UART1T = 0;
  int UART1R = 0;
  int UART2T = 0;
  int UART2R = 0;
  int UART4T = 0;
  int UART4R = 0;
  char UART1_buf[100] = {
      '\0',
  };
  char UART2_buf[100] = {
      '\0',
  };
  char UART4_buf[100] = {
      '\0',
  };
  char UART1_data[500] = {
      '\0',
  };
  char UART2_data[500] = {
      '\0',
  };
  char UART4_data[500] = {
      '\0',
  };
  char UART1_forParse[100] = {
      '\0',
  };
  char UART2_forParse[100] = {
      '\0',
  };
  char UART4_forParse[100] = {
      '\0',
  };
  int UART1_position[3] = {0, 0, 0};
  int UART2_position[3] = {0, 0, 0};
  int UART4_position[3] = {0, 0, 0};
  int UART1_cpy_flag = 0;
  int UART2_cpy_flag = 0;
  int UART4_cpy_flag = 0;
  char test1[50] = {
      '\0',
  };
  char test2[50] = {
      '\0',
  };
  char test4[50] = {
      '\0',
  };
  SettingCape();
  LEDOn(23);
  LEDOn(47);
  InitPin(27);
  SetPinDirt(27, "in");
  printf("Start\n");
  UART1T = UART_init(1, 'T');
  printf("UART1T : %d\n", UART1T);
  UART1R = UART_init(1, 'R');
  printf("UART1R : %d\n", UART1R);
  UART_Baudrate_NonC(UART1T, 115200, 0, 1);
  UART2T = UART_init(2, 'T');
  printf("UART2T : %d\n", UART2T);
  UART2R = UART_init(2, 'R');
  printf("UART2R : %d\n", UART2R);
  UART_Baudrate_NonC(UART2T, 115200, 0, 1);
  UART4T = UART_init(4, 'T');
  printf("UART4T : %d\n", UART4T);
  UART4R = UART_init(4, 'R');
  printf("UART4R : %d\n", UART4R);
  UART_Baudrate_NonC(UART4T, 115200, 0, 1);
  printf("START!\n");
  write(UART2T, "START!\n", 8);
  while (!GetPinValue(27)) {
    readfromUART1 = read(UART1R, UART1_buf, 100);
    strcat(UART1_data, UART1_buf);
    Nullize(UART1_buf, readfromUART1);
    if (readfromUART1 != -1) {
      for (i1 = UART1_position[2], UART1_position[0] = UART1_position[2],
          UART1_position[1] = UART1_position[2] + 1, UART1_cpy_flag = 0;
           i1 < sizeof(UART1_data); i1++) {
        if (UART1_data[i1] == '$') {
          UART1_position[0] = i1;
          UART1_cpy_flag = 1;
          i1++;
        }
        if ((UART1_cpy_flag == 1) && (UART1_data[i1 - 3] == '*')) {
          UART1_position[1] = i1;
          UART1_cpy_flag = 2;
          break;
        }
        if ((UART1_data[i1] == '\0') && (UART1_cpy_flag == 1)) {
          UART1_position[0] = UART1_position[2];
          UART1_position[1] = UART1_position[2] + 1;
          break;
        }
      }
      for (j1 = 0; (UART1_cpy_flag == 2) &&
                   (j1 + UART1_position[0] < UART1_position[1]);
           j1++) {
        UART1_forParse[j1] = UART1_data[UART1_position[0] + j1];
        if (UART1_forParse[j1 - 2] == '*') {
          UART1_forParse[j1 + 1] = '\0';
          UART1_cpy_flag = 3;
          UART1_position[2] = UART1_position[1];
          break;
        }
      }
      if (UART1_cpy_flag == 3) {
        sprintf(test1, "1|%s|\n", UART1_forParse);
        AHRS_theta = AHRS_theta_b;
        AHRS_Parsing_RPY5(UART1_forParse, &AHRS_ID, &AHRS_phi, &AHRS_theta,
                          &AHRS_psi);
        if (AHRS_theta_f == 0)
          AHRS_theta_f = AHRS_theta;
        AHRS_theta_f = (AHRS_f_tau / (AHRS_f_tau + time_del)) * AHRS_theta_f +
                       (time_del / (AHRS_f_tau + time_del)) * AHRS_theta;
        printf("theta : %10.3f,\t Filtered theta : %10.3f\n", AHRS_theta,
               AHRS_theta_f);
        sprintf(test1, "theta : %10.3f,\t Filtered theta : %10.3f\n",
                AHRS_theta, AHRS_theta_f);
        write(UART2T, test1, strlen(test1) + 1);
        Nullize(UART1_forParse, sizeof(UART1_forParse));
        if (strlen(UART1_data) > 300) {
          Nullize(UART1_data, strlen(UART1_data));
          UART1_position[0] = 0;
          UART1_position[1] = 0;
          UART1_position[2] = 0;
        }
      }
    }
  }
  write(UART4T, "End\n", 5);
  printf("End\n");
  CloseGPin(27);
  LEDOff(23);
  LEDOff(47);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa60,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xda7(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xd8a(%rip),%xmm0
movsd  %xmm0,-0x48(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  0xd75(%rip),%xmm0
movsd  %xmm0,-0x58(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x60(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  0xd50(%rip),%xmm0
movsd  %xmm0,-0x70(%rbp)
movl   $0x1,-0x8c(%rbp)
movl   $0x1,-0x90(%rbp)
movl   $0x1,-0x94(%rbp)
movl   $0x0,-0x98(%rbp)
movl   $0x0,-0x9c(%rbp)
movl   $0x0,-0xa0(%rbp)
movl   $0x0,-0xa4(%rbp)
movl   $0x0,-0xa8(%rbp)
movl   $0x0,-0xac(%rbp)
movl   $0x0,-0xb0(%rbp)
movl   $0x0,-0xb4(%rbp)
movl   $0x0,-0xb8(%rbp)
lea    -0x120(%rbp),%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   10b0 <memset@plt>
lea    -0x190(%rbp),%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   10b0 <memset@plt>
lea    -0x200(%rbp),%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   10b0 <memset@plt>
lea    -0x400(%rbp),%rdi
xor    %esi,%esi
mov    $0x1f4,%edx
call   10b0 <memset@plt>
lea    -0x600(%rbp),%rdi
xor    %esi,%esi
mov    $0x1f4,%edx
call   10b0 <memset@plt>
lea    -0x800(%rbp),%rdi
xor    %esi,%esi
mov    $0x1f4,%edx
call   10b0 <memset@plt>
lea    -0x870(%rbp),%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   10b0 <memset@plt>
lea    -0x8e0(%rbp),%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   10b0 <memset@plt>
lea    -0x950(%rbp),%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   10b0 <memset@plt>
lea    -0x95c(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   10b0 <memset@plt>
lea    -0x968(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   10b0 <memset@plt>
lea    -0x974(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   10b0 <memset@plt>
movl   $0x0,-0x978(%rbp)
movl   $0x0,-0x97c(%rbp)
movl   $0x0,-0x980(%rbp)
lea    -0x9c0(%rbp),%rdi
xor    %esi,%esi
mov    $0x32,%edx
call   10b0 <memset@plt>
lea    -0xa00(%rbp),%rdi
xor    %esi,%esi
mov    $0x32,%edx
call   10b0 <memset@plt>
lea    -0xa40(%rbp),%rdi
xor    %esi,%esi
mov    $0x32,%edx
call   10b0 <memset@plt>
mov    $0x0,%al
call   1100 <SettingCape@plt>
mov    $0x17,%edi
mov    $0x0,%al
call   1130 <LEDOn@plt>
mov    $0x2f,%edi
mov    $0x0,%al
call   1130 <LEDOn@plt>
mov    $0x1b,%edi
mov    $0x0,%al
call   1030 <InitPin@plt>
mov    $0x1b,%edi
lea    0xb79(%rip),%rsi
mov    $0x0,%al
call   10f0 <SetPinDirt@plt>
lea    0xb6e(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
mov    $0x1,%edi
mov    $0x54,%esi
mov    $0x0,%al
call   1090 <UART_init@plt>
mov    %eax,-0xa4(%rbp)
mov    -0xa4(%rbp),%esi
lea    0xb4a(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
mov    $0x1,%edi
mov    $0x52,%esi
mov    $0x0,%al
call   1090 <UART_init@plt>
mov    %eax,-0xa8(%rbp)
mov    -0xa8(%rbp),%esi
lea    0xb2c(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
mov    -0xa4(%rbp),%edi
mov    $0x1c200,%esi
xor    %edx,%edx
mov    $0x1,%ecx
mov    $0x0,%al
call   1050 <UART_Baudrate_NonC@plt>
mov    $0x2,%edi
mov    $0x54,%esi
mov    $0x0,%al
call   1090 <UART_init@plt>
mov    %eax,-0xac(%rbp)
mov    -0xac(%rbp),%esi
lea    0xaf5(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
mov    $0x2,%edi
mov    $0x52,%esi
mov    $0x0,%al
call   1090 <UART_init@plt>
mov    %eax,-0xb0(%rbp)
mov    -0xb0(%rbp),%esi
lea    0xad7(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
mov    -0xac(%rbp),%edi
mov    $0x1c200,%esi
xor    %edx,%edx
mov    $0x1,%ecx
mov    $0x0,%al
call   1050 <UART_Baudrate_NonC@plt>
mov    $0x4,%edi
mov    $0x54,%esi
mov    $0x0,%al
call   1090 <UART_init@plt>
mov    %eax,-0xb4(%rbp)
mov    -0xb4(%rbp),%esi
lea    0xaa0(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
mov    $0x4,%edi
mov    $0x52,%esi
mov    $0x0,%al
call   1090 <UART_init@plt>
mov    %eax,-0xb8(%rbp)
mov    -0xb8(%rbp),%esi
lea    0xa82(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
mov    -0xb4(%rbp),%edi
mov    $0x1c200,%esi
xor    %edx,%edx
mov    $0x1,%ecx
mov    $0x0,%al
call   1050 <UART_Baudrate_NonC@plt>
lea    0xa68(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
mov    -0xac(%rbp),%edi
lea    0xa54(%rip),%rsi
mov    $0x8,%edx
mov    $0x0,%al
call   1040 <write@plt>
mov    $0x1b,%edi
mov    $0x0,%al
call   10d0 <GetPinValue@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1649 <main+0x429>
jmp    1a04 <main+0x7e4>
mov    -0xa8(%rbp),%edi
lea    -0x120(%rbp),%rsi
mov    $0x64,%edx
mov    $0x0,%al
call   10c0 <read@plt>
mov    %eax,-0x98(%rbp)
lea    -0x400(%rbp),%rdi
lea    -0x120(%rbp),%rsi
call   1120 <strcat@plt>
lea    -0x120(%rbp),%rdi
mov    -0x98(%rbp),%esi
mov    $0x0,%al
call   1060 <Nullize@plt>
cmpl   $0xffffffff,-0x98(%rbp)
je     19ff <main+0x7df>
mov    -0x954(%rbp),%eax
mov    %eax,-0x74(%rbp)
mov    -0x954(%rbp),%eax
mov    %eax,-0x95c(%rbp)
mov    -0x954(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x958(%rbp)
movl   $0x0,-0x978(%rbp)
movslq -0x74(%rbp),%rax
cmp    $0x1f4,%rax
jae    179e <main+0x57e>
movslq -0x74(%rbp),%rax
movsbl -0x400(%rbp,%rax,1),%eax
ff
cmp    $0x24,%eax
jne    170b <main+0x4eb>
mov    -0x74(%rbp),%eax
mov    %eax,-0x95c(%rbp)
movl   $0x1,-0x978(%rbp)
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
cmpl   $0x1,-0x978(%rbp)
jne    1749 <main+0x529>
mov    -0x74(%rbp),%eax
sub    $0x3,%eax
cltq
movsbl -0x400(%rbp,%rax,1),%eax
ff
cmp    $0x2a,%eax
jne    1749 <main+0x529>
mov    -0x74(%rbp),%eax
mov    %eax,-0x958(%rbp)
movl   $0x2,-0x978(%rbp)
jmp    179e <main+0x57e>
movslq -0x74(%rbp),%rax
movsbl -0x400(%rbp,%rax,1),%eax
ff
cmp    $0x0,%eax
jne    178b <main+0x56b>
cmpl   $0x1,-0x978(%rbp)
jne    178b <main+0x56b>
mov    -0x954(%rbp),%eax
mov    %eax,-0x95c(%rbp)
mov    -0x954(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x958(%rbp)
jmp    179e <main+0x57e>
jmp    1790 <main+0x570>
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    16ca <main+0x4aa>
movl   $0x0,-0x78(%rbp)
xor    %eax,%eax
cmpl   $0x2,-0x978(%rbp)
mov    %al,-0xa41(%rbp)
jne    17d2 <main+0x5b2>
mov    -0x78(%rbp),%eax
add    -0x95c(%rbp),%eax
cmp    -0x958(%rbp),%eax
setl   %al
mov    %al,-0xa41(%rbp)
mov    -0xa41(%rbp),%al
test   $0x1,%al
jne    17e5 <main+0x5c5>
jmp    1859 <main+0x639>
mov    -0x95c(%rbp),%eax
add    -0x78(%rbp),%eax
cltq
mov    -0x400(%rbp,%rax,1),%cl
movslq -0x78(%rbp),%rax
mov    %cl,-0x870(%rbp,%rax,1)
mov    -0x78(%rbp),%eax
sub    $0x2,%eax
cltq
movsbl -0x870(%rbp,%rax,1),%eax
ff
cmp    $0x2a,%eax
jne    1846 <main+0x626>
mov    -0x78(%rbp),%eax
add    $0x1,%eax
cltq
movb   $0x0,-0x870(%rbp,%rax,1)
movl   $0x3,-0x978(%rbp)
mov    -0x958(%rbp),%eax
mov    %eax,-0x954(%rbp)
jmp    1859 <main+0x639>
jmp    184b <main+0x62b>
mov    -0x78(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x78(%rbp)
jmp    17a5 <main+0x585>
cmpl   $0x3,-0x978(%rbp)
jne    19fa <main+0x7da>
lea    -0x9c0(%rbp),%rdi
lea    -0x870(%rbp),%rdx
lea    0x7fd(%rip),%rsi
mov    $0x0,%al
call   1140 <sprintf@plt>
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
lea    -0x870(%rbp),%rdi
lea    -0x8(%rbp),%rsi
lea    -0x10(%rbp),%rdx
lea    -0x18(%rbp),%rcx
lea    -0x20(%rbp),%r8
mov    $0x0,%al
call   10e0 <AHRS_Parsing_RPY5@plt>
movsd  -0x30(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    18cc <main+0x6ac>
jp     18cc <main+0x6ac>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
addsd  -0x70(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  -0x30(%rbp),%xmm2
movsd  -0x70(%rbp),%xmm1
movsd  -0x38(%rbp),%xmm3
addsd  -0x70(%rbp),%xmm3
divsd  %xmm3,%xmm1
mulsd  -0x18(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
lea    0x765(%rip),%rdi
mov    $0x2,%al
call   10a0 <printf@plt>
lea    -0x9c0(%rbp),%rdi
movsd  -0x18(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
lea    0x746(%rip),%rsi
mov    $0x2,%al
call   1140 <sprintf@plt>
mov    -0xac(%rbp),%eax
mov    %eax,-0xa54(%rbp)
lea    -0x9c0(%rbp),%rax
mov    %rax,-0xa50(%rbp)
lea    -0x9c0(%rbp),%rdi
call   1070 <strlen@plt>
mov    -0xa54(%rbp),%edi
mov    -0xa50(%rbp),%rsi
mov    %rax,%rdx
add    $0x1,%rdx
mov    $0x0,%al
call   1040 <write@plt>
lea    -0x870(%rbp),%rdi
mov    $0x64,%esi
mov    $0x0,%al
call   1060 <Nullize@plt>
lea    -0x400(%rbp),%rdi
call   1070 <strlen@plt>
cmp    $0x12c,%rax
jbe    19f5 <main+0x7d5>
lea    -0x400(%rbp),%rax
mov    %rax,-0xa60(%rbp)
lea    -0x400(%rbp),%rdi
call   1070 <strlen@plt>
mov    -0xa60(%rbp),%rdi
mov    %rax,%rsi
mov    $0x0,%al
call   1060 <Nullize@plt>
movl   $0x0,-0x95c(%rbp)
movl   $0x0,-0x958(%rbp)
movl   $0x0,-0x954(%rbp)
jmp    19fa <main+0x7da>
jmp    19ff <main+0x7df>
jmp    1628 <main+0x408>
mov    -0xb4(%rbp),%edi
lea    0x698(%rip),%rsi
mov    $0x5,%edx
mov    $0x0,%al
call   1040 <write@plt>
lea    0x685(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
mov    $0x1b,%edi
mov    $0x0,%al
call   1110 <CloseGPin@plt>
mov    $0x17,%edi
mov    $0x0,%al
call   1080 <LEDOff@plt>
mov    $0x2f,%edi
mov    $0x0,%al
call   1080 <LEDOff@plt>
xor    %eax,%eax
add    $0xa60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x358,%rsp
movl   $0x0,0x1c(%rsp)
movq   $0x0,0x38(%rsp)
movq   $0x0,0x8(%rsp)
movq   $0x0,0x30(%rsp)
xorps  %xmm0,%xmm0
movaps %xmm0,0x140(%rsp)
movaps %xmm0,0x130(%rsp)
movaps %xmm0,0x120(%rsp)
movaps %xmm0,0x110(%rsp)
movaps %xmm0,0x100(%rsp)
movaps %xmm0,0xf0(%rsp)
movl   $0x0,0x150(%rsp)
lea    0x160(%rsp),%r12
mov    $0x1f4,%edx
mov    %r12,%rdi
xor    %esi,%esi
call   10c0 <memset@plt>
xorps  %xmm0,%xmm0
movaps %xmm0,0xd0(%rsp)
movaps %xmm0,0xc0(%rsp)
movaps %xmm0,0xb0(%rsp)
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0x80(%rsp)
movl   $0x0,0xe0(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movw   $0x0,0x70(%rsp)
xor    %eax,%eax
call   1110 <SettingCape@plt>
mov    $0x17,%edi
xor    %eax,%eax
call   1140 <LEDOn@plt>
mov    $0x2f,%edi
xor    %eax,%eax
call   1140 <LEDOn@plt>
mov    $0x1b,%edi
xor    %eax,%eax
call   1030 <InitPin@plt>
lea    0xcd9(%rip),%rsi
mov    $0x1b,%edi
xor    %eax,%eax
call   1100 <SetPinDirt@plt>
lea    0xd55(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%r15d
mov    $0x1,%edi
mov    $0x54,%esi
xor    %eax,%eax
call   10a0 <UART_init@plt>
mov    %eax,%ebp
lea    0xca4(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   10b0 <printf@plt>
mov    $0x1,%edi
mov    $0x52,%esi
xor    %eax,%eax
call   10a0 <UART_init@plt>
mov    %eax,%r14d
lea    0xc8d(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   10b0 <printf@plt>
mov    %ebp,%edi
mov    $0x1c200,%esi
xor    %edx,%edx
mov    $0x1,%ecx
xor    %eax,%eax
call   1060 <UART_Baudrate_NonC@plt>
mov    $0x2,%edi
mov    $0x54,%esi
xor    %eax,%eax
call   10a0 <UART_init@plt>
mov    %eax,%ebp
lea    0xc62(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   10b0 <printf@plt>
mov    $0x2,%edi
mov    $0x52,%esi
xor    %eax,%eax
call   10a0 <UART_init@plt>
lea    0xc4e(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   10b0 <printf@plt>
mov    %ebp,%edi
mov    $0x1c200,%esi
xor    %edx,%edx
mov    $0x1,%ecx
xor    %eax,%eax
call   1060 <UART_Baudrate_NonC@plt>
mov    $0x4,%edi
mov    $0x54,%esi
xor    %eax,%eax
call   10a0 <UART_init@plt>
mov    %eax,%ebx
lea    0xc23(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   10b0 <printf@plt>
mov    $0x4,%edi
mov    $0x52,%esi
xor    %eax,%eax
call   10a0 <UART_init@plt>
lea    0xc0f(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   10b0 <printf@plt>
mov    %ebx,0x14(%rsp)
mov    %ebx,%edi
mov    %r12,%rbx
mov    %r14d,%r12d
mov    $0x1c200,%esi
xor    %edx,%edx
mov    $0x1,%ecx
xor    %eax,%eax
call   1060 <UART_Baudrate_NonC@plt>
lea    0xc31(%rip),%rdi
call   1040 <puts@plt>
lea    0xbe1(%rip),%rsi
mov    %ebp,0x18(%rsp)
mov    %ebp,%edi
mov    $0x8,%edx
xor    %eax,%eax
call   1050 <write@plt>
mov    $0x1b,%edi
xor    %eax,%eax
call   10e0 <GetPinValue@plt>
test   %eax,%eax
je     1505 <main+0x2d5>
lea    0xbf1(%rip),%rsi
mov    0x14(%rsp),%edi
mov    $0x5,%edx
xor    %eax,%eax
call   1050 <write@plt>
lea    0xbec(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1b,%edi
xor    %eax,%eax
call   1120 <CloseGPin@plt>
mov    $0x17,%edi
xor    %eax,%eax
call   1090 <LEDOff@plt>
mov    $0x2f,%edi
xor    %eax,%eax
call   1090 <LEDOff@plt>
xor    %eax,%eax
add    $0x358,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xf0(%rsp),%rbp
xorps  %xmm0,%xmm0
movaps %xmm0,0x20(%rsp)
xor    %r14d,%r14d
jmp    1544 <main+0x314>
xor    %r14d,%r14d
mov    %rbx,%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1070 <Nullize@plt>
nopw   0x0(%rax,%rax,1)
mov    $0x1b,%edi
xor    %eax,%eax
call   10e0 <GetPinValue@plt>
test   %eax,%eax
jne    14aa <main+0x27a>
mov    %r12d,%edi
mov    %rbp,%rsi
mov    $0x64,%edx
xor    %eax,%eax
call   10d0 <read@plt>
mov    %eax,%r13d
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1130 <strcat@plt>
mov    %rbp,%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1070 <Nullize@plt>
cmp    $0xffffffff,%r13d
je     1530 <main+0x300>
cmp    $0x1f3,%r14d
ja     1530 <main+0x300>
lea    0x1(%r14),%r13d
xor    %ecx,%ecx
mov    %r14d,%esi
mov    %r14d,%eax
jmp    159b <main+0x36b>
xchg   %ax,%ax
lea    0x1(%rdx),%esi
cmp    $0x1f3,%edx
jae    15d2 <main+0x3a2>
mov    %esi,%edi
xor    %edx,%edx
cmpb   $0x24,0x160(%rsp,%rdi,1)
24
sete   %dl
cmove  %esi,%eax
cmove  %r15d,%ecx
add    %rdi,%rdx
cmp    $0x1,%ecx
jne    1590 <main+0x360>
movslq %edx,%rsi
cmpb   $0x2a,-0x3(%rsi,%rbx,1)
je     15e1 <main+0x3b1>
cmpb   $0x0,0x160(%rsp,%rdx,1)
jne    1590 <main+0x360>
jmp    1530 <main+0x300>
cmp    $0x3,%ecx
je     163f <main+0x40f>
cmp    $0x2,%ecx
je     15e4 <main+0x3b4>
jmp    1530 <main+0x300>
mov    %edx,%r13d
mov    %r13d,%ecx
sub    %eax,%ecx
jle    1530 <main+0x300>
cltq
neg    %rcx
lea    (%rsp,%rax,1),%rdx
add    $0x160,%rdx
mov    $0x1,%eax
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movzbl -0x1(%rdx,%rax,1),%ebx
mov    %bl,0x7f(%rsp,%rax,1)
cmpb   $0x2a,0x7d(%rsp,%rax,1)
je     1644 <main+0x414>
lea    (%rcx,%rax,1),%rsi
add    $0x1,%rsi
add    $0x1,%rax
cmp    $0x1,%rsi
jne    1610 <main+0x3e0>
lea    0x160(%rsp),%rbx
jmp    1530 <main+0x300>
mov    %r14d,%r13d
jmp    164e <main+0x41e>
mov    %eax,%eax
movb   $0x0,0x80(%rsp,%rax,1)
lea    0x40(%rsp),%rdi
lea    0xa17(%rip),%rsi
lea    0x80(%rsp),%rbx
mov    %rbx,%rdx
xor    %eax,%eax
call   1150 <sprintf@plt>
movq   $0x0,0x8(%rsp)
mov    %rbx,%rdi
lea    0x1c(%rsp),%rsi
lea    0x38(%rsp),%rdx
lea    0x8(%rsp),%rcx
lea    0x30(%rsp),%r8
xor    %eax,%eax
call   10f0 <AHRS_Parsing_RPY5@plt>
movsd  0x8(%rsp),%xmm0
movapd 0x20(%rsp),%xmm3
movapd %xmm3,%xmm1
cmpeqsd 0x964(%rip),%xmm1
movapd %xmm1,%xmm2
andnpd %xmm3,%xmm2
andpd  %xmm0,%xmm1
orpd   %xmm2,%xmm1
movapd %xmm0,%xmm2
mulsd  0x938(%rip),%xmm2
mulsd  0x938(%rip),%xmm1
addsd  %xmm2,%xmm1
movapd %xmm1,0x20(%rsp)
lea    0x997(%rip),%r14
mov    %r14,%rdi
mov    $0x2,%al
call   10b0 <printf@plt>
movsd  0x8(%rsp),%xmm0
lea    0x40(%rsp),%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
movaps 0x20(%rsp),%xmm1
mov    $0x2,%al
call   1150 <sprintf@plt>
mov    %rbx,%rdi
call   1080 <strlen@plt>
lea    0x1(%rax),%rdx
mov    0x18(%rsp),%edi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <write@plt>
mov    $0x64,%esi
lea    0x80(%rsp),%rdi
xor    %eax,%eax
call   1070 <Nullize@plt>
lea    0x160(%rsp),%rbx
mov    %rbx,%rdi
call   1080 <strlen@plt>
cmp    $0x12d,%rax
jae    151a <main+0x2ea>
mov    %r13d,%r14d
jmp    1530 <main+0x300>

LLVM IR (-O0):
@.str = [3 x i8] c"in\00"
@.str.1 = [7 x i8] c"Start\0A\00"
@.str.2 = [13 x i8] c"UART1T : %d\0A\00"
@.str.3 = [13 x i8] c"UART1R : %d\0A\00"
@.str.4 = [13 x i8] c"UART2T : %d\0A\00"
@.str.5 = [13 x i8] c"UART2R : %d\0A\00"
@.str.6 = [13 x i8] c"UART4T : %d\0A\00"
@.str.7 = [13 x i8] c"UART4R : %d\0A\00"
@.str.8 = [8 x i8] c"START!\0A\00"
@.str.9 = [7 x i8] c"1|%s|\0A\00"
@.str.10 = [42 x i8] c"theta : %10.3f,\09 Filtered theta : %10.3f\0A\00"
@.str.11 = [5 x i8] c"End\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32
%24 = alloca i32
%25 = alloca i32
%26 = alloca i32
%27 = alloca i32
%28 = alloca i32
%29 = alloca i32
%30 = alloca i32
%31 = alloca i32
%32 = alloca i32
%33 = alloca i32
%34 = alloca [100 x i8]
%35 = alloca [100 x i8]
%36 = alloca [100 x i8]
%37 = alloca [500 x i8]
%38 = alloca [500 x i8]
%39 = alloca [500 x i8]
%40 = alloca [100 x i8]
%41 = alloca [100 x i8]
%42 = alloca [100 x i8]
%43 = alloca [3 x i32]
%44 = alloca [3 x i32]
%45 = alloca [3 x i32]
%46 = alloca i32
%47 = alloca i32
%48 = alloca i32
%49 = alloca [50 x i8]
%50 = alloca [50 x i8]
%51 = alloca [50 x i8]
store i32 0, i32* %1
store i32 0, i32* %2
store double 0.000000e+00, double* %3
store double 0.000000e+00, double* %4
store double 0.000000e+00, double* %5
store double 0.000000e+00, double* %6
store double 0.000000e+00, double* %7
store double 1.000000e-01, double* %8
store double 0.000000e+00, double* %9
store double 1.000000e+02, double* %10
store double 0.000000e+00, double* %11
store double 1.000000e+02, double* %12
store double 0.000000e+00, double* %13
store double 0.000000e+00, double* %14
store double 1.000000e-03, double* %15
store i32 1, i32* %22
store i32 1, i32* %23
store i32 1, i32* %24
store i32 0, i32* %25
store i32 0, i32* %26
store i32 0, i32* %27
store i32 0, i32* %28
store i32 0, i32* %29
store i32 0, i32* %30
store i32 0, i32* %31
store i32 0, i32* %32
store i32 0, i32* %33
%52 = bitcast [100 x i8]* %34 to i8*
%53 = bitcast [100 x i8]* %35 to i8*
%54 = bitcast [100 x i8]* %36 to i8*
%55 = bitcast [500 x i8]* %37 to i8*
%56 = bitcast [500 x i8]* %38 to i8*
%57 = bitcast [500 x i8]* %39 to i8*
%58 = bitcast [100 x i8]* %40 to i8*
%59 = bitcast [100 x i8]* %41 to i8*
%60 = bitcast [100 x i8]* %42 to i8*
%61 = bitcast [3 x i32]* %43 to i8*
%62 = bitcast [3 x i32]* %44 to i8*
%63 = bitcast [3 x i32]* %45 to i8*
store i32 0, i32* %46
store i32 0, i32* %47
store i32 0, i32* %48
%64 = bitcast [50 x i8]* %49 to i8*
%65 = bitcast [50 x i8]* %50 to i8*
%66 = bitcast [50 x i8]* %51 to i8*
%67 = call i32 (...) @SettingCape()
%68 = call i32 (i32, ...) bitcast (i32 (...)* @LEDOn to i32 (i32, ...)*)(i32 23)
%69 = call i32 (i32, ...) bitcast (i32 (...)* @LEDOn to i32 (i32, ...)*)(i32 47)
%70 = call i32 (i32, ...) bitcast (i32 (...)* @InitPin to i32 (i32, ...)*)(i32 27)
%71 = call i32 (i32, i8*, ...) bitcast (i32 (...)* @SetPinDirt to i32 (i32, i8*, ...)*)(i32 27, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%73 = call i32 (i32, i32, ...) bitcast (i32 (...)* @UART_init to i32 (i32, i32, ...)*)(i32 1, i32 84)
store i32 %73, i32* %28
%74 = load i32, i32* %28
%75 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %74)
%76 = call i32 (i32, i32, ...) bitcast (i32 (...)* @UART_init to i32 (i32, i32, ...)*)(i32 1, i32 82)
store i32 %76, i32* %29
%77 = load i32, i32* %29
%78 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i32 %77)
%79 = load i32, i32* %28
%80 = call i32 (i32, i32, i32, i32, ...) bitcast (i32 (...)* @UART_Baudrate_NonC to i32 (i32, i32, i32, i32, ...)*)(i32 %79, i32 115200, i32 0, i32 1)
%81 = call i32 (i32, i32, ...) bitcast (i32 (...)* @UART_init to i32 (i32, i32, ...)*)(i32 2, i32 84)
store i32 %81, i32* %30
%82 = load i32, i32* %30
%83 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i32 %82)
%84 = call i32 (i32, i32, ...) bitcast (i32 (...)* @UART_init to i32 (i32, i32, ...)*)(i32 2, i32 82)
store i32 %84, i32* %31
%85 = load i32, i32* %31
%86 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i32 %85)
%87 = load i32, i32* %30
%88 = call i32 (i32, i32, i32, i32, ...) bitcast (i32 (...)* @UART_Baudrate_NonC to i32 (i32, i32, i32, i32, ...)*)(i32 %87, i32 115200, i32 0, i32 1)
%89 = call i32 (i32, i32, ...) bitcast (i32 (...)* @UART_init to i32 (i32, i32, ...)*)(i32 4, i32 84)
store i32 %89, i32* %32
%90 = load i32, i32* %32
%91 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0), i32 %90)
%92 = call i32 (i32, i32, ...) bitcast (i32 (...)* @UART_init to i32 (i32, i32, ...)*)(i32 4, i32 82)
store i32 %92, i32* %33
%93 = load i32, i32* %33
%94 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0), i32 %93)
%95 = load i32, i32* %32
%96 = call i32 (i32, i32, i32, i32, ...) bitcast (i32 (...)* @UART_Baudrate_NonC to i32 (i32, i32, i32, i32, ...)*)(i32 %95, i32 115200, i32 0, i32 1)
%97 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0))
%98 = load i32, i32* %30
%99 = call i32 (i32, i8*, i32, ...) bitcast (i32 (...)* @write to i32 (i32, i8*, i32, ...)*)(i32 %98, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0), i32 8)
br label %100
100: ; preds = %279, %0
%101 = call i32 (i32, ...) bitcast (i32 (...)* @GetPinValue to i32 (i32, ...)*)(i32 27)
%102 = icmp ne i32 %101, 0
%103 = xor i1 %102, true
br i1 %103, label %104, label %280
104: ; preds = %100
%105 = load i32, i32* %29
%106 = getelementptr inbounds [100 x i8], [100 x i8]* %34, i64 0, i64 0
%107 = call i32 (i32, i8*, i32, ...) bitcast (i32 (...)* @read to i32 (i32, i8*, i32, ...)*)(i32 %105, i8* %106, i32 100)
store i32 %107, i32* %25
%108 = getelementptr inbounds [500 x i8], [500 x i8]* %37, i64 0, i64 0
%109 = getelementptr inbounds [100 x i8], [100 x i8]* %34, i64 0, i64 0
%110 = call i8* @strcat(i8* %108, i8* %109)
%111 = getelementptr inbounds [100 x i8], [100 x i8]* %34, i64 0, i64 0
%112 = load i32, i32* %25
%113 = call i32 (i8*, i32, ...) bitcast (i32 (...)* @Nullize to i32 (i8*, i32, ...)*)(i8* %111, i32 %112)
%114 = load i32, i32* %25
%115 = icmp ne i32 %114, -1
br i1 %115, label %116, label %279
116: ; preds = %104
%117 = getelementptr inbounds [3 x i32], [3 x i32]* %43, i64 0, i64 2
%118 = load i32, i32* %117
store i32 %118, i32* %16
%119 = getelementptr inbounds [3 x i32], [3 x i32]* %43, i64 0, i64 2
%120 = load i32, i32* %119
%121 = getelementptr inbounds [3 x i32], [3 x i32]* %43, i64 0, i64 0
store i32 %120, i32* %121
%122 = getelementptr inbounds [3 x i32], [3 x i32]* %43, i64 0, i64 2
%123 = load i32, i32* %122
%124 = add nsw i32 %123, 1
%125 = getelementptr inbounds [3 x i32], [3 x i32]* %43, i64 0, i64 1
store i32 %124, i32* %125
store i32 0, i32* %46
br label %126
126: ; preds = %175, %116
%127 = load i32, i32* %16
%128 = sext i32 %127 to i64
%129 = icmp ult i64 %128, 500
br i1 %129, label %130, label %178
130: ; preds = %126
%131 = load i32, i32* %16
%132 = sext i32 %131 to i64
%133 = getelementptr inbounds [500 x i8], [500 x i8]* %37, i64 0, i64 %132
%134 = load i8, i8* %133
%135 = sext i8 %134 to i32
%136 = icmp eq i32 %135, 36
br i1 %136, label %137, label %142
137: ; preds = %130
%138 = load i32, i32* %16
%139 = getelementptr inbounds [3 x i32], [3 x i32]* %43, i64 0, i64 0
store i32 %138, i32* %139
store i32 1, i32* %46
%140 = load i32, i32* %16
%141 = add nsw i32 %140, 1
store i32 %141, i32* %16
br label %142
142: ; preds = %137, %130
%143 = load i32, i32* %46
%144 = icmp eq i32 %143, 1
br i1 %144, label %145, label %156
145: ; preds = %142
%146 = load i32, i32* %16
%147 = sub nsw i32 %146, 3
%148 = sext i32 %147 to i64
%149 = getelementptr inbounds [500 x i8], [500 x i8]* %37, i64 0, i64 %148
%150 = load i8, i8* %149
%151 = sext i8 %150 to i32
%152 = icmp eq i32 %151, 42
br i1 %152, label %153, label %156
153: ; preds = %145
%154 = load i32, i32* %16
%155 = getelementptr inbounds [3 x i32], [3 x i32]* %43, i64 0, i64 1
store i32 %154, i32* %155
store i32 2, i32* %46
br label %178
156: ; preds = %145, %142
%157 = load i32, i32* %16
%158 = sext i32 %157 to i64
%159 = getelementptr inbounds [500 x i8], [500 x i8]* %37, i64 0, i64 %158
%160 = load i8, i8* %159
%161 = sext i8 %160 to i32
%162 = icmp eq i32 %161, 0
br i1 %162, label %163, label %174
163: ; preds = %156
%164 = load i32, i32* %46
%165 = icmp eq i32 %164, 1
br i1 %165, label %166, label %174
166: ; preds = %163
%167 = getelementptr inbounds [3 x i32], [3 x i32]* %43, i64 0, i64 2
%168 = load i32, i32* %167
%169 = getelementptr inbounds [3 x i32], [3 x i32]* %43, i64 0, i64 0
store i32 %168, i32* %169
%170 = getelementptr inbounds [3 x i32], [3 x i32]* %43, i64 0, i64 2
%171 = load i32, i32* %170
%172 = add nsw i32 %171, 1
%173 = getelementptr inbounds [3 x i32], [3 x i32]* %43, i64 0, i64 1
store i32 %172, i32* %173
br label %178
174: ; preds = %163, %156
br label %175
175: ; preds = %174
%176 = load i32, i32* %16
%177 = add nsw i32 %176, 1
store i32 %177, i32* %16
br label %126
178: ; preds = %166, %153, %126
store i32 0, i32* %17
br label %179
179: ; preds = %219, %178
%180 = load i32, i32* %46
%181 = icmp eq i32 %180, 2
br i1 %181, label %182, label %190
182: ; preds = %179
%183 = load i32, i32* %17
%184 = getelementptr inbounds [3 x i32], [3 x i32]* %43, i64 0, i64 0
%185 = load i32, i32* %184
%186 = add nsw i32 %183, %185
%187 = getelementptr inbounds [3 x i32], [3 x i32]* %43, i64 0, i64 1
%188 = load i32, i32* %187
%189 = icmp slt i32 %186, %188
br label %190
190: ; preds = %182, %179
%191 = phi i1 [ false, %179 ], [ %189, %182 ]
br i1 %191, label %192, label %222
192: ; preds = %190
%193 = getelementptr inbounds [3 x i32], [3 x i32]* %43, i64 0, i64 0
%194 = load i32, i32* %193
%195 = load i32, i32* %17
%196 = add nsw i32 %194, %195
%197 = sext i32 %196 to i64
%198 = getelementptr inbounds [500 x i8], [500 x i8]* %37, i64 0, i64 %197
%199 = load i8, i8* %198
%200 = load i32, i32* %17
%201 = sext i32 %200 to i64
%202 = getelementptr inbounds [100 x i8], [100 x i8]* %40, i64 0, i64 %201
store i8 %199, i8* %202
%203 = load i32, i32* %17
%204 = sub nsw i32 %203, 2
%205 = sext i32 %204 to i64
%206 = getelementptr inbounds [100 x i8], [100 x i8]* %40, i64 0, i64 %205
%207 = load i8, i8* %206
%208 = sext i8 %207 to i32
%209 = icmp eq i32 %208, 42
br i1 %209, label %210, label %218
210: ; preds = %192
%211 = load i32, i32* %17
%212 = add nsw i32 %211, 1
%213 = sext i32 %212 to i64
%214 = getelementptr inbounds [100 x i8], [100 x i8]* %40, i64 0, i64 %213
store i8 0, i8* %214
store i32 3, i32* %46
%215 = getelementptr inbounds [3 x i32], [3 x i32]* %43, i64 0, i64 1
%216 = load i32, i32* %215
%217 = getelementptr inbounds [3 x i32], [3 x i32]* %43, i64 0, i64 2
store i32 %216, i32* %217
br label %222
218: ; preds = %192
br label %219
219: ; preds = %218
%220 = load i32, i32* %17
%221 = add nsw i32 %220, 1
store i32 %221, i32* %17
br label %179
222: ; preds = %210, %190
%223 = load i32, i32* %46
%224 = icmp eq i32 %223, 3
br i1 %224, label %225, label %278
225: ; preds = %222
%226 = getelementptr inbounds [50 x i8], [50 x i8]* %49, i64 0, i64 0
%227 = getelementptr inbounds [100 x i8], [100 x i8]* %40, i64 0, i64 0
%228 = call i32 (i8*, i8*, ...) @sprintf(i8* %226, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0), i8* %227)
%229 = load double, double* %6
store double %229, double* %4
%230 = getelementptr inbounds [100 x i8], [100 x i8]* %40, i64 0, i64 0
%231 = call i32 (i8*, i32*, double*, double*, double*, ...) bitcast (i32 (...)* @AHRS_Parsing_RPY5 to i32 (i8*, i32*, double*, double*, double*, ...)*)(i8* %230, i32* %2, double* %3, double* %4, double* %5)
%232 = load double, double* %7
%233 = fcmp oeq double %232, 0.000000e+00
br i1 %233, label %234, label %236
234: ; preds = %225
%235 = load double, double* %4
store double %235, double* %7
br label %236
236: ; preds = %234, %225
%237 = load double, double* %8
%238 = load double, double* %8
%239 = load double, double* %15
%240 = fadd double %238, %239
%241 = fdiv double %237, %240
%242 = load double, double* %7
%243 = load double, double* %15
%244 = load double, double* %8
%245 = load double, double* %15
%246 = fadd double %244, %245
%247 = fdiv double %243, %246
%248 = load double, double* %4
%249 = fmul double %247, %248
%250 = call double @llvm.fmuladd.f64(double %241, double %242, double %249)
store double %250, double* %7
%251 = load double, double* %4
%252 = load double, double* %7
%253 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.10, i64 0, i64 0), double %251, double %252)
%254 = getelementptr inbounds [50 x i8], [50 x i8]* %49, i64 0, i64 0
%255 = load double, double* %4
%256 = load double, double* %7
%257 = call i32 (i8*, i8*, ...) @sprintf(i8* %254, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.10, i64 0, i64 0), double %255, double %256)
%258 = load i32, i32* %30
%259 = getelementptr inbounds [50 x i8], [50 x i8]* %49, i64 0, i64 0
%260 = getelementptr inbounds [50 x i8], [50 x i8]* %49, i64 0, i64 0
%261 = call i64 @strlen(i8* %260)
%262 = add i64 %261, 1
%263 = call i32 (i32, i8*, i64, ...) bitcast (i32 (...)* @write to i32 (i32, i8*, i64, ...)*)(i32 %258, i8* %259, i64 %262)
%264 = getelementptr inbounds [100 x i8], [100 x i8]* %40, i64 0, i64 0
%265 = call i32 (i8*, i64, ...) bitcast (i32 (...)* @Nullize to i32 (i8*, i64, ...)*)(i8* %264, i64 100)
%266 = getelementptr inbounds [500 x i8], [500 x i8]* %37, i64 0, i64 0
%267 = call i64 @strlen(i8* %266)
%268 = icmp ugt i64 %267, 300
br i1 %268, label %269, label %277
269: ; preds = %236
%270 = getelementptr inbounds [500 x i8], [500 x i8]* %37, i64 0, i64 0
%271 = getelementptr inbounds [500 x i8], [500 x i8]* %37, i64 0, i64 0
%272 = call i64 @strlen(i8* %271)
%273 = call i32 (i8*, i64, ...) bitcast (i32 (...)* @Nullize to i32 (i8*, i64, ...)*)(i8* %270, i64 %272)
%274 = getelementptr inbounds [3 x i32], [3 x i32]* %43, i64 0, i64 0
store i32 0, i32* %274
%275 = getelementptr inbounds [3 x i32], [3 x i32]* %43, i64 0, i64 1
store i32 0, i32* %275
%276 = getelementptr inbounds [3 x i32], [3 x i32]* %43, i64 0, i64 2
store i32 0, i32* %276
br label %277
277: ; preds = %269, %236
br label %278
278: ; preds = %277, %222
br label %279
279: ; preds = %278, %104
br label %100
280: ; preds = %100
%281 = load i32, i32* %32
%282 = call i32 (i32, i8*, i32, ...) bitcast (i32 (...)* @write to i32 (i32, i8*, i32, ...)*)(i32 %281, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i64 0, i64 0), i32 5)
%283 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i64 0, i64 0))
%284 = call i32 (i32, ...) bitcast (i32 (...)* @CloseGPin to i32 (i32, ...)*)(i32 27)
%285 = call i32 (i32, ...) bitcast (i32 (...)* @LEDOff to i32 (i32, ...)*)(i32 23)
%286 = call i32 (i32, ...) bitcast (i32 (...)* @LEDOff to i32 (i32, ...)*)(i32 47)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"in\00"
@.str.2 = [13 x i8] c"UART1T : %d\0A\00"
@.str.3 = [13 x i8] c"UART1R : %d\0A\00"
@.str.4 = [13 x i8] c"UART2T : %d\0A\00"
@.str.5 = [13 x i8] c"UART2R : %d\0A\00"
@.str.6 = [13 x i8] c"UART4T : %d\0A\00"
@.str.7 = [13 x i8] c"UART4R : %d\0A\00"
@.str.8 = [8 x i8] c"START!\0A\00"
@.str.9 = [7 x i8] c"1|%s|\0A\00"
@.str.10 = [42 x i8] c"theta : %10.3f,\09 Filtered theta : %10.3f\0A\00"
@.str.11 = [5 x i8] c"End\0A\00"
@str = [6 x i8] c"Start\00"
@str.12 = [7 x i8] c"START!\00"
@str.13 = [4 x i8] c"End\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca [100 x i8]
%6 = alloca [500 x i8]
%7 = alloca [100 x i8]
%8 = alloca [50 x i8]
%9 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%10 = bitcast double* %2 to i8*
store double 0.000000e+00, double* %2
%11 = bitcast double* %3 to i8*
store double 0.000000e+00, double* %3
%12 = bitcast double* %4 to i8*
store double 0.000000e+00, double* %4
%13 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%14 = getelementptr inbounds [500 x i8], [500 x i8]* %6, i64 0, i64 0
%15 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%16 = getelementptr inbounds [50 x i8], [50 x i8]* %8, i64 0, i64 0
%17 = tail call i32 (...) @SettingCape()
%18 = tail call i32 (i32, ...) bitcast (i32 (...)* @LEDOn to i32 (i32, ...)*)(i32 23)
%19 = tail call i32 (i32, ...) bitcast (i32 (...)* @LEDOn to i32 (i32, ...)*)(i32 47)
%20 = tail call i32 (i32, ...) bitcast (i32 (...)* @InitPin to i32 (i32, ...)*)(i32 27)
%21 = tail call i32 (i32, i8*, ...) bitcast (i32 (...)* @SetPinDirt to i32 (i32, i8*, ...)*)(i32 27, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%22 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
%23 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @UART_init to i32 (i32, i32, ...)*)(i32 1, i32 84)
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %23)
%25 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @UART_init to i32 (i32, i32, ...)*)(i32 1, i32 82)
%26 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i32 %25)
%27 = tail call i32 (i32, i32, i32, i32, ...) bitcast (i32 (...)* @UART_Baudrate_NonC to i32 (i32, i32, i32, i32, ...)*)(i32 %23, i32 115200, i32 0, i32 1)
%28 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @UART_init to i32 (i32, i32, ...)*)(i32 2, i32 84)
%29 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i32 %28)
%30 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @UART_init to i32 (i32, i32, ...)*)(i32 2, i32 82)
%31 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i32 %30)
%32 = tail call i32 (i32, i32, i32, i32, ...) bitcast (i32 (...)* @UART_Baudrate_NonC to i32 (i32, i32, i32, i32, ...)*)(i32 %28, i32 115200, i32 0, i32 1)
%33 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @UART_init to i32 (i32, i32, ...)*)(i32 4, i32 84)
%34 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0), i32 %33)
%35 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @UART_init to i32 (i32, i32, ...)*)(i32 4, i32 82)
%36 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0), i32 %35)
%37 = tail call i32 (i32, i32, i32, i32, ...) bitcast (i32 (...)* @UART_Baudrate_NonC to i32 (i32, i32, i32, i32, ...)*)(i32 %33, i32 115200, i32 0, i32 1)
%38 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.12, i64 0, i64 0))
%39 = tail call i32 (i32, i8*, i32, ...) bitcast (i32 (...)* @write to i32 (i32, i8*, i32, ...)*)(i32 %28, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0), i32 8)
%40 = call i32 (i32, ...) bitcast (i32 (...)* @GetPinValue to i32 (i32, ...)*)(i32 27)
%41 = icmp eq i32 %40, 0
br i1 %41, label %42, label %129
42: ; preds = %0, %124
%43 = phi double [ %126, %124 ], [ 0.000000e+00, %0 ]
%44 = phi i32 [ %125, %124 ], [ 0, %0 ]
%45 = call i32 (i32, i8*, i32, ...) bitcast (i32 (...)* @read to i32 (i32, i8*, i32, ...)*)(i32 %25, i8* %13, i32 100)
%46 = call i8* @strcat(i8* %14, i8* %13)
%47 = call i32 (i8*, i32, ...) bitcast (i32 (...)* @Nullize to i32 (i8*, i32, ...)*)(i8* %13, i32 %45)
%48 = icmp eq i32 %45, -1
br i1 %48, label %124, label %49
49: ; preds = %42
%50 = add nsw i32 %44, 1
%51 = icmp ult i32 %44, 500
br i1 %51, label %52, label %124
52: ; preds = %49, %76
%53 = phi i32 [ %77, %76 ], [ %44, %49 ]
%54 = phi i32 [ %61, %76 ], [ 0, %49 ]
%55 = phi i32 [ %60, %76 ], [ %44, %49 ]
%56 = zext i32 %53 to i64
%57 = getelementptr inbounds [500 x i8], [500 x i8]* %6, i64 0, i64 %56
%58 = load i8, i8* %57
%59 = icmp eq i8 %58, 36
%60 = select i1 %59, i32 %53, i32 %55
%61 = select i1 %59, i32 1, i32 %54
%62 = zext i1 %59 to i32
%63 = add nuw nsw i32 %53, %62
%64 = icmp eq i32 %61, 1
br i1 %64, label %65, label %76
65: ; preds = %52
%66 = add nsw i32 %63, -3
%67 = sext i32 %66 to i64
%68 = getelementptr inbounds [500 x i8], [500 x i8]* %6, i64 0, i64 %67
%69 = load i8, i8* %68
%70 = icmp eq i8 %69, 42
br i1 %70, label %80, label %71
71: ; preds = %65
%72 = zext i32 %63 to i64
%73 = getelementptr inbounds [500 x i8], [500 x i8]* %6, i64 0, i64 %72
%74 = load i8, i8* %73
%75 = icmp eq i8 %74, 0
br i1 %75, label %124, label %76
76: ; preds = %52, %71
%77 = add nuw nsw i32 %63, 1
%78 = icmp ult i32 %63, 499
br i1 %78, label %52, label %79
79: ; preds = %76
switch i32 %61, label %124 [
i32 3, label %104
i32 2, label %80
]
80: ; preds = %65, %79
%81 = phi i32 [ %50, %79 ], [ %63, %65 ]
%82 = icmp sgt i32 %81, %60
br i1 %82, label %83, label %124
83: ; preds = %80
%84 = sext i32 %60 to i64
%85 = sub i32 %81, %60
%86 = zext i32 %85 to i64
br label %87
87: ; preds = %83, %101
%88 = phi i64 [ 0, %83 ], [ %97, %101 ]
%89 = phi i64 [ %84, %83 ], [ %102, %101 ]
%90 = getelementptr inbounds [500 x i8], [500 x i8]* %6, i64 0, i64 %89
%91 = load i8, i8* %90
%92 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 %88
store i8 %91, i8* %92
%93 = add nsw i64 %88, -2
%94 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 %93
%95 = load i8, i8* %94
%96 = icmp eq i8 %95, 42
%97 = add nuw i64 %88, 1
br i1 %96, label %98, label %101
98: ; preds = %87
%99 = and i64 %97, 4294967295
%100 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 %99
store i8 0, i8* %100
br label %104
101: ; preds = %87
%102 = add nsw i64 %89, 1
%103 = icmp eq i64 %97, %86
br i1 %103, label %124, label %87
104: ; preds = %79, %98
%105 = phi i32 [ %81, %98 ], [ %44, %79 ]
%106 = call i32 (i8*, i8*, ...) @sprintf(i8* %16, i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0), i8* %15)
store double 0.000000e+00, double* %3
%107 = call i32 (i8*, i32*, double*, double*, double*, ...) bitcast (i32 (...)* @AHRS_Parsing_RPY5 to i32 (i8*, i32*, double*, double*, double*, ...)*)(i8* %15, i32* %1, double* %2, double* %3, double* %4)
%108 = fcmp oeq double %43, 0.000000e+00
%109 = load double, double* %3
%110 = select i1 %108, double %109, double %43
%111 = fmul double %109, 0x3F8446F86562D9FB
%112 = call double @llvm.fmuladd.f64(double %110, double 0x3FEFAEE41E6A7498, double %111)
%113 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.10, i64 0, i64 0), double %109, double %112)
%114 = load double, double* %3
%115 = call i32 (i8*, i8*, ...) @sprintf(i8* %16, i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.10, i64 0, i64 0), double %114, double %112)
%116 = call i64 @strlen(i8* %16)
%117 = add i64 %116, 1
%118 = call i32 (i32, i8*, i64, ...) bitcast (i32 (...)* @write to i32 (i32, i8*, i64, ...)*)(i32 %28, i8* %16, i64 %117)
%119 = call i32 (i8*, i64, ...) bitcast (i32 (...)* @Nullize to i32 (i8*, i64, ...)*)(i8* %15, i64 100)
%120 = call i64 @strlen(i8* %14)
%121 = icmp ugt i64 %120, 300
br i1 %121, label %122, label %124
122: ; preds = %104
%123 = call i32 (i8*, i64, ...) bitcast (i32 (...)* @Nullize to i32 (i8*, i64, ...)*)(i8* %14, i64 %120)
br label %124
124: ; preds = %71, %101, %49, %79, %80, %122, %104, %42
%125 = phi i32 [ 0, %122 ], [ %105, %104 ], [ %44, %42 ], [ %44, %80 ], [ %44, %79 ], [ %44, %49 ], [ %44, %101 ], [ %44, %71 ]
%126 = phi double [ %112, %122 ], [ %112, %104 ], [ %43, %42 ], [ %43, %80 ], [ %43, %79 ], [ %43, %49 ], [ %43, %101 ], [ %43, %71 ]
%127 = call i32 (i32, ...) bitcast (i32 (...)* @GetPinValue to i32 (i32, ...)*)(i32 27)
%128 = icmp eq i32 %127, 0
br i1 %128, label %42, label %129
129: ; preds = %124, %0
%130 = call i32 (i32, i8*, i32, ...) bitcast (i32 (...)* @write to i32 (i32, i8*, i32, ...)*)(i32 %33, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i64 0, i64 0), i32 5)
%131 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str.13, i64 0, i64 0))
%132 = call i32 (i32, ...) bitcast (i32 (...)* @CloseGPin to i32 (i32, ...)*)(i32 27)
%133 = call i32 (i32, ...) bitcast (i32 (...)* @LEDOff to i32 (i32, ...)*)(i32 23)
%134 = call i32 (i32, ...) bitcast (i32 (...)* @LEDOff to i32 (i32, ...)*)(i32 47)
ret i32 0
}