#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ O_RDONLY;
int /*<<< orphan*/ STDOUT_FILENO;
void *atoi(char *);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ memcpy(unsigned short *, unsigned char *, int);
unsigned short ntohs(unsigned short);
int open(char *, int /*<<< orphan*/);
int read(int, unsigned char *, int);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ write(int /*<<< orphan*/, unsigned char *, int);
int main(int argc, char *argv[]) {
  int len = 0;
  char *tsfile = 0;
  unsigned short pid = 8191;
  int transport_fd = -1;
  unsigned int bitrate = 48000000;
  int completed = 1;
  unsigned char copyright_bits = 0;
  unsigned char output_packet[4 + 188];
  unsigned long long int ts_packet_count = 0;
  unsigned long long int timestamp = 0;
  unsigned long long int temp = 0;
  unsigned long long int carriage = 0;
  if (argc < 3) {
    fprintf(stderr,
            "Usage: %s file.ts bitrate_in_bps [copyright_bits_as_integer] > "
            "file.m2ts \n",
            argv[0]);
    return 0;
  } else {
    tsfile = argv[1];
    bitrate = atoi(argv[2]);
    if (argc > 3) {
      copyright_bits = atoi(argv[3]);
    }
  }
  transport_fd = open(tsfile, O_RDONLY);
  if (transport_fd < 0) {
    fprintf(stderr, "can't open file %s\n", tsfile);
    return 0;
  }
  completed = 0;
  ts_packet_count = 0;
  while (!completed) {
    len = read(transport_fd, output_packet + 4, 188);
    if (len < 0) {
      fprintf(stderr, "ts file read error \n");
      completed = 1;
    } else if (len == 0) {
      completed = 1;
    } else {
      memcpy(&pid, output_packet + 4 + 1, 2);
      pid = ntohs(pid);
      pid = pid & 0x1fff;
      if (pid < 8191) {
        temp = ts_packet_count * 188 * 8 * 2700000;
        temp /= bitrate;
        temp += carriage;
        timestamp = temp;
        output_packet[0] =
            ((copyright_bits & 0x03) << 6) | ((timestamp >> 24) & 0x3F);
        output_packet[1] = (timestamp >> 16) & 0xFF;
        output_packet[2] = (timestamp >> 8) & 0xFF;
        output_packet[3] = timestamp & 0xFF;
        write(STDOUT_FILENO, output_packet, 4 + 188);
      }
      if (ts_packet_count * 2 >= 454263790) {
        ts_packet_count = 0;
        carriage = timestamp;
      }
      ts_packet_count++;
    }
  }
  close(transport_fd);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movq   $0x0,-0x20(%rbp)
movw   $0x1fff,-0x22(%rbp)
movl   $0xffffffff,-0x28(%rbp)
movl   $0x2dc6c00,-0x2c(%rbp)
movl   $0x1,-0x30(%rbp)
movb   $0x0,-0x31(%rbp)
movq   $0x0,-0x108(%rbp)
movq   $0x0,-0x110(%rbp)
movq   $0x0,-0x118(%rbp)
movq   $0x0,-0x120(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    1227 <main+0xa7>
mov    0x2dcc(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xdec(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    14a6 <main+0x326>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   10a0 <atoi@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0x3,-0x8(%rbp)
jle    125d <main+0xdd>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   10a0 <atoi@plt>
mov    %al,-0x31(%rbp)
jmp    1262 <main+0xe2>
mov    -0x20(%rbp),%rdi
mov    0x2d73(%rip),%rax
mov    (%rax),%esi
call   1090 <open@plt>
mov    %eax,-0x28(%rbp)
cmpl   $0x0,-0x28(%rbp)
jge    12a8 <main+0x128>
mov    0x2d48(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rdx
lea    0xdb6(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    14a6 <main+0x326>
movl   $0x0,-0x30(%rbp)
movq   $0x0,-0x108(%rbp)
cmpl   $0x0,-0x30(%rbp)
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    12d0 <main+0x150>
jmp    1497 <main+0x317>
mov    -0x28(%rbp),%edi
lea    -0x100(%rbp),%rsi
add    $0x4,%rsi
mov    $0xbc,%edx
call   1050 <read@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    1318 <main+0x198>
mov    0x2cd4(%rip),%rax
mov    (%rax),%edi
lea    0xd5a(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x1,-0x30(%rbp)
jmp    1492 <main+0x312>
cmpl   $0x0,-0x14(%rbp)
jne    132e <main+0x1ae>
movl   $0x1,-0x30(%rbp)
jmp    148d <main+0x30d>
lea    -0x100(%rbp),%rsi
add    $0x4,%rsi
add    $0x1,%rsi
lea    -0x22(%rbp),%rdi
mov    $0x2,%edx
call   1070 <memcpy@plt>
movzwl -0x22(%rbp),%edi
call   1080 <ntohs@plt>
mov    %ax,-0x22(%rbp)
movzwl -0x22(%rbp),%eax
and    $0x1fff,%eax
mov    %ax,-0x22(%rbp)
movzwl -0x22(%rbp),%eax
cmp    $0x1fff,%eax
jge    144b <main+0x2cb>
imul   $0xbc,-0x108(%rbp),%rax
shl    $0x3,%rax
imul   $0x2932e0,%rax,%rax
mov    %rax,-0x118(%rbp)
mov    -0x2c(%rbp),%eax
mov    %eax,%ecx
mov    -0x118(%rbp),%rax
xor    %edx,%edx
div    %rcx
mov    %rax,-0x118(%rbp)
mov    -0x120(%rbp),%rax
add    -0x118(%rbp),%rax
mov    %rax,-0x118(%rbp)
mov    -0x118(%rbp),%rax
mov    %rax,-0x110(%rbp)
movzbl -0x31(%rbp),%eax
and    $0x3,%eax
shl    $0x6,%eax
cltq
mov    -0x110(%rbp),%rcx
shr    $0x18,%rcx
and    $0x3f,%rcx
or     %rcx,%rax
mov    %al,-0x100(%rbp)
mov    -0x110(%rbp),%rax
shr    $0x10,%rax
and    $0xff,%rax
mov    %al,-0xff(%rbp)
mov    -0x110(%rbp),%rax
shr    $0x8,%rax
and    $0xff,%rax
mov    %al,-0xfe(%rbp)
mov    -0x110(%rbp),%rax
and    $0xff,%rax
mov    %al,-0xfd(%rbp)
mov    0x2bb8(%rip),%rax
mov    (%rax),%edi
lea    -0x100(%rbp),%rsi
mov    $0xc0,%edx
call   1030 <write@plt>
mov    -0x108(%rbp),%rax
shl    $0x1,%rax
cmp    $0x1b1383ee,%rax
jb     147b <main+0x2fb>
movq   $0x0,-0x108(%rbp)
mov    -0x110(%rbp),%rax
mov    %rax,-0x120(%rbp)
mov    -0x108(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x108(%rbp)
jmp    1492 <main+0x312>
jmp    12ba <main+0x13a>
mov    -0x28(%rbp),%edi
call   1040 <close@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xd8,%rsp
mov    %rsi,%rbp
movw   $0x1fff,0x6(%rsp)
cmp    $0x2,%edi
jg     11b9 <main+0x39>
mov    0x2e29(%rip),%rax
mov    (%rax),%edi
mov    0x0(%rbp),%rdx
lea    0xe4c(%rip),%rsi
jmp    1320 <main+0x1a0>
mov    %edi,%ebx
mov    0x8(%rbp),%r14
mov    0x10(%rbp),%rdi
call   10a0 <atoi@plt>
mov    %rax,%r12
cmp    $0x3,%ebx
jne    11d4 <main+0x54>
xor    %eax,%eax
jmp    11e3 <main+0x63>
mov    0x18(%rbp),%rdi
call   10a0 <atoi@plt>
shl    $0x6,%eax
movzbl %al,%eax
mov    %rax,0x8(%rsp)
mov    0x2df1(%rip),%rax
mov    (%rax),%esi
mov    %r14,%rdi
call   1090 <open@plt>
test   %eax,%eax
js     130d <main+0x18d>
mov    %eax,%ebp
lea    0x14(%rsp),%rsi
mov    %eax,%edi
mov    $0xbc,%edx
call   1050 <read@plt>
test   %eax,%eax
js     12ed <main+0x16d>
mov    %r12d,%r13d
xor    %r15d,%r15d
mov    $0x1,%r14d
xor    %ebx,%ebx
xor    %r12d,%r12d
jmp    125f <main+0xdf>
nop
lea    (%r15,%r15,1),%rax
add    $0x1,%r15
cmp    $0x1b1383ee,%rax
cmovae %rbx,%r12
cmovae %r14,%r15
mov    %ebp,%edi
lea    0x14(%rsp),%rsi
mov    $0xbc,%edx
call   1050 <read@plt>
test   %eax,%eax
js     12ed <main+0x16d>
test   %eax,%eax
je     1304 <main+0x184>
lea    0x6(%rsp),%rdi
lea    0x15(%rsp),%rsi
mov    $0x2,%edx
call   1070 <memcpy@plt>
movzwl 0x6(%rsp),%edi
call   1080 <ntohs@plt>
and    $0x1fff,%eax
mov    %ax,0x6(%rsp)
cmp    $0x1fff,%eax
je     1230 <main+0xb0>
mov    %r15,%rax
mov    $0xf20ae400,%ecx
imul   %rcx,%rax
xor    %edx,%edx
div    %r13
mov    %rax,%rbx
add    %r12,%rbx
mov    %ebx,%eax
shr    $0x18,%eax
and    $0x3f,%eax
or     0x8(%rsp),%eax
mov    %al,0x10(%rsp)
mov    %rbx,%rax
shr    $0x10,%rax
mov    %al,0x11(%rsp)
mov    %bh,0x12(%rsp)
mov    %bl,0x13(%rsp)
mov    0x2d19(%rip),%rax
mov    (%rax),%edi
lea    0x10(%rsp),%rsi
mov    $0xc0,%edx
call   1030 <write@plt>
jmp    1230 <main+0xb0>
mov    0x2cdc(%rip),%rax
mov    (%rax),%edi
lea    0xd62(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    %ebp,%edi
call   1040 <close@plt>
jmp    1327 <main+0x1a7>
mov    0x2cbc(%rip),%rax
mov    (%rax),%edi
lea    0xd2e(%rip),%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1060 <fprintf@plt>
xor    %eax,%eax
add    $0xd8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [75 x i8] c"Usage: %s file.ts bitrate_in_bps [copyright_bits_as_integer] > file.m2ts \0A\00"
@O_RDONLY = global i32 0
@.str.1 = [20 x i8] c"can't open file %s\0A\00"
@.str.2 = [21 x i8] c"ts file read error \0A\00"
@STDOUT_FILENO = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i16
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i8
%13 = alloca [192 x i8]
%14 = alloca i64
%15 = alloca i64
%16 = alloca i64
%17 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
store i8* null, i8** %7
store i16 8191, i16* %8
store i32 -1, i32* %9
store i32 48000000, i32* %10
store i32 1, i32* %11
store i8 0, i8* %12
store i64 0, i64* %14
store i64 0, i64* %15
store i64 0, i64* %16
store i64 0, i64* %17
%18 = load i32, i32* %4
%19 = icmp slt i32 %18, 3
br i1 %19, label %20, label %26
20: ; preds = %2
%21 = load i32, i32* @stderr
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 0
%24 = load i8*, i8** %23
%25 = call i32 (i32, i8*, ...) @fprintf(i32 %21, i8* getelementptr inbounds ([75 x i8], [75 x i8]* @.str, i64 0, i64 0), i8* %24)
store i32 0, i32* %3
br label %142
26: ; preds = %2
%27 = load i8**, i8*** %5
%28 = getelementptr inbounds i8*, i8** %27, i64 1
%29 = load i8*, i8** %28
store i8* %29, i8** %7
%30 = load i8**, i8*** %5
%31 = getelementptr inbounds i8*, i8** %30, i64 2
%32 = load i8*, i8** %31
%33 = call i8* @atoi(i8* %32)
%34 = ptrtoint i8* %33 to i32
store i32 %34, i32* %10
%35 = load i32, i32* %4
%36 = icmp sgt i32 %35, 3
br i1 %36, label %37, label %43
37: ; preds = %26
%38 = load i8**, i8*** %5
%39 = getelementptr inbounds i8*, i8** %38, i64 3
%40 = load i8*, i8** %39
%41 = call i8* @atoi(i8* %40)
%42 = ptrtoint i8* %41 to i8
store i8 %42, i8* %12
br label %43
43: ; preds = %37, %26
br label %44
44: ; preds = %43
%45 = load i8*, i8** %7
%46 = load i32, i32* @O_RDONLY
%47 = call i32 @open(i8* %45, i32 %46)
store i32 %47, i32* %9
%48 = load i32, i32* %9
%49 = icmp slt i32 %48, 0
br i1 %49, label %50, label %54
50: ; preds = %44
%51 = load i32, i32* @stderr
%52 = load i8*, i8** %7
%53 = call i32 (i32, i8*, ...) @fprintf(i32 %51, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i8* %52)
store i32 0, i32* %3
br label %142
54: ; preds = %44
store i32 0, i32* %11
store i64 0, i64* %14
br label %55
55: ; preds = %138, %54
%56 = load i32, i32* %11
%57 = icmp ne i32 %56, 0
%58 = xor i1 %57, true
br i1 %58, label %59, label %139
59: ; preds = %55
%60 = load i32, i32* %9
%61 = getelementptr inbounds [192 x i8], [192 x i8]* %13, i64 0, i64 0
%62 = getelementptr inbounds i8, i8* %61, i64 4
%63 = call i32 @read(i32 %60, i8* %62, i32 188)
store i32 %63, i32* %6
%64 = load i32, i32* %6
%65 = icmp slt i32 %64, 0
br i1 %65, label %66, label %69
66: ; preds = %59
%67 = load i32, i32* @stderr
%68 = call i32 (i32, i8*, ...) @fprintf(i32 %67, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %11
br label %138
69: ; preds = %59
%70 = load i32, i32* %6
%71 = icmp eq i32 %70, 0
br i1 %71, label %72, label %73
72: ; preds = %69
store i32 1, i32* %11
br label %137
73: ; preds = %69
%74 = getelementptr inbounds [192 x i8], [192 x i8]* %13, i64 0, i64 0
%75 = getelementptr inbounds i8, i8* %74, i64 4
%76 = getelementptr inbounds i8, i8* %75, i64 1
%77 = call i32 @memcpy(i16* %8, i8* %76, i32 2)
%78 = load i16, i16* %8
%79 = call zeroext i16 @ntohs(i16 zeroext %78)
store i16 %79, i16* %8
%80 = load i16, i16* %8
%81 = zext i16 %80 to i32
%82 = and i32 %81, 8191
%83 = trunc i32 %82 to i16
store i16 %83, i16* %8
%84 = load i16, i16* %8
%85 = zext i16 %84 to i32
%86 = icmp slt i32 %85, 8191
br i1 %86, label %87, label %128
87: ; preds = %73
%88 = load i64, i64* %14
%89 = mul i64 %88, 188
%90 = mul i64 %89, 8
%91 = mul i64 %90, 2700000
store i64 %91, i64* %16
%92 = load i32, i32* %10
%93 = zext i32 %92 to i64
%94 = load i64, i64* %16
%95 = udiv i64 %94, %93
store i64 %95, i64* %16
%96 = load i64, i64* %17
%97 = load i64, i64* %16
%98 = add i64 %97, %96
store i64 %98, i64* %16
%99 = load i64, i64* %16
store i64 %99, i64* %15
%100 = load i8, i8* %12
%101 = zext i8 %100 to i32
%102 = and i32 %101, 3
%103 = shl i32 %102, 6
%104 = sext i32 %103 to i64
%105 = load i64, i64* %15
%106 = lshr i64 %105, 24
%107 = and i64 %106, 63
%108 = or i64 %104, %107
%109 = trunc i64 %108 to i8
%110 = getelementptr inbounds [192 x i8], [192 x i8]* %13, i64 0, i64 0
store i8 %109, i8* %110
%111 = load i64, i64* %15
%112 = lshr i64 %111, 16
%113 = and i64 %112, 255
%114 = trunc i64 %113 to i8
%115 = getelementptr inbounds [192 x i8], [192 x i8]* %13, i64 0, i64 1
store i8 %114, i8* %115
%116 = load i64, i64* %15
%117 = lshr i64 %116, 8
%118 = and i64 %117, 255
%119 = trunc i64 %118 to i8
%120 = getelementptr inbounds [192 x i8], [192 x i8]* %13, i64 0, i64 2
store i8 %119, i8* %120
%121 = load i64, i64* %15
%122 = and i64 %121, 255
%123 = trunc i64 %122 to i8
%124 = getelementptr inbounds [192 x i8], [192 x i8]* %13, i64 0, i64 3
store i8 %123, i8* %124
%125 = load i32, i32* @STDOUT_FILENO
%126 = getelementptr inbounds [192 x i8], [192 x i8]* %13, i64 0, i64 0
%127 = call i32 @write(i32 %125, i8* %126, i32 192)
br label %128
128: ; preds = %87, %73
%129 = load i64, i64* %14
%130 = mul i64 %129, 2
%131 = icmp uge i64 %130, 454263790
br i1 %131, label %132, label %134
132: ; preds = %128
store i64 0, i64* %14
%133 = load i64, i64* %15
store i64 %133, i64* %17
br label %134
134: ; preds = %132, %128
%135 = load i64, i64* %14
%136 = add i64 %135, 1
store i64 %136, i64* %14
br label %137
137: ; preds = %134, %72
br label %138
138: ; preds = %137, %66
br label %55
139: ; preds = %55
%140 = load i32, i32* %9
%141 = call i32 @close(i32 %140)
store i32 0, i32* %3
br label %142
142: ; preds = %139, %50, %20
%143 = load i32, i32* %3
ret i32 %143
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [75 x i8] c"Usage: %s file.ts bitrate_in_bps [copyright_bits_as_integer] > file.m2ts \0A\00"
@O_RDONLY = global i32 0
@.str.1 = [20 x i8] c"can't open file %s\0A\00"
@.str.2 = [21 x i8] c"ts file read error \0A\00"
@STDOUT_FILENO = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i16
%4 = alloca [192 x i8]
%5 = bitcast i16* %3 to i8*
store i16 8191, i16* %3
%6 = getelementptr inbounds [192 x i8], [192 x i8]* %4, i64 0, i64 0
%7 = icmp slt i32 %0, 3
br i1 %7, label %8, label %12
8: ; preds = %2
%9 = load i32, i32* @stderr
%10 = load i8*, i8** %1
%11 = tail call i32 (i32, i8*, ...) @fprintf(i32 %9, i8* getelementptr inbounds ([75 x i8], [75 x i8]* @.str, i64 0, i64 0), i8* %10)
br label %85
12: ; preds = %2
%13 = getelementptr inbounds i8*, i8** %1, i64 1
%14 = load i8*, i8** %13
%15 = getelementptr inbounds i8*, i8** %1, i64 2
%16 = load i8*, i8** %15
%17 = tail call i8* @atoi(i8* %16)
%18 = ptrtoint i8* %17 to i64
%19 = icmp eq i32 %0, 3
br i1 %19, label %27, label %20
20: ; preds = %12
%21 = getelementptr inbounds i8*, i8** %1, i64 3
%22 = load i8*, i8** %21
%23 = tail call i8* @atoi(i8* %22)
%24 = ptrtoint i8* %23 to i64
%25 = shl i64 %24, 6
%26 = and i64 %25, 192
br label %27
27: ; preds = %12, %20
%28 = phi i64 [ %26, %20 ], [ 0, %12 ]
%29 = load i32, i32* @O_RDONLY
%30 = tail call i32 @open(i8* %14, i32 %29)
%31 = icmp slt i32 %30, 0
br i1 %31, label %41, label %32
32: ; preds = %27
%33 = getelementptr inbounds [192 x i8], [192 x i8]* %4, i64 0, i64 4
%34 = getelementptr inbounds [192 x i8], [192 x i8]* %4, i64 0, i64 5
%35 = and i64 %18, 4294967295
%36 = getelementptr inbounds [192 x i8], [192 x i8]* %4, i64 0, i64 1
%37 = getelementptr inbounds [192 x i8], [192 x i8]* %4, i64 0, i64 2
%38 = getelementptr inbounds [192 x i8], [192 x i8]* %4, i64 0, i64 3
%39 = call i32 @read(i32 %30, i8* %33, i32 188)
%40 = icmp slt i32 %39, 0
br i1 %40, label %44, label %47
41: ; preds = %27
%42 = load i32, i32* @stderr
%43 = tail call i32 (i32, i8*, ...) @fprintf(i32 %42, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i8* %14)
br label %85
44: ; preds = %74, %32
%45 = load i32, i32* @stderr
%46 = call i32 (i32, i8*, ...) @fprintf(i32 %45, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
br label %83
47: ; preds = %32, %74
%48 = phi i32 [ %81, %74 ], [ %39, %32 ]
%49 = phi i64 [ %80, %74 ], [ 0, %32 ]
%50 = phi i64 [ %75, %74 ], [ 0, %32 ]
%51 = phi i64 [ %78, %74 ], [ 0, %32 ]
%52 = icmp eq i32 %48, 0
br i1 %52, label %83, label %53
53: ; preds = %47
%54 = call i32 @memcpy(i16* %3, i8* %34, i32 2)
%55 = load i16, i16* %3
%56 = call zeroext i16 @ntohs(i16 zeroext %55)
%57 = and i16 %56, 8191
store i16 %57, i16* %3
%58 = icmp eq i16 %57, 8191
br i1 %58, label %74, label %59
59: ; preds = %53
%60 = mul i64 %49, 4060800000
%61 = udiv i64 %60, %35
%62 = add i64 %61, %51
%63 = lshr i64 %62, 24
%64 = and i64 %63, 63
%65 = or i64 %64, %28
%66 = trunc i64 %65 to i8
store i8 %66, i8* %6
%67 = lshr i64 %62, 16
%68 = trunc i64 %67 to i8
store i8 %68, i8* %36
%69 = lshr i64 %62, 8
%70 = trunc i64 %69 to i8
store i8 %70, i8* %37
%71 = trunc i64 %62 to i8
store i8 %71, i8* %38
%72 = load i32, i32* @STDOUT_FILENO
%73 = call i32 @write(i32 %72, i8* %6, i32 192)
br label %74
74: ; preds = %53, %59
%75 = phi i64 [ %62, %59 ], [ %50, %53 ]
%76 = shl i64 %49, 1
%77 = icmp ugt i64 %76, 454263789
%78 = select i1 %77, i64 %75, i64 %51
%79 = add i64 %49, 1
%80 = select i1 %77, i64 1, i64 %79
%81 = call i32 @read(i32 %30, i8* %33, i32 188)
%82 = icmp slt i32 %81, 0
br i1 %82, label %44, label %47
83: ; preds = %47, %44
%84 = call i32 @close(i32 %30)
br label %85
85: ; preds = %83, %41, %8
ret i32 0
}