#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*/ uint8_t;
typedef int uint64_t;
typedef int /*<<< orphan*/ uint16_t;
typedef scalar_t__ int16_t;

/* Variables and functions */
int demod_adsb_frame(int /*<<< orphan*/ *, int /*<<< orphan*/ *, int *);
int demod_uplink_frame(int /*<<< orphan*/ *, int /*<<< orphan*/ *, int *);
int /*<<< orphan*/ handle_adsb_frame(int, int /*<<< orphan*/ *, int);
int /*<<< orphan*/ handle_uplink_frame(int, int /*<<< orphan*/ *, int);
scalar_t__ phi_difference(int /*<<< orphan*/, int /*<<< orphan*/);
scalar_t__ sync_word_fuzzy_compare(int, int);
int process_buffer(uint16_t *phi, int len, uint64_t offset) {
  uint64_t sync0 = 0, sync1 = 0;
  int lenbits;
  int bit;
  uint8_t demod_buf_a[(((6) * ((576) + 160)) / 8)];
  uint8_t demod_buf_b[(((6) * ((576) + 160)) / 8)];
  lenbits = len / 2 - ((36) + ((6) * ((576) + 160)));
  for (bit = 0; bit < lenbits; ++bit) {
    int16_t dphi0 = phi_difference(phi[bit * 2], phi[bit * 2 + 1]);
    int16_t dphi1 = phi_difference(phi[bit * 2 + 1], phi[bit * 2 + 2]);
    sync0 =
        ((sync0 << 1) | (dphi0 > 0 ? 1 : 0)) & ((((uint64_t)1) << (36)) - 1);
    sync1 =
        ((sync1 << 1) | (dphi1 > 0 ? 1 : 0)) & ((((uint64_t)1) << (36)) - 1);
    if (bit < (36))
      continue;
    if (sync_word_fuzzy_compare(sync0, 0xEACDDA4E2UL) ||
        sync_word_fuzzy_compare(sync1, 0xEACDDA4E2UL)) {
      int startbit = (bit - (36) + 1);
      int shift = (sync_word_fuzzy_compare(sync0, 0xEACDDA4E2UL) ? 0 : 1);
      int index = startbit * 2 + shift;
      int skip_0, skip_1;
      int rs_0 = -1, rs_1 = -1;
      skip_0 = demod_adsb_frame(phi + index, demod_buf_a, &rs_0);
      skip_1 = demod_adsb_frame(phi + index + 1, demod_buf_b, &rs_1);
      if (skip_0 && rs_0 <= rs_1) {
        handle_adsb_frame(offset + index, demod_buf_a, rs_0);
        bit = startbit + skip_0;
        continue;
      } else if (skip_1 && rs_1 <= rs_0) {
        handle_adsb_frame(offset + index + 1, demod_buf_b, rs_1);
        bit = startbit + skip_1;
        continue;
      } else {
      }
    } else if (sync_word_fuzzy_compare(sync0, 0x153225B1DUL) ||
               sync_word_fuzzy_compare(sync1, 0x153225B1DUL)) {
      int startbit = (bit - (36) + 1);
      int shift = (sync_word_fuzzy_compare(sync0, 0x153225B1DUL) ? 0 : 1);
      int index = startbit * 2 + shift;
      int skip_0, skip_1;
      int rs_0 = -1, rs_1 = -1;
      skip_0 = demod_uplink_frame(phi + index, demod_buf_a, &rs_0);
      skip_1 = demod_uplink_frame(phi + index + 1, demod_buf_b, &rs_1);
      if (skip_0 && rs_0 <= rs_1) {
        handle_uplink_frame(offset + index, demod_buf_a, rs_0);
        bit = startbit + skip_0;
        continue;
      } else if (skip_1 && rs_1 <= rs_0) {
        handle_uplink_frame(offset + index + 1, demod_buf_b, rs_1);
        bit = startbit + skip_1;
        continue;
      } else {
      }
    }
  }
  return (bit - (36)) * 2;
}


x86 assembly (clang, -O0):
<process_buffer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x11b0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
sub    $0x1164,%eax
mov    %eax,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1599 <process_buffer+0x439>
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%ecx
shl    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%edi
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%esi
call   1070 <phi_difference@plt>
mov    %rax,-0x1168(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%edi
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%ecx
shl    $0x1,%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%esi
call   1070 <phi_difference@plt>
mov    %rax,-0x1170(%rbp)
mov    -0x14(%rbp),%eax
shl    $0x1,%eax
mov    -0x1168(%rbp),%rsi
xor    %ecx,%ecx
mov    $0x1,%edx
cmp    $0x0,%rsi
cmovg  %edx,%ecx
or     %ecx,%eax
and    %ecx,%eax
mov    %eax,-0x14(%rbp)
mov    -0x18(%rbp),%eax
shl    $0x1,%eax
mov    -0x1170(%rbp),%rsi
xor    %ecx,%ecx
mov    $0x1,%edx
cmp    $0x0,%rsi
cmovg  %edx,%ecx
or     %ecx,%eax
and    %ecx,%eax
mov    %eax,-0x18(%rbp)
cmpl   $0x24,-0x20(%rbp)
jge    125d <process_buffer+0xfd>
jmp    158b <process_buffer+0x42b>
mov    -0x14(%rbp),%edi
mov    $0xacdda4e2,%esi
call   1060 <sync_word_fuzzy_compare@plt>
cmp    $0x0,%rax
jne    128b <process_buffer+0x12b>
mov    -0x18(%rbp),%edi
mov    $0xacdda4e2,%esi
call   1060 <sync_word_fuzzy_compare@plt>
cmp    $0x0,%rax
je     13ef <process_buffer+0x28f>
mov    -0x20(%rbp),%eax
sub    $0x24,%eax
add    $0x1,%eax
mov    %eax,-0x1174(%rbp)
mov    -0x14(%rbp),%edi
mov    $0xacdda4e2,%esi
call   1060 <sync_word_fuzzy_compare@plt>
mov    %rax,%rdx
mov    $0x1,%eax
xor    %ecx,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
mov    %eax,-0x1178(%rbp)
mov    -0x1174(%rbp),%eax
shl    $0x1,%eax
add    -0x1178(%rbp),%eax
mov    %eax,-0x117c(%rbp)
movl   $0xffffffff,-0x1188(%rbp)
ff ff ff
movl   $0xffffffff,-0x118c(%rbp)
ff ff ff
mov    -0x8(%rbp),%rdi
movslq -0x117c(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
lea    -0x8c0(%rbp),%rsi
lea    -0x1188(%rbp),%rdx
call   1040 <demod_adsb_frame@plt>
mov    %eax,-0x1180(%rbp)
mov    -0x8(%rbp),%rdi
movslq -0x117c(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
add    $0x4,%rdi
lea    -0x1160(%rbp),%rsi
lea    -0x118c(%rbp),%rdx
call   1040 <demod_adsb_frame@plt>
mov    %eax,-0x1184(%rbp)
cmpl   $0x0,-0x1180(%rbp)
je     138f <process_buffer+0x22f>
mov    -0x1188(%rbp),%eax
cmp    -0x118c(%rbp),%eax
jg     138f <process_buffer+0x22f>
mov    -0x10(%rbp),%edi
add    -0x117c(%rbp),%edi
lea    -0x8c0(%rbp),%rsi
mov    -0x1188(%rbp),%edx
call   1080 <handle_adsb_frame@plt>
mov    -0x1174(%rbp),%eax
add    -0x1180(%rbp),%eax
mov    %eax,-0x20(%rbp)
jmp    158b <process_buffer+0x42b>
cmpl   $0x0,-0x1184(%rbp)
je     13e0 <process_buffer+0x280>
mov    -0x118c(%rbp),%eax
cmp    -0x1188(%rbp),%eax
jg     13e0 <process_buffer+0x280>
mov    -0x10(%rbp),%edi
add    -0x117c(%rbp),%edi
add    $0x1,%edi
lea    -0x1160(%rbp),%rsi
mov    -0x118c(%rbp),%edx
call   1080 <handle_adsb_frame@plt>
mov    -0x1174(%rbp),%eax
add    -0x1184(%rbp),%eax
mov    %eax,-0x20(%rbp)
jmp    158b <process_buffer+0x42b>
jmp    13e5 <process_buffer+0x285>
jmp    13ea <process_buffer+0x28a>
jmp    1586 <process_buffer+0x426>
mov    -0x14(%rbp),%edi
mov    $0x53225b1d,%esi
call   1060 <sync_word_fuzzy_compare@plt>
cmp    $0x0,%rax
jne    141d <process_buffer+0x2bd>
mov    -0x18(%rbp),%edi
mov    $0x53225b1d,%esi
call   1060 <sync_word_fuzzy_compare@plt>
cmp    $0x0,%rax
je     1581 <process_buffer+0x421>
mov    -0x20(%rbp),%eax
sub    $0x24,%eax
add    $0x1,%eax
mov    %eax,-0x1190(%rbp)
mov    -0x14(%rbp),%edi
mov    $0x53225b1d,%esi
call   1060 <sync_word_fuzzy_compare@plt>
mov    %rax,%rdx
mov    $0x1,%eax
xor    %ecx,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
mov    %eax,-0x1194(%rbp)
mov    -0x1190(%rbp),%eax
shl    $0x1,%eax
add    -0x1194(%rbp),%eax
mov    %eax,-0x1198(%rbp)
movl   $0xffffffff,-0x11a4(%rbp)
ff ff ff
movl   $0xffffffff,-0x11a8(%rbp)
ff ff ff
mov    -0x8(%rbp),%rdi
movslq -0x1198(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
lea    -0x8c0(%rbp),%rsi
lea    -0x11a4(%rbp),%rdx
call   1050 <demod_uplink_frame@plt>
mov    %eax,-0x119c(%rbp)
mov    -0x8(%rbp),%rdi
movslq -0x1198(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
add    $0x4,%rdi
lea    -0x1160(%rbp),%rsi
lea    -0x11a8(%rbp),%rdx
call   1050 <demod_uplink_frame@plt>
mov    %eax,-0x11a0(%rbp)
cmpl   $0x0,-0x119c(%rbp)
je     1521 <process_buffer+0x3c1>
mov    -0x11a4(%rbp),%eax
cmp    -0x11a8(%rbp),%eax
jg     1521 <process_buffer+0x3c1>
mov    -0x10(%rbp),%edi
add    -0x1198(%rbp),%edi
lea    -0x8c0(%rbp),%rsi
mov    -0x11a4(%rbp),%edx
call   1030 <handle_uplink_frame@plt>
mov    -0x1190(%rbp),%eax
add    -0x119c(%rbp),%eax
mov    %eax,-0x20(%rbp)
jmp    158b <process_buffer+0x42b>
cmpl   $0x0,-0x11a0(%rbp)
je     1572 <process_buffer+0x412>
mov    -0x11a8(%rbp),%eax
cmp    -0x11a4(%rbp),%eax
jg     1572 <process_buffer+0x412>
mov    -0x10(%rbp),%edi
add    -0x1198(%rbp),%edi
add    $0x1,%edi
lea    -0x1160(%rbp),%rsi
mov    -0x11a8(%rbp),%edx
call   1030 <handle_uplink_frame@plt>
mov    -0x1190(%rbp),%eax
add    -0x11a0(%rbp),%eax
mov    %eax,-0x20(%rbp)
jmp    158b <process_buffer+0x42b>
jmp    1577 <process_buffer+0x417>
jmp    157c <process_buffer+0x41c>
jmp    1581 <process_buffer+0x421>
jmp    1586 <process_buffer+0x426>
jmp    158b <process_buffer+0x42b>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    119d <process_buffer+0x3d>
mov    -0x20(%rbp),%eax
sub    $0x24,%eax
shl    $0x1,%eax
add    $0x11b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<process_buffer>:
mov    $0xffffffb8,%eax
cmp    $0x22ca,%esi
jl     13ec <process_buffer+0x28c>
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1168,%rsp
mov    %rdi,%r13
mov    %esi,%r12d
shr    $0x1f,%r12d
add    %esi,%r12d
sar    %r12d
add    $0xffffee9c,%r12d
mov    %rdx,%rax
mov    %rdx,0x18(%rsp)
lea    0x1(%rdx),%eax
mov    %eax,0x14(%rsp)
xor    %r15d,%r15d
mov    %r12d,0x10(%rsp)
jmp    11df <process_buffer+0x7f>
add    0x18(%rsp),%r14d
mov    %r14d,%edi
lea    0x8c0(%rsp),%rsi
call   1080 <handle_adsb_frame@plt>
add    %ebx,%r12d
mov    %r12d,%r15d
mov    0x10(%rsp),%r12d
add    $0x1,%r15d
cmp    %r12d,%r15d
jge    13d4 <process_buffer+0x274>
lea    (%r15,%r15,1),%eax
movslq %eax,%rbp
mov    0x0(%r13,%rbp,4),%edi
lea    (%r15,%r15,1),%eax
add    $0x1,%eax
movslq %eax,%rbx
mov    0x0(%r13,%rbx,4),%esi
call   1070 <phi_difference@plt>
mov    0x0(%r13,%rbx,4),%edi
mov    0x8(%r13,%rbp,4),%esi
call   1070 <phi_difference@plt>
cmp    $0x24,%r15d
jl     11d2 <process_buffer+0x72>
mov    $0xacdda4e2,%esi
call   1060 <sync_word_fuzzy_compare@plt>
test   %rax,%rax
jne    1236 <process_buffer+0xd6>
mov    $0xacdda4e2,%esi
call   1060 <sync_word_fuzzy_compare@plt>
test   %rax,%rax
je     12ea <process_buffer+0x18a>
lea    -0x23(%r15),%ebx
mov    $0xacdda4e2,%esi
call   1060 <sync_word_fuzzy_compare@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
lea    (%rcx,%r15,2),%r14d
add    $0xffffffba,%r14d
movl   $0xffffffff,0xc(%rsp)
ff
movl   $0xffffffff,0x8(%rsp)
ff
lea    0x0(,%r14,4),%rdi
add    %r13,%rdi
lea    0x8c0(%rsp),%rsi
lea    0xc(%rsp),%rdx
call   1040 <demod_adsb_frame@plt>
mov    %eax,%r12d
lea    0x4(,%r14,4),%rdi
add    %r13,%rdi
lea    0x20(%rsp),%rsi
lea    0x8(%rsp),%rdx
call   1040 <demod_adsb_frame@plt>
mov    %eax,%ebp
test   %r12d,%r12d
je     12b3 <process_buffer+0x153>
mov    0xc(%rsp),%edx
cmp    0x8(%rsp),%edx
jle    11b2 <process_buffer+0x52>
test   %ebp,%ebp
je     11cd <process_buffer+0x6d>
mov    0x8(%rsp),%edx
cmp    0xc(%rsp),%edx
mov    0x10(%rsp),%r12d
jg     11d2 <process_buffer+0x72>
add    0x14(%rsp),%r14d
mov    %r14d,%edi
lea    0x20(%rsp),%rsi
call   1080 <handle_adsb_frame@plt>
add    %ebx,%ebp
mov    %ebp,%r15d
jmp    11d2 <process_buffer+0x72>
mov    $0x53225b1d,%esi
call   1060 <sync_word_fuzzy_compare@plt>
test   %rax,%rax
jne    130c <process_buffer+0x1ac>
mov    $0x53225b1d,%esi
call   1060 <sync_word_fuzzy_compare@plt>
test   %rax,%rax
je     11d2 <process_buffer+0x72>
lea    -0x23(%r15),%ebx
mov    $0x53225b1d,%esi
call   1060 <sync_word_fuzzy_compare@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
lea    (%rcx,%r15,2),%ebp
add    $0xffffffba,%ebp
movl   $0xffffffff,0xc(%rsp)
ff
movl   $0xffffffff,0x8(%rsp)
ff
lea    0x0(,%rbp,4),%rdi
add    %r13,%rdi
lea    0x8c0(%rsp),%rsi
lea    0xc(%rsp),%rdx
call   1050 <demod_uplink_frame@plt>
mov    %eax,%r12d
lea    0x4(,%rbp,4),%rdi
add    %r13,%rdi
lea    0x20(%rsp),%rsi
lea    0x8(%rsp),%rdx
call   1050 <demod_uplink_frame@plt>
mov    %eax,%r14d
test   %r12d,%r12d
je     1385 <process_buffer+0x225>
mov    0xc(%rsp),%edx
cmp    0x8(%rsp),%edx
jle    13bc <process_buffer+0x25c>
test   %r14d,%r14d
je     11cd <process_buffer+0x6d>
mov    0x8(%rsp),%edx
cmp    0xc(%rsp),%edx
mov    0x10(%rsp),%r12d
jg     11d2 <process_buffer+0x72>
add    0x14(%rsp),%ebp
mov    %ebp,%edi
lea    0x20(%rsp),%rsi
call   1030 <handle_uplink_frame@plt>
add    %ebx,%r14d
mov    %r14d,%r15d
jmp    11d2 <process_buffer+0x72>
add    0x18(%rsp),%ebp
mov    %ebp,%edi
lea    0x8c0(%rsp),%rsi
call   1030 <handle_uplink_frame@plt>
jmp    11c7 <process_buffer+0x67>
lea    (%r15,%r15,1),%eax
add    $0xffffffb8,%eax
add    $0x1168,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @process_buffer(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca [552 x i32]
%12 = alloca [552 x i32]
%13 = alloca i64
%14 = alloca i64
%15 = alloca i32
%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
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
store i32 0, i32* %7
store i32 0, i32* %8
%29 = load i32, i32* %5
%30 = sdiv i32 %29, 2
%31 = sub nsw i32 %30, 4452
store i32 %31, i32* %9
store i32 0, i32* %10
br label %32
32: ; preds = %229, %3
%33 = load i32, i32* %10
%34 = load i32, i32* %9
%35 = icmp slt i32 %33, %34
br i1 %35, label %36, label %232
36: ; preds = %32
%37 = load i32*, i32** %4
%38 = load i32, i32* %10
%39 = mul nsw i32 %38, 2
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds i32, i32* %37, i64 %40
%42 = load i32, i32* %41
%43 = load i32*, i32** %4
%44 = load i32, i32* %10
%45 = mul nsw i32 %44, 2
%46 = add nsw i32 %45, 1
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds i32, i32* %43, i64 %47
%49 = load i32, i32* %48
%50 = call i64 @phi_difference(i32 %42, i32 %49)
store i64 %50, i64* %13
%51 = load i32*, i32** %4
%52 = load i32, i32* %10
%53 = mul nsw i32 %52, 2
%54 = add nsw i32 %53, 1
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds i32, i32* %51, i64 %55
%57 = load i32, i32* %56
%58 = load i32*, i32** %4
%59 = load i32, i32* %10
%60 = mul nsw i32 %59, 2
%61 = add nsw i32 %60, 2
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds i32, i32* %58, i64 %62
%64 = load i32, i32* %63
%65 = call i64 @phi_difference(i32 %57, i32 %64)
store i64 %65, i64* %14
%66 = load i32, i32* %7
%67 = shl i32 %66, 1
%68 = load i64, i64* %13
%69 = icmp sgt i64 %68, 0
%70 = zext i1 %69 to i64
%71 = select i1 %69, i32 1, i32 0
%72 = or i32 %67, %71
%73 = and i32 %72, poison
store i32 %73, i32* %7
%74 = load i32, i32* %8
%75 = shl i32 %74, 1
%76 = load i64, i64* %14
%77 = icmp sgt i64 %76, 0
%78 = zext i1 %77 to i64
%79 = select i1 %77, i32 1, i32 0
%80 = or i32 %75, %79
%81 = and i32 %80, poison
store i32 %81, i32* %8
%82 = load i32, i32* %10
%83 = icmp slt i32 %82, 36
br i1 %83, label %84, label %85
84: ; preds = %36
br label %229
85: ; preds = %36
%86 = load i32, i32* %7
%87 = call i64 @sync_word_fuzzy_compare(i32 %86, i32 -1394760478)
%88 = icmp ne i64 %87, 0
br i1 %88, label %93, label %89
89: ; preds = %85
%90 = load i32, i32* %8
%91 = call i64 @sync_word_fuzzy_compare(i32 %90, i32 -1394760478)
%92 = icmp ne i64 %91, 0
br i1 %92, label %93, label %156
93: ; preds = %89, %85
%94 = load i32, i32* %10
%95 = sub nsw i32 %94, 36
%96 = add nsw i32 %95, 1
store i32 %96, i32* %15
%97 = load i32, i32* %7
%98 = call i64 @sync_word_fuzzy_compare(i32 %97, i32 -1394760478)
%99 = icmp ne i64 %98, 0
%100 = zext i1 %99 to i64
%101 = select i1 %99, i32 0, i32 1
store i32 %101, i32* %16
%102 = load i32, i32* %15
%103 = mul nsw i32 %102, 2
%104 = load i32, i32* %16
%105 = add nsw i32 %103, %104
store i32 %105, i32* %17
store i32 -1, i32* %20
store i32 -1, i32* %21
%106 = load i32*, i32** %4
%107 = load i32, i32* %17
%108 = sext i32 %107 to i64
%109 = getelementptr inbounds i32, i32* %106, i64 %108
%110 = getelementptr inbounds [552 x i32], [552 x i32]* %11, i64 0, i64 0
%111 = call i32 @demod_adsb_frame(i32* %109, i32* %110, i32* %20)
store i32 %111, i32* %18
%112 = load i32*, i32** %4
%113 = load i32, i32* %17
%114 = sext i32 %113 to i64
%115 = getelementptr inbounds i32, i32* %112, i64 %114
%116 = getelementptr inbounds i32, i32* %115, i64 1
%117 = getelementptr inbounds [552 x i32], [552 x i32]* %12, i64 0, i64 0
%118 = call i32 @demod_adsb_frame(i32* %116, i32* %117, i32* %21)
store i32 %118, i32* %19
%119 = load i32, i32* %18
%120 = icmp ne i32 %119, 0
br i1 %120, label %121, label %135
121: ; preds = %93
%122 = load i32, i32* %20
%123 = load i32, i32* %21
%124 = icmp sle i32 %122, %123
br i1 %124, label %125, label %135
125: ; preds = %121
%126 = load i32, i32* %6
%127 = load i32, i32* %17
%128 = add nsw i32 %126, %127
%129 = getelementptr inbounds [552 x i32], [552 x i32]* %11, i64 0, i64 0
%130 = load i32, i32* %20
%131 = call i32 @handle_adsb_frame(i32 %128, i32* %129, i32 %130)
%132 = load i32, i32* %15
%133 = load i32, i32* %18
%134 = add nsw i32 %132, %133
store i32 %134, i32* %10
br label %229
135: ; preds = %121, %93
%136 = load i32, i32* %19
%137 = icmp ne i32 %136, 0
br i1 %137, label %138, label %153
138: ; preds = %135
%139 = load i32, i32* %21
%140 = load i32, i32* %20
%141 = icmp sle i32 %139, %140
br i1 %141, label %142, label %153
142: ; preds = %138
%143 = load i32, i32* %6
%144 = load i32, i32* %17
%145 = add nsw i32 %143, %144
%146 = add nsw i32 %145, 1
%147 = getelementptr inbounds [552 x i32], [552 x i32]* %12, i64 0, i64 0
%148 = load i32, i32* %21
%149 = call i32 @handle_adsb_frame(i32 %146, i32* %147, i32 %148)
%150 = load i32, i32* %15
%151 = load i32, i32* %19
%152 = add nsw i32 %150, %151
store i32 %152, i32* %10
br label %229
153: ; preds = %138, %135
br label %154
154: ; preds = %153
br label %155
155: ; preds = %154
br label %228
156: ; preds = %89
%157 = load i32, i32* %7
%158 = call i64 @sync_word_fuzzy_compare(i32 %157, i32 1394760477)
%159 = icmp ne i64 %158, 0
br i1 %159, label %164, label %160
160: ; preds = %156
%161 = load i32, i32* %8
%162 = call i64 @sync_word_fuzzy_compare(i32 %161, i32 1394760477)
%163 = icmp ne i64 %162, 0
br i1 %163, label %164, label %227
164: ; preds = %160, %156
%165 = load i32, i32* %10
%166 = sub nsw i32 %165, 36
%167 = add nsw i32 %166, 1
store i32 %167, i32* %22
%168 = load i32, i32* %7
%169 = call i64 @sync_word_fuzzy_compare(i32 %168, i32 1394760477)
%170 = icmp ne i64 %169, 0
%171 = zext i1 %170 to i64
%172 = select i1 %170, i32 0, i32 1
store i32 %172, i32* %23
%173 = load i32, i32* %22
%174 = mul nsw i32 %173, 2
%175 = load i32, i32* %23
%176 = add nsw i32 %174, %175
store i32 %176, i32* %24
store i32 -1, i32* %27
store i32 -1, i32* %28
%177 = load i32*, i32** %4
%178 = load i32, i32* %24
%179 = sext i32 %178 to i64
%180 = getelementptr inbounds i32, i32* %177, i64 %179
%181 = getelementptr inbounds [552 x i32], [552 x i32]* %11, i64 0, i64 0
%182 = call i32 @demod_uplink_frame(i32* %180, i32* %181, i32* %27)
store i32 %182, i32* %25
%183 = load i32*, i32** %4
%184 = load i32, i32* %24
%185 = sext i32 %184 to i64
%186 = getelementptr inbounds i32, i32* %183, i64 %185
%187 = getelementptr inbounds i32, i32* %186, i64 1
%188 = getelementptr inbounds [552 x i32], [552 x i32]* %12, i64 0, i64 0
%189 = call i32 @demod_uplink_frame(i32* %187, i32* %188, i32* %28)
store i32 %189, i32* %26
%190 = load i32, i32* %25
%191 = icmp ne i32 %190, 0
br i1 %191, label %192, label %206
192: ; preds = %164
%193 = load i32, i32* %27
%194 = load i32, i32* %28
%195 = icmp sle i32 %193, %194
br i1 %195, label %196, label %206
196: ; preds = %192
%197 = load i32, i32* %6
%198 = load i32, i32* %24
%199 = add nsw i32 %197, %198
%200 = getelementptr inbounds [552 x i32], [552 x i32]* %11, i64 0, i64 0
%201 = load i32, i32* %27
%202 = call i32 @handle_uplink_frame(i32 %199, i32* %200, i32 %201)
%203 = load i32, i32* %22
%204 = load i32, i32* %25
%205 = add nsw i32 %203, %204
store i32 %205, i32* %10
br label %229
206: ; preds = %192, %164
%207 = load i32, i32* %26
%208 = icmp ne i32 %207, 0
br i1 %208, label %209, label %224
209: ; preds = %206
%210 = load i32, i32* %28
%211 = load i32, i32* %27
%212 = icmp sle i32 %210, %211
br i1 %212, label %213, label %224
213: ; preds = %209
%214 = load i32, i32* %6
%215 = load i32, i32* %24
%216 = add nsw i32 %214, %215
%217 = add nsw i32 %216, 1
%218 = getelementptr inbounds [552 x i32], [552 x i32]* %12, i64 0, i64 0
%219 = load i32, i32* %28
%220 = call i32 @handle_uplink_frame(i32 %217, i32* %218, i32 %219)
%221 = load i32, i32* %22
%222 = load i32, i32* %26
%223 = add nsw i32 %221, %222
store i32 %223, i32* %10
br label %229
224: ; preds = %209, %206
br label %225
225: ; preds = %224
br label %226
226: ; preds = %225
br label %227
227: ; preds = %226, %160
br label %228
228: ; preds = %227, %155
br label %229
229: ; preds = %228, %213, %196, %142, %125, %84
%230 = load i32, i32* %10
%231 = add nsw i32 %230, 1
store i32 %231, i32* %10
br label %32
232: ; preds = %32
%233 = load i32, i32* %10
%234 = sub nsw i32 %233, 36
%235 = mul nsw i32 %234, 2
ret i32 %235
}

LLVM IR (-O2):
define i32 @process_buffer(i32* %0, i32 %1, i32 %2) {
%4 = alloca [552 x i32]
%5 = alloca [552 x i32]
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = bitcast [552 x i32]* %4 to i8*
%11 = bitcast [552 x i32]* %5 to i8*
%12 = sdiv i32 %1, 2
%13 = add nsw i32 %12, -4452
%14 = icmp sgt i32 %1, 8905
br i1 %14, label %15, label %126
15: ; preds = %3
%16 = bitcast i32* %6 to i8*
%17 = bitcast i32* %7 to i8*
%18 = getelementptr inbounds [552 x i32], [552 x i32]* %4, i64 0, i64 0
%19 = getelementptr inbounds [552 x i32], [552 x i32]* %5, i64 0, i64 0
%20 = add i32 %2, 1
%21 = bitcast i32* %8 to i8*
%22 = bitcast i32* %9 to i8*
br label %23
23: ; preds = %15, %119
%24 = phi i32 [ 0, %15 ], [ %121, %119 ]
%25 = shl nsw i32 %24, 1
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i32, i32* %0, i64 %26
%28 = load i32, i32* %27
%29 = or i32 %25, 1
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i32, i32* %0, i64 %30
%32 = load i32, i32* %31
%33 = call i64 @phi_difference(i32 %28, i32 %32)
%34 = load i32, i32* %31
%35 = add nsw i32 %25, 2
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds i32, i32* %0, i64 %36
%38 = load i32, i32* %37
%39 = call i64 @phi_difference(i32 %34, i32 %38)
%40 = icmp slt i32 %24, 36
br i1 %40, label %119, label %41
41: ; preds = %23
%42 = call i64 @sync_word_fuzzy_compare(i32 poison, i32 -1394760478)
%43 = icmp eq i64 %42, 0
br i1 %43, label %44, label %47
44: ; preds = %41
%45 = call i64 @sync_word_fuzzy_compare(i32 poison, i32 -1394760478)
%46 = icmp eq i64 %45, 0
br i1 %46, label %80, label %47
47: ; preds = %44, %41
%48 = add nsw i32 %24, -35
%49 = call i64 @sync_word_fuzzy_compare(i32 poison, i32 -1394760478)
%50 = icmp eq i64 %49, 0
%51 = zext i1 %50 to i32
%52 = shl nuw nsw i32 %48, 1
%53 = or i32 %52, %51
store i32 -1, i32* %6
store i32 -1, i32* %7
%54 = zext i32 %53 to i64
%55 = getelementptr inbounds i32, i32* %0, i64 %54
%56 = call i32 @demod_adsb_frame(i32* %55, i32* %18, i32* %6)
%57 = getelementptr inbounds i32, i32* %55, i64 1
%58 = call i32 @demod_adsb_frame(i32* %57, i32* %19, i32* %7)
%59 = icmp eq i32 %56, 0
br i1 %59, label %68, label %60
60: ; preds = %47
%61 = load i32, i32* %6
%62 = load i32, i32* %7
%63 = icmp sgt i32 %61, %62
br i1 %63, label %68, label %64
64: ; preds = %60
%65 = add nsw i32 %53, %2
%66 = call i32 @handle_adsb_frame(i32 %65, i32* %18, i32 %61)
%67 = add nsw i32 %56, %48
br label %78
68: ; preds = %60, %47
%69 = icmp eq i32 %58, 0
br i1 %69, label %78, label %70
70: ; preds = %68
%71 = load i32, i32* %7
%72 = load i32, i32* %6
%73 = icmp sgt i32 %71, %72
br i1 %73, label %78, label %74
74: ; preds = %70
%75 = add i32 %20, %53
%76 = call i32 @handle_adsb_frame(i32 %75, i32* %19, i32 %71)
%77 = add nsw i32 %58, %48
br label %78
78: ; preds = %68, %70, %74, %64
%79 = phi i32 [ %77, %74 ], [ %67, %64 ], [ %24, %70 ], [ %24, %68 ]
br label %119
80: ; preds = %44
%81 = call i64 @sync_word_fuzzy_compare(i32 poison, i32 1394760477)
%82 = icmp eq i64 %81, 0
br i1 %82, label %83, label %86
83: ; preds = %80
%84 = call i64 @sync_word_fuzzy_compare(i32 poison, i32 1394760477)
%85 = icmp eq i64 %84, 0
br i1 %85, label %119, label %86
86: ; preds = %83, %80
%87 = add nsw i32 %24, -35
%88 = call i64 @sync_word_fuzzy_compare(i32 poison, i32 1394760477)
%89 = icmp eq i64 %88, 0
%90 = zext i1 %89 to i32
%91 = shl nuw nsw i32 %87, 1
%92 = or i32 %91, %90
store i32 -1, i32* %8
store i32 -1, i32* %9
%93 = zext i32 %92 to i64
%94 = getelementptr inbounds i32, i32* %0, i64 %93
%95 = call i32 @demod_uplink_frame(i32* %94, i32* %18, i32* %8)
%96 = getelementptr inbounds i32, i32* %94, i64 1
%97 = call i32 @demod_uplink_frame(i32* %96, i32* %19, i32* %9)
%98 = icmp eq i32 %95, 0
br i1 %98, label %107, label %99
99: ; preds = %86
%100 = load i32, i32* %8
%101 = load i32, i32* %9
%102 = icmp sgt i32 %100, %101
br i1 %102, label %107, label %103
103: ; preds = %99
%104 = add nsw i32 %92, %2
%105 = call i32 @handle_uplink_frame(i32 %104, i32* %18, i32 %100)
%106 = add nsw i32 %95, %87
br label %117
107: ; preds = %99, %86
%108 = icmp eq i32 %97, 0
br i1 %108, label %117, label %109
109: ; preds = %107
%110 = load i32, i32* %9
%111 = load i32, i32* %8
%112 = icmp sgt i32 %110, %111
br i1 %112, label %117, label %113
113: ; preds = %109
%114 = add i32 %20, %92
%115 = call i32 @handle_uplink_frame(i32 %114, i32* %19, i32 %110)
%116 = add nsw i32 %97, %87
br label %117
117: ; preds = %107, %109, %113, %103
%118 = phi i32 [ %116, %113 ], [ %106, %103 ], [ %24, %109 ], [ %24, %107 ]
br label %119
119: ; preds = %117, %78, %83, %23
%120 = phi i32 [ %24, %23 ], [ %79, %78 ], [ %118, %117 ], [ %24, %83 ]
%121 = add nsw i32 %120, 1
%122 = icmp slt i32 %121, %13
br i1 %122, label %23, label %123
123: ; preds = %119
%124 = shl i32 %121, 1
%125 = add i32 %124, -72
br label %126
126: ; preds = %123, %3
%127 = phi i32 [ -72, %3 ], [ %125, %123 ]
ret i32 %127
}