#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 uint8_t;
typedef unsigned long long uint64_t;
typedef int /*<<< orphan*/ uint32_t;
typedef scalar_t__ length;

/* Variables and functions */
int /*<<< orphan*/ get_pespts(int *, int *);
int /*<<< orphan*/ htonl(unsigned long long);
int /*<<< orphan*/ memcpy(int *, int *, int);
int /*<<< orphan*/ memset(int *, int, int);
int write_pes_header(uint8_t id, int length, uint64_t PTS, uint64_t DTS,
                     uint8_t *obuf, int stuffing, uint8_t ptsdts) {
  uint8_t le[2];
  uint8_t dummy[3];
  uint8_t *pts;
  uint8_t ppts[5];
  uint32_t lpts;
  uint8_t *dts;
  uint8_t pdts[5];
  uint32_t ldts;
  int c;
  uint8_t headr[3] = {0x00, 0x00, 0x01};
  lpts = htonl((PTS / 300ULL) & 0x00000000FFFFFFFFULL);
  pts = (uint8_t *)&lpts;
  get_pespts(pts, ppts);
  if ((PTS / 300ULL) & 0x0000000100000000ULL)
    ppts[0] |= 0x80;
  ldts = htonl((DTS / 300ULL) & 0x00000000FFFFFFFFULL);
  dts = (uint8_t *)&ldts;
  get_pespts(dts, pdts);
  if ((DTS / 300ULL) & 0x0000000100000000ULL)
    pdts[0] |= 0x80;
  c = 0;
  memcpy(obuf + c, headr, 3);
  c += 3;
  memcpy(obuf + c, &id, 1);
  c++;
  le[0] = 0;
  le[1] = 0;
  length -= 6;
  le[0] |= ((uint8_t)(length >> 8) & 0xFF);
  le[1] |= ((uint8_t)(length)&0xFF);
  memcpy(obuf + c, le, 2);
  c += 2;
  if (id == 0xBE) {
    memset(obuf + c, 0xff, length);
    c += length;
    return c;
  }
  dummy[0] = 0x80;
  dummy[1] = 0;
  dummy[2] = 0;
  if (ptsdts == 0x80) {
    dummy[2] = 5 + stuffing;
    dummy[1] |= 0x80;
  } else if (ptsdts == 0xC0) {
    dummy[2] = 10 + stuffing;
    dummy[1] |= 0xC0;
  }
  memcpy(obuf + c, dummy, 3);
  c += 3;
  memset(obuf + c, 0xFF, stuffing);
  c += stuffing;
  if (ptsdts == 0x80) {
    memcpy(obuf + c, ppts, 5);
    c += 5;
  } else if (ptsdts == 0xC0) {
    memcpy(obuf + c, ppts, 5);
    c += 5;
    memcpy(obuf + c, pdts, 5);
    c += 5;
  }
  return c;
}


x86 assembly (clang, -O0):
<write_pes_header>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
mov    0x10(%rbp),%eax
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9d,-0x2c(%rbp)
mov    0xe95(%rip),%rax
mov    %rax,-0xa4(%rbp)
mov    0xe90(%rip),%eax
mov    %eax,-0x9c(%rbp)
mov    -0x18(%rbp),%rax
mov    $0x12c,%ecx
xor    %edx,%edx
div    %rcx
mov    %rax,%rdi
movabs $0xffffffff,%rax
and    %rax,%rdi
call   1030 <htonl@plt>
mov    %eax,-0x64(%rbp)
lea    -0x64(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rdi
lea    -0x60(%rbp),%rsi
call   1060 <get_pespts@plt>
mov    -0x18(%rbp),%rax
mov    $0x12c,%ecx
xor    %edx,%edx
div    %rcx
movabs $0x100000000,%rcx
and    %rcx,%rax
cmp    $0x0,%rax
je     11e9 <write_pes_header+0xa9>
mov    -0x60(%rbp),%eax
or     $0x80,%eax
mov    %eax,-0x60(%rbp)
mov    -0x20(%rbp),%rax
mov    $0x12c,%ecx
xor    %edx,%edx
div    %rcx
mov    %rax,%rdi
movabs $0xffffffff,%rax
and    %rax,%rdi
call   1030 <htonl@plt>
mov    %eax,-0x94(%rbp)
lea    -0x94(%rbp),%rax
mov    %rax,-0x70(%rbp)
mov    -0x70(%rbp),%rdi
lea    -0x90(%rbp),%rsi
call   1060 <get_pespts@plt>
mov    -0x20(%rbp),%rax
mov    $0x12c,%ecx
xor    %edx,%edx
div    %rcx
movabs $0x100000000,%rcx
and    %rcx,%rax
cmp    $0x0,%rax
je     1263 <write_pes_header+0x123>
mov    -0x90(%rbp),%eax
or     $0x80,%eax
mov    %eax,-0x90(%rbp)
movl   $0x0,-0x98(%rbp)
mov    -0x28(%rbp),%rdi
movslq -0x98(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
lea    -0xa4(%rbp),%rsi
mov    $0x3,%edx
call   1050 <memcpy@plt>
mov    -0x98(%rbp),%eax
add    $0x3,%eax
mov    %eax,-0x98(%rbp)
mov    -0x28(%rbp),%rdi
movslq -0x98(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
lea    -0x8(%rbp),%rsi
mov    $0x1,%edx
call   1050 <memcpy@plt>
mov    -0x98(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x98(%rbp)
movl   $0x0,-0x34(%rbp)
movl   $0x0,-0x30(%rbp)
mov    -0xc(%rbp),%eax
sub    $0x6,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
sar    $0x8,%eax
and    $0xff,%eax
or     -0x34(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0xc(%rbp),%eax
and    $0xff,%eax
or     -0x30(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x28(%rbp),%rdi
movslq -0x98(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
lea    -0x34(%rbp),%rsi
mov    $0x2,%edx
call   1050 <memcpy@plt>
mov    -0x98(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x98(%rbp)
cmpl   $0xbe,-0x8(%rbp)
jne    137c <write_pes_header+0x23c>
mov    -0x28(%rbp),%rdi
movslq -0x98(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
mov    -0xc(%rbp),%edx
mov    $0xff,%esi
call   1040 <memset@plt>
mov    -0xc(%rbp),%eax
add    -0x98(%rbp),%eax
mov    %eax,-0x98(%rbp)
mov    -0x98(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    14f7 <write_pes_header+0x3b7>
movl   $0x80,-0x40(%rbp)
movl   $0x0,-0x3c(%rbp)
movl   $0x0,-0x38(%rbp)
cmpl   $0x80,0x10(%rbp)
jne    13b7 <write_pes_header+0x277>
mov    -0x2c(%rbp),%eax
add    $0x5,%eax
mov    %eax,-0x38(%rbp)
mov    -0x3c(%rbp),%eax
or     $0x80,%eax
mov    %eax,-0x3c(%rbp)
jmp    13dd <write_pes_header+0x29d>
cmpl   $0xc0,0x10(%rbp)
jne    13d8 <write_pes_header+0x298>
mov    -0x2c(%rbp),%eax
add    $0xa,%eax
mov    %eax,-0x38(%rbp)
mov    -0x3c(%rbp),%eax
or     $0xc0,%eax
mov    %eax,-0x3c(%rbp)
jmp    13dd <write_pes_header+0x29d>
mov    -0x28(%rbp),%rdi
movslq -0x98(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
lea    -0x40(%rbp),%rsi
mov    $0x3,%edx
call   1050 <memcpy@plt>
mov    -0x98(%rbp),%eax
add    $0x3,%eax
mov    %eax,-0x98(%rbp)
mov    -0x28(%rbp),%rdi
movslq -0x98(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
mov    -0x2c(%rbp),%edx
mov    $0xff,%esi
call   1040 <memset@plt>
mov    -0x2c(%rbp),%eax
add    -0x98(%rbp),%eax
mov    %eax,-0x98(%rbp)
cmpl   $0x80,0x10(%rbp)
jne    147b <write_pes_header+0x33b>
mov    -0x28(%rbp),%rdi
movslq -0x98(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
lea    -0x60(%rbp),%rsi
mov    $0x5,%edx
call   1050 <memcpy@plt>
mov    -0x98(%rbp),%eax
add    $0x5,%eax
mov    %eax,-0x98(%rbp)
jmp    14ee <write_pes_header+0x3ae>
cmpl   $0xc0,0x10(%rbp)
jne    14e9 <write_pes_header+0x3a9>
mov    -0x28(%rbp),%rdi
movslq -0x98(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
lea    -0x60(%rbp),%rsi
mov    $0x5,%edx
call   1050 <memcpy@plt>
mov    -0x98(%rbp),%eax
add    $0x5,%eax
mov    %eax,-0x98(%rbp)
mov    -0x28(%rbp),%rdi
movslq -0x98(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
lea    -0x90(%rbp),%rsi
mov    $0x5,%edx
call   1050 <memcpy@plt>
mov    -0x98(%rbp),%eax
add    $0x5,%eax
mov    %eax,-0x98(%rbp)
jmp    14ee <write_pes_header+0x3ae>
mov    -0x98(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_pes_header>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
mov    %r9d,%r14d
mov    %r8,%r13
mov    %rcx,%r12
mov    %rdx,%rax
mov    %esi,%r15d
mov    %edi,(%rsp)
mov    0xea2(%rip),%ecx
mov    %ecx,0x28(%rsp)
mov    0xe8f(%rip),%rcx
mov    %rcx,0x20(%rsp)
movabs $0x6d3a06d3a06d3a07,%rbp
06 3a 6d
mul    %rbp
mov    %rdx,%rbx
shr    $0x7,%rbx
mov    %ebx,%edi
call   1030 <htonl@plt>
mov    %eax,0x8(%rsp)
lea    0x8(%rsp),%rdi
lea    0x30(%rsp),%rsi
call   1060 <get_pespts@plt>
bt     $0x20,%rbx
jae    11b0 <write_pes_header+0x70>
orb    $0x80,0x30(%rsp)
mov    %r12,%rax
mul    %rbp
mov    %rdx,%rbx
shr    $0x7,%rbx
mov    %ebx,%edi
call   1030 <htonl@plt>
mov    %eax,0x4(%rsp)
lea    0x4(%rsp),%rdi
lea    0x50(%rsp),%rsi
call   1060 <get_pespts@plt>
movabs $0x100000000,%rax
test   %rax,%rbx
je     11eb <write_pes_header+0xab>
orb    $0x80,0x50(%rsp)
lea    0x20(%rsp),%rsi
mov    %r13,%rdi
mov    $0x3,%edx
call   1050 <memcpy@plt>
lea    0xc(%r13),%rdi
mov    %rsp,%rsi
mov    $0x1,%edx
call   1050 <memcpy@plt>
lea    -0x6(%r15),%ebx
movzbl %bh,%eax
mov    %eax,0x18(%rsp)
movzbl %bl,%eax
mov    %eax,0x1c(%rsp)
lea    0x10(%r13),%rdi
lea    0x18(%rsp),%rsi
mov    $0x2,%edx
call   1050 <memcpy@plt>
cmpl   $0xbe,(%rsp)
jne    1254 <write_pes_header+0x114>
add    $0x18,%r13
mov    %r13,%rdi
mov    $0xff,%esi
mov    %ebx,%edx
call   1040 <memset@plt>
jmp    1339 <write_pes_header+0x1f9>
mov    0xa0(%rsp),%ebx
movq   $0x80,0xc(%rsp)
movl   $0x0,0x14(%rsp)
cmp    $0x80,%ebx
jne    1280 <write_pes_header+0x140>
mov    $0x80,%eax
mov    $0x5,%ecx
jmp    1292 <write_pes_header+0x152>
cmp    $0xc0,%ebx
jne    129d <write_pes_header+0x15d>
mov    $0xc0,%eax
mov    $0xa,%ecx
add    %r14d,%ecx
mov    %ecx,0x14(%rsp)
mov    %eax,0x10(%rsp)
lea    0x18(%r13),%rdi
lea    0xc(%rsp),%rsi
mov    $0x3,%edx
call   1050 <memcpy@plt>
lea    0x24(%r13),%rdi
mov    $0xff,%esi
mov    %r14d,%edx
call   1040 <memset@plt>
lea    0x9(%r14),%r15d
cmp    $0x80,%ebx
jne    12f0 <write_pes_header+0x1b0>
movslq %r15d,%rax
lea    0x0(,%rax,4),%rdi
add    %r13,%rdi
lea    0x30(%rsp),%rsi
mov    $0x5,%edx
call   1050 <memcpy@plt>
add    $0xe,%r14d
jmp    1336 <write_pes_header+0x1f6>
cmp    $0xc0,%ebx
jne    1339 <write_pes_header+0x1f9>
movslq %r15d,%rax
lea    0x0(,%rax,4),%rdi
add    %r13,%rdi
lea    0x30(%rsp),%rsi
mov    $0x5,%edx
call   1050 <memcpy@plt>
movslq %r14d,%rax
lea    0x38(,%rax,4),%rdi
add    %r13,%rdi
lea    0x50(%rsp),%rsi
mov    $0x5,%edx
call   1050 <memcpy@plt>
add    $0x13,%r14d
mov    %r14d,%r15d
mov    %r15d,%eax
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.write_pes_header.headr = [3 x i32] [i32 0, i32 0, i32 1]
define i32 @write_pes_header(i32 %0, i32 %1, i64 %2, i64 %3, i32* %4, i32 %5, i32 %6) {
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i64
%12 = alloca i64
%13 = alloca i32*
%14 = alloca i32
%15 = alloca i32
%16 = alloca [2 x i32]
%17 = alloca [3 x i32]
%18 = alloca i32*
%19 = alloca [5 x i32]
%20 = alloca i32
%21 = alloca i32*
%22 = alloca [5 x i32]
%23 = alloca i32
%24 = alloca i32
%25 = alloca [3 x i32]
store i32 %0, i32* %9
store i32 %1, i32* %10
store i64 %2, i64* %11
store i64 %3, i64* %12
store i32* %4, i32** %13
store i32 %5, i32* %14
store i32 %6, i32* %15
%26 = bitcast [3 x i32]* %25 to i8*
%27 = load i64, i64* %11
%28 = udiv i64 %27, 300
%29 = and i64 %28, 4294967295
%30 = call i32 @htonl(i64 %29)
store i32 %30, i32* %20
store i32* %20, i32** %18
%31 = load i32*, i32** %18
%32 = getelementptr inbounds [5 x i32], [5 x i32]* %19, i64 0, i64 0
%33 = call i32 @get_pespts(i32* %31, i32* %32)
%34 = load i64, i64* %11
%35 = udiv i64 %34, 300
%36 = and i64 %35, 4294967296
%37 = icmp ne i64 %36, 0
br i1 %37, label %38, label %42
38: ; preds = %7
%39 = getelementptr inbounds [5 x i32], [5 x i32]* %19, i64 0, i64 0
%40 = load i32, i32* %39
%41 = or i32 %40, 128
store i32 %41, i32* %39
br label %42
42: ; preds = %38, %7
%43 = load i64, i64* %12
%44 = udiv i64 %43, 300
%45 = and i64 %44, 4294967295
%46 = call i32 @htonl(i64 %45)
store i32 %46, i32* %23
store i32* %23, i32** %21
%47 = load i32*, i32** %21
%48 = getelementptr inbounds [5 x i32], [5 x i32]* %22, i64 0, i64 0
%49 = call i32 @get_pespts(i32* %47, i32* %48)
%50 = load i64, i64* %12
%51 = udiv i64 %50, 300
%52 = and i64 %51, 4294967296
%53 = icmp ne i64 %52, 0
br i1 %53, label %54, label %58
54: ; preds = %42
%55 = getelementptr inbounds [5 x i32], [5 x i32]* %22, i64 0, i64 0
%56 = load i32, i32* %55
%57 = or i32 %56, 128
store i32 %57, i32* %55
br label %58
58: ; preds = %54, %42
store i32 0, i32* %24
%59 = load i32*, i32** %13
%60 = load i32, i32* %24
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds i32, i32* %59, i64 %61
%63 = getelementptr inbounds [3 x i32], [3 x i32]* %25, i64 0, i64 0
%64 = call i32 @memcpy(i32* %62, i32* %63, i32 3)
%65 = load i32, i32* %24
%66 = add nsw i32 %65, 3
store i32 %66, i32* %24
%67 = load i32*, i32** %13
%68 = load i32, i32* %24
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds i32, i32* %67, i64 %69
%71 = call i32 @memcpy(i32* %70, i32* %9, i32 1)
%72 = load i32, i32* %24
%73 = add nsw i32 %72, 1
store i32 %73, i32* %24
%74 = getelementptr inbounds [2 x i32], [2 x i32]* %16, i64 0, i64 0
store i32 0, i32* %74
%75 = getelementptr inbounds [2 x i32], [2 x i32]* %16, i64 0, i64 1
store i32 0, i32* %75
%76 = load i32, i32* %10
%77 = sub nsw i32 %76, 6
store i32 %77, i32* %10
%78 = load i32, i32* %10
%79 = ashr i32 %78, 8
%80 = and i32 %79, 255
%81 = getelementptr inbounds [2 x i32], [2 x i32]* %16, i64 0, i64 0
%82 = load i32, i32* %81
%83 = or i32 %82, %80
store i32 %83, i32* %81
%84 = load i32, i32* %10
%85 = and i32 %84, 255
%86 = getelementptr inbounds [2 x i32], [2 x i32]* %16, i64 0, i64 1
%87 = load i32, i32* %86
%88 = or i32 %87, %85
store i32 %88, i32* %86
%89 = load i32*, i32** %13
%90 = load i32, i32* %24
%91 = sext i32 %90 to i64
%92 = getelementptr inbounds i32, i32* %89, i64 %91
%93 = getelementptr inbounds [2 x i32], [2 x i32]* %16, i64 0, i64 0
%94 = call i32 @memcpy(i32* %92, i32* %93, i32 2)
%95 = load i32, i32* %24
%96 = add nsw i32 %95, 2
store i32 %96, i32* %24
%97 = load i32, i32* %9
%98 = icmp eq i32 %97, 190
br i1 %98, label %99, label %110
99: ; preds = %58
%100 = load i32*, i32** %13
%101 = load i32, i32* %24
%102 = sext i32 %101 to i64
%103 = getelementptr inbounds i32, i32* %100, i64 %102
%104 = load i32, i32* %10
%105 = call i32 @memset(i32* %103, i32 255, i32 %104)
%106 = load i32, i32* %10
%107 = load i32, i32* %24
%108 = add nsw i32 %107, %106
store i32 %108, i32* %24
%109 = load i32, i32* %24
store i32 %109, i32* %8
br label %186
110: ; preds = %58
%111 = getelementptr inbounds [3 x i32], [3 x i32]* %17, i64 0, i64 0
store i32 128, i32* %111
%112 = getelementptr inbounds [3 x i32], [3 x i32]* %17, i64 0, i64 1
store i32 0, i32* %112
%113 = getelementptr inbounds [3 x i32], [3 x i32]* %17, i64 0, i64 2
store i32 0, i32* %113
%114 = load i32, i32* %15
%115 = icmp eq i32 %114, 128
br i1 %115, label %116, label %123
116: ; preds = %110
%117 = load i32, i32* %14
%118 = add nsw i32 5, %117
%119 = getelementptr inbounds [3 x i32], [3 x i32]* %17, i64 0, i64 2
store i32 %118, i32* %119
%120 = getelementptr inbounds [3 x i32], [3 x i32]* %17, i64 0, i64 1
%121 = load i32, i32* %120
%122 = or i32 %121, 128
store i32 %122, i32* %120
br label %134
123: ; preds = %110
%124 = load i32, i32* %15
%125 = icmp eq i32 %124, 192
br i1 %125, label %126, label %133
126: ; preds = %123
%127 = load i32, i32* %14
%128 = add nsw i32 10, %127
%129 = getelementptr inbounds [3 x i32], [3 x i32]* %17, i64 0, i64 2
store i32 %128, i32* %129
%130 = getelementptr inbounds [3 x i32], [3 x i32]* %17, i64 0, i64 1
%131 = load i32, i32* %130
%132 = or i32 %131, 192
store i32 %132, i32* %130
br label %133
133: ; preds = %126, %123
br label %134
134: ; preds = %133, %116
%135 = load i32*, i32** %13
%136 = load i32, i32* %24
%137 = sext i32 %136 to i64
%138 = getelementptr inbounds i32, i32* %135, i64 %137
%139 = getelementptr inbounds [3 x i32], [3 x i32]* %17, i64 0, i64 0
%140 = call i32 @memcpy(i32* %138, i32* %139, i32 3)
%141 = load i32, i32* %24
%142 = add nsw i32 %141, 3
store i32 %142, i32* %24
%143 = load i32*, i32** %13
%144 = load i32, i32* %24
%145 = sext i32 %144 to i64
%146 = getelementptr inbounds i32, i32* %143, i64 %145
%147 = load i32, i32* %14
%148 = call i32 @memset(i32* %146, i32 255, i32 %147)
%149 = load i32, i32* %14
%150 = load i32, i32* %24
%151 = add nsw i32 %150, %149
store i32 %151, i32* %24
%152 = load i32, i32* %15
%153 = icmp eq i32 %152, 128
br i1 %153, label %154, label %163
154: ; preds = %134
%155 = load i32*, i32** %13
%156 = load i32, i32* %24
%157 = sext i32 %156 to i64
%158 = getelementptr inbounds i32, i32* %155, i64 %157
%159 = getelementptr inbounds [5 x i32], [5 x i32]* %19, i64 0, i64 0
%160 = call i32 @memcpy(i32* %158, i32* %159, i32 5)
%161 = load i32, i32* %24
%162 = add nsw i32 %161, 5
store i32 %162, i32* %24
br label %184
163: ; preds = %134
%164 = load i32, i32* %15
%165 = icmp eq i32 %164, 192
br i1 %165, label %166, label %183
166: ; preds = %163
%167 = load i32*, i32** %13
%168 = load i32, i32* %24
%169 = sext i32 %168 to i64
%170 = getelementptr inbounds i32, i32* %167, i64 %169
%171 = getelementptr inbounds [5 x i32], [5 x i32]* %19, i64 0, i64 0
%172 = call i32 @memcpy(i32* %170, i32* %171, i32 5)
%173 = load i32, i32* %24
%174 = add nsw i32 %173, 5
store i32 %174, i32* %24
%175 = load i32*, i32** %13
%176 = load i32, i32* %24
%177 = sext i32 %176 to i64
%178 = getelementptr inbounds i32, i32* %175, i64 %177
%179 = getelementptr inbounds [5 x i32], [5 x i32]* %22, i64 0, i64 0
%180 = call i32 @memcpy(i32* %178, i32* %179, i32 5)
%181 = load i32, i32* %24
%182 = add nsw i32 %181, 5
store i32 %182, i32* %24
br label %183
183: ; preds = %166, %163
br label %184
184: ; preds = %183, %154
%185 = load i32, i32* %24
store i32 %185, i32* %8
br label %186
186: ; preds = %184, %99
%187 = load i32, i32* %8
ret i32 %187
}

LLVM IR (-O2):
@__const.write_pes_header.headr = [3 x i32] [i32 0, i32 0, i32 1]
define i32 @write_pes_header(i32 %0, i32 %1, i64 %2, i64 %3, i32* %4, i32 %5, i32 %6) {
%8 = alloca i32
%9 = alloca [2 x i32]
%10 = alloca [3 x i32]
%11 = alloca [5 x i32]
%12 = alloca i32
%13 = alloca [5 x i32]
%14 = alloca i32
%15 = alloca [3 x i32]
store i32 %0, i32* %8
%16 = bitcast [2 x i32]* %9 to i8*
%17 = bitcast [3 x i32]* %10 to i8*
%18 = bitcast [5 x i32]* %11 to i8*
%19 = bitcast i32* %12 to i8*
%20 = bitcast [5 x i32]* %13 to i8*
%21 = bitcast i32* %14 to i8*
%22 = bitcast [3 x i32]* %15 to i8*
%23 = udiv i64 %2, 300
%24 = and i64 %23, 4294967295
%25 = tail call i32 @htonl(i64 %24)
store i32 %25, i32* %12
%26 = getelementptr inbounds [5 x i32], [5 x i32]* %11, i64 0, i64 0
%27 = call i32 @get_pespts(i32* %12, i32* %26)
%28 = and i64 %23, 4294967296
%29 = icmp eq i64 %28, 0
br i1 %29, label %33, label %30
30: ; preds = %7
%31 = load i32, i32* %26
%32 = or i32 %31, 128
store i32 %32, i32* %26
br label %33
33: ; preds = %30, %7
%34 = udiv i64 %3, 300
%35 = and i64 %34, 4294967295
%36 = call i32 @htonl(i64 %35)
store i32 %36, i32* %14
%37 = getelementptr inbounds [5 x i32], [5 x i32]* %13, i64 0, i64 0
%38 = call i32 @get_pespts(i32* %14, i32* %37)
%39 = and i64 %34, 4294967296
%40 = icmp eq i64 %39, 0
br i1 %40, label %44, label %41
41: ; preds = %33
%42 = load i32, i32* %37
%43 = or i32 %42, 128
store i32 %43, i32* %37
br label %44
44: ; preds = %41, %33
%45 = getelementptr inbounds [3 x i32], [3 x i32]* %15, i64 0, i64 0
%46 = call i32 @memcpy(i32* %4, i32* %45, i32 3)
%47 = getelementptr inbounds i32, i32* %4, i64 3
%48 = call i32 @memcpy(i32* %47, i32* %8, i32 1)
%49 = getelementptr inbounds [2 x i32], [2 x i32]* %9, i64 0, i64 0
%50 = getelementptr inbounds [2 x i32], [2 x i32]* %9, i64 0, i64 1
%51 = add nsw i32 %1, -6
%52 = lshr i32 %51, 8
%53 = and i32 %52, 255
store i32 %53, i32* %49
%54 = and i32 %51, 255
store i32 %54, i32* %50
%55 = getelementptr inbounds i32, i32* %4, i64 4
%56 = call i32 @memcpy(i32* %55, i32* %49, i32 2)
%57 = load i32, i32* %8
%58 = icmp eq i32 %57, 190
br i1 %58, label %59, label %62
59: ; preds = %44
%60 = getelementptr inbounds i32, i32* %4, i64 6
%61 = call i32 @memset(i32* %60, i32 255, i32 %51)
br label %95
62: ; preds = %44
%63 = getelementptr inbounds [3 x i32], [3 x i32]* %10, i64 0, i64 0
store i32 128, i32* %63
%64 = getelementptr inbounds [3 x i32], [3 x i32]* %10, i64 0, i64 1
store i32 0, i32* %64
%65 = getelementptr inbounds [3 x i32], [3 x i32]* %10, i64 0, i64 2
store i32 0, i32* %65
%66 = icmp eq i32 %6, 128
br i1 %66, label %69, label %67
67: ; preds = %62
%68 = icmp eq i32 %6, 192
br i1 %68, label %69, label %73
69: ; preds = %67, %62
%70 = phi i32 [ 5, %62 ], [ 10, %67 ]
%71 = phi i32 [ 128, %62 ], [ 192, %67 ]
%72 = add nsw i32 %70, %5
store i32 %72, i32* %65
store i32 %71, i32* %64
br label %73
73: ; preds = %69, %67
%74 = getelementptr inbounds i32, i32* %4, i64 6
%75 = call i32 @memcpy(i32* %74, i32* %63, i32 3)
%76 = getelementptr inbounds i32, i32* %4, i64 9
%77 = call i32 @memset(i32* %76, i32 255, i32 %5)
%78 = add nsw i32 %5, 9
br i1 %66, label %79, label %84
79: ; preds = %73
%80 = sext i32 %78 to i64
%81 = getelementptr inbounds i32, i32* %4, i64 %80
%82 = call i32 @memcpy(i32* %81, i32* %26, i32 5)
%83 = add nsw i32 %5, 14
br label %95
84: ; preds = %73
%85 = icmp eq i32 %6, 192
br i1 %85, label %86, label %95
86: ; preds = %84
%87 = sext i32 %78 to i64
%88 = getelementptr inbounds i32, i32* %4, i64 %87
%89 = call i32 @memcpy(i32* %88, i32* %26, i32 5)
%90 = add nsw i32 %5, 14
%91 = sext i32 %90 to i64
%92 = getelementptr inbounds i32, i32* %4, i64 %91
%93 = call i32 @memcpy(i32* %92, i32* %37, i32 5)
%94 = add nsw i32 %5, 19
br label %95
95: ; preds = %79, %86, %84, %59
%96 = phi i32 [ %1, %59 ], [ %83, %79 ], [ %94, %86 ], [ %78, %84 ]
ret i32 %96
}