#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 int /*<<< orphan*/ uint16_t;
typedef int /*<<< orphan*/ time_t;
struct ts_eit {
  int dummy;
};

/* Variables and functions */
int *calloc(int, int);
int strlen(char *);
int /*<<< orphan*/ ts_LOGf(char *, ...);
int ts_eit_add_stream(struct ts_eit *, int /*<<< orphan*/, int,
                      int /*<<< orphan*/, int, int *, int);
int ts_eit_add_short_event_descriptor(struct ts_eit *eit, uint16_t event_id,
                                      uint8_t running, time_t start_time,
                                      int duration_sec, char *event_name,
                                      char *event_short_descr) {
  char *txt;
  uint8_t event_len = event_name ? strlen(event_name) : 0;
  uint8_t descr_len = event_short_descr ? strlen(event_short_descr) : 0;
  int desc_size = 2 + 3;
  desc_size += 1 + event_len;
  desc_size += 1 + descr_len;
  if (desc_size > 255) {
    ts_LOGf("EIT short event descriptor size > 255 is not supported (%d)!\n",
            desc_size);
    return 0;
  }
  if (event_len == 0) {
    ts_LOGf("EIT event_len == 0!\n");
    return 0;
  }
  uint8_t *desc = calloc(1, desc_size);
  int dpos = 0;
  desc[dpos + 0] = 0x4d;
  desc[dpos + 1] = desc_size - 2;
  desc[dpos + 2] = 'b';
  desc[dpos + 3] = 'u';
  desc[dpos + 4] = 'l';
  desc[dpos + 5] = event_len;
  dpos += 6;
  txt = event_name;
  while (txt[0]) {
    desc[dpos++] = txt[0];
    txt++;
  }
  desc[dpos++] = descr_len;
  if (descr_len) {
    txt = event_short_descr;
    while (txt[0]) {
      desc[dpos++] = txt[0];
      txt++;
    }
  }
  return ts_eit_add_stream(eit, event_id, running ? 4 : 1, start_time,
                           duration_sec, desc, dpos);
}


x86 assembly (clang, -O0):
<ts_eit_add_short_event_descriptor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    0x10(%rbp),%rax
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
mov    %r9,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     117d <ts_eit_add_short_event_descriptor+0x3d>
mov    -0x28(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x50(%rbp)
jmp    1187 <ts_eit_add_short_event_descriptor+0x47>
xor    %eax,%eax
mov    %eax,-0x50(%rbp)
jmp    1187 <ts_eit_add_short_event_descriptor+0x47>
mov    -0x50(%rbp),%eax
mov    %eax,-0x34(%rbp)
cmpq   $0x0,0x10(%rbp)
je     11a9 <ts_eit_add_short_event_descriptor+0x69>
mov    0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x54(%rbp)
jmp    11b3 <ts_eit_add_short_event_descriptor+0x73>
xor    %eax,%eax
mov    %eax,-0x54(%rbp)
jmp    11b3 <ts_eit_add_short_event_descriptor+0x73>
mov    -0x54(%rbp),%eax
mov    %eax,-0x38(%rbp)
movl   $0x5,-0x3c(%rbp)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
add    -0x3c(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x38(%rbp),%eax
add    $0x1,%eax
add    -0x3c(%rbp),%eax
mov    %eax,-0x3c(%rbp)
cmpl   $0xff,-0x3c(%rbp)
jle    1202 <ts_eit_add_short_event_descriptor+0xc2>
mov    -0x3c(%rbp),%esi
lea    0xe11(%rip),%rdi
mov    $0x0,%al
call   1060 <ts_LOGf@plt>
movl   $0x0,-0x4(%rbp)
jmp    139e <ts_eit_add_short_event_descriptor+0x25e>
cmpl   $0x0,-0x34(%rbp)
jne    1226 <ts_eit_add_short_event_descriptor+0xe6>
lea    0xe2b(%rip),%rdi
mov    $0x0,%al
call   1060 <ts_LOGf@plt>
movl   $0x0,-0x4(%rbp)
jmp    139e <ts_eit_add_short_event_descriptor+0x25e>
mov    -0x3c(%rbp),%esi
mov    $0x1,%edi
call   1040 <calloc@plt>
mov    %rax,-0x48(%rbp)
movl   $0x0,-0x4c(%rbp)
mov    -0x48(%rbp),%rax
mov    -0x4c(%rbp),%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
movl   $0x4d,(%rax,%rcx,4)
mov    -0x3c(%rbp),%edx
sub    $0x2,%edx
mov    -0x48(%rbp),%rax
mov    -0x4c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x48(%rbp),%rax
mov    -0x4c(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movl   $0x62,(%rax,%rcx,4)
mov    -0x48(%rbp),%rax
mov    -0x4c(%rbp),%ecx
add    $0x3,%ecx
movslq %ecx,%rcx
movl   $0x75,(%rax,%rcx,4)
mov    -0x48(%rbp),%rax
mov    -0x4c(%rbp),%ecx
add    $0x4,%ecx
movslq %ecx,%rcx
movl   $0x6c,(%rax,%rcx,4)
mov    -0x34(%rbp),%edx
mov    -0x48(%rbp),%rax
mov    -0x4c(%rbp),%ecx
add    $0x5,%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x4c(%rbp),%eax
add    $0x6,%eax
mov    %eax,-0x4c(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
cmpb   $0x0,(%rax)
je     1302 <ts_eit_add_short_event_descriptor+0x1c2>
mov    -0x30(%rbp),%rax
movsbl (%rax),%edx
mov    -0x48(%rbp),%rax
mov    -0x4c(%rbp),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    %esi,-0x4c(%rbp)
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    12c8 <ts_eit_add_short_event_descriptor+0x188>
mov    -0x38(%rbp),%edx
mov    -0x48(%rbp),%rax
mov    -0x4c(%rbp),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    %esi,-0x4c(%rbp)
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
cmpl   $0x0,-0x38(%rbp)
je     136b <ts_eit_add_short_event_descriptor+0x22b>
mov    0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
cmpb   $0x0,(%rax)
je     1366 <ts_eit_add_short_event_descriptor+0x226>
mov    -0x30(%rbp),%rax
movsbl (%rax),%edx
mov    -0x48(%rbp),%rax
mov    -0x4c(%rbp),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    %esi,-0x4c(%rbp)
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    132c <ts_eit_add_short_event_descriptor+0x1ec>
jmp    136b <ts_eit_add_short_event_descriptor+0x22b>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%ecx
mov    $0x1,%edx
mov    $0x4,%eax
cmp    $0x0,%ecx
cmovne %eax,%edx
mov    -0x1c(%rbp),%ecx
mov    -0x20(%rbp),%r8d
mov    -0x48(%rbp),%r9
mov    -0x4c(%rbp),%eax
mov    %eax,(%rsp)
call   1050 <ts_eit_add_stream@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ts_eit_add_short_event_descriptor>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %r9,%r15
mov    %r8d,%r13d
mov    %ecx,%ebx
mov    %edx,0x14(%rsp)
mov    %esi,0x1c(%rsp)
mov    %rdi,0x20(%rsp)
mov    0x60(%rsp),%rbp
xor    %r14d,%r14d
mov    $0x0,%r12d
test   %r9,%r9
je     1181 <ts_eit_add_short_event_descriptor+0x41>
mov    %r15,%rdi
call   1030 <strlen@plt>
mov    %eax,%r12d
test   %rbp,%rbp
je     1191 <ts_eit_add_short_event_descriptor+0x51>
mov    %rbp,%rdi
call   1030 <strlen@plt>
mov    %eax,%r14d
lea    (%r14,%r12,1),%esi
add    $0x7,%esi
cmp    $0x100,%esi
jl     11b5 <ts_eit_add_short_event_descriptor+0x75>
lea    0xe59(%rip),%rdi
xor    %eax,%eax
call   1060 <ts_LOGf@plt>
xor    %eax,%eax
jmp    12a9 <ts_eit_add_short_event_descriptor+0x169>
test   %r12d,%r12d
je     1226 <ts_eit_add_short_event_descriptor+0xe6>
mov    %ebx,0x18(%rsp)
mov    %r13d,%ebx
lea    (%r14,%r12,1),%r13d
mov    $0x1,%edi
call   1040 <calloc@plt>
movl   $0x4d,(%rax)
add    $0x5,%r13d
mov    %r13d,0x4(%rax)
movabs $0x7500000062,%rcx
mov    %rcx,0x8(%rax)
movl   $0x6c,0x10(%rax)
mov    %r12d,0x14(%rax)
mov    (%r15),%dl
test   %dl,%dl
je     1238 <ts_eit_add_short_event_descriptor+0xf8>
mov    $0x6,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsbl %dl,%edx
mov    %edx,(%rax,%rcx,4)
movzbl -0x5(%r15,%rcx,1),%edx
add    $0x1,%rcx
test   %dl,%dl
jne    1210 <ts_eit_add_short_event_descriptor+0xd0>
jmp    123d <ts_eit_add_short_event_descriptor+0xfd>
lea    0xe11(%rip),%rdi
xor    %eax,%eax
call   1060 <ts_LOGf@plt>
xor    %eax,%eax
jmp    12a9 <ts_eit_add_short_event_descriptor+0x169>
mov    $0x6,%ecx
mov    %ebx,%r8d
mov    0x18(%rsp),%ebx
mov    0x1c(%rsp),%esi
mov    %ecx,%edx
add    $0x1,%ecx
mov    %r14d,(%rax,%rdx,4)
test   %r14d,%r14d
je     1288 <ts_eit_add_short_event_descriptor+0x148>
mov    0x0(%rbp),%dl
test   %dl,%dl
je     1288 <ts_eit_add_short_event_descriptor+0x148>
mov    %ecx,%ecx
add    $0x1,%rbp
mov    0x20(%rsp),%rdi
nopl   0x0(%rax,%rax,1)
movsbl %dl,%edx
mov    %edx,(%rax,%rcx,4)
add    $0x1,%rcx
movzbl 0x0(%rbp),%edx
add    $0x1,%rbp
test   %dl,%dl
jne    1270 <ts_eit_add_short_event_descriptor+0x130>
jmp    128d <ts_eit_add_short_event_descriptor+0x14d>
mov    0x20(%rsp),%rdi
mov    0x14(%rsp),%ebp
xor    %edx,%edx
test   %ebp,%ebp
setne  %dl
lea    0x1(%rdx,%rdx,2),%edx
mov    %ecx,(%rsp)
mov    %ebx,%ecx
mov    %rax,%r9
call   1050 <ts_eit_add_stream@plt>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.ts_eit = type { i32 }
@.str = [62 x i8] c"EIT short event descriptor size > 255 is not supported (%d)!\0A\00"
@.str.1 = [21 x i8] c"EIT event_len == 0!\0A\00"
define i32 @ts_eit_add_short_event_descriptor(%struct.ts_eit* %0, i32 %1, i32 %2, i32 %3, i32 %4, i8* %5, i8* %6) {
%8 = alloca i32
%9 = alloca %struct.ts_eit*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i8*
%15 = alloca i8*
%16 = alloca i8*
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32*
%21 = alloca i32
store %struct.ts_eit* %0, %struct.ts_eit** %9
store i32 %1, i32* %10
store i32 %2, i32* %11
store i32 %3, i32* %12
store i32 %4, i32* %13
store i8* %5, i8** %14
store i8* %6, i8** %15
%22 = load i8*, i8** %14
%23 = icmp ne i8* %22, null
br i1 %23, label %24, label %27
24: ; preds = %7
%25 = load i8*, i8** %14
%26 = call i32 @strlen(i8* %25)
br label %28
27: ; preds = %7
br label %28
28: ; preds = %27, %24
%29 = phi i32 [ %26, %24 ], [ 0, %27 ]
store i32 %29, i32* %17
%30 = load i8*, i8** %15
%31 = icmp ne i8* %30, null
br i1 %31, label %32, label %35
32: ; preds = %28
%33 = load i8*, i8** %15
%34 = call i32 @strlen(i8* %33)
br label %36
35: ; preds = %28
br label %36
36: ; preds = %35, %32
%37 = phi i32 [ %34, %32 ], [ 0, %35 ]
store i32 %37, i32* %18
store i32 5, i32* %19
%38 = load i32, i32* %17
%39 = add nsw i32 1, %38
%40 = load i32, i32* %19
%41 = add nsw i32 %40, %39
store i32 %41, i32* %19
%42 = load i32, i32* %18
%43 = add nsw i32 1, %42
%44 = load i32, i32* %19
%45 = add nsw i32 %44, %43
store i32 %45, i32* %19
%46 = load i32, i32* %19
%47 = icmp sgt i32 %46, 255
br i1 %47, label %48, label %51
48: ; preds = %36
%49 = load i32, i32* %19
%50 = call i32 (i8*, ...) @ts_LOGf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str, i64 0, i64 0), i32 %49)
store i32 0, i32* %8
br label %153
51: ; preds = %36
%52 = load i32, i32* %17
%53 = icmp eq i32 %52, 0
br i1 %53, label %54, label %56
54: ; preds = %51
%55 = call i32 (i8*, ...) @ts_LOGf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %8
br label %153
56: ; preds = %51
%57 = load i32, i32* %19
%58 = call i32* @calloc(i32 1, i32 %57)
store i32* %58, i32** %20
store i32 0, i32* %21
%59 = load i32*, i32** %20
%60 = load i32, i32* %21
%61 = add nsw i32 %60, 0
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds i32, i32* %59, i64 %62
store i32 77, i32* %63
%64 = load i32, i32* %19
%65 = sub nsw i32 %64, 2
%66 = load i32*, i32** %20
%67 = load i32, i32* %21
%68 = add nsw i32 %67, 1
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds i32, i32* %66, i64 %69
store i32 %65, i32* %70
%71 = load i32*, i32** %20
%72 = load i32, i32* %21
%73 = add nsw i32 %72, 2
%74 = sext i32 %73 to i64
%75 = getelementptr inbounds i32, i32* %71, i64 %74
store i32 98, i32* %75
%76 = load i32*, i32** %20
%77 = load i32, i32* %21
%78 = add nsw i32 %77, 3
%79 = sext i32 %78 to i64
%80 = getelementptr inbounds i32, i32* %76, i64 %79
store i32 117, i32* %80
%81 = load i32*, i32** %20
%82 = load i32, i32* %21
%83 = add nsw i32 %82, 4
%84 = sext i32 %83 to i64
%85 = getelementptr inbounds i32, i32* %81, i64 %84
store i32 108, i32* %85
%86 = load i32, i32* %17
%87 = load i32*, i32** %20
%88 = load i32, i32* %21
%89 = add nsw i32 %88, 5
%90 = sext i32 %89 to i64
%91 = getelementptr inbounds i32, i32* %87, i64 %90
store i32 %86, i32* %91
%92 = load i32, i32* %21
%93 = add nsw i32 %92, 6
store i32 %93, i32* %21
%94 = load i8*, i8** %14
store i8* %94, i8** %16
br label %95
95: ; preds = %100, %56
%96 = load i8*, i8** %16
%97 = getelementptr inbounds i8, i8* %96, i64 0
%98 = load i8, i8* %97
%99 = icmp ne i8 %98, 0
br i1 %99, label %100, label %112
100: ; preds = %95
%101 = load i8*, i8** %16
%102 = getelementptr inbounds i8, i8* %101, i64 0
%103 = load i8, i8* %102
%104 = sext i8 %103 to i32
%105 = load i32*, i32** %20
%106 = load i32, i32* %21
%107 = add nsw i32 %106, 1
store i32 %107, i32* %21
%108 = sext i32 %106 to i64
%109 = getelementptr inbounds i32, i32* %105, i64 %108
store i32 %104, i32* %109
%110 = load i8*, i8** %16
%111 = getelementptr inbounds i8, i8* %110, i32 1
store i8* %111, i8** %16
br label %95
112: ; preds = %95
%113 = load i32, i32* %18
%114 = load i32*, i32** %20
%115 = load i32, i32* %21
%116 = add nsw i32 %115, 1
store i32 %116, i32* %21
%117 = sext i32 %115 to i64
%118 = getelementptr inbounds i32, i32* %114, i64 %117
store i32 %113, i32* %118
%119 = load i32, i32* %18
%120 = icmp ne i32 %119, 0
br i1 %120, label %121, label %141
121: ; preds = %112
%122 = load i8*, i8** %15
store i8* %122, i8** %16
br label %123
123: ; preds = %128, %121
%124 = load i8*, i8** %16
%125 = getelementptr inbounds i8, i8* %124, i64 0
%126 = load i8, i8* %125
%127 = icmp ne i8 %126, 0
br i1 %127, label %128, label %140
128: ; preds = %123
%129 = load i8*, i8** %16
%130 = getelementptr inbounds i8, i8* %129, i64 0
%131 = load i8, i8* %130
%132 = sext i8 %131 to i32
%133 = load i32*, i32** %20
%134 = load i32, i32* %21
%135 = add nsw i32 %134, 1
store i32 %135, i32* %21
%136 = sext i32 %134 to i64
%137 = getelementptr inbounds i32, i32* %133, i64 %136
store i32 %132, i32* %137
%138 = load i8*, i8** %16
%139 = getelementptr inbounds i8, i8* %138, i32 1
store i8* %139, i8** %16
br label %123
140: ; preds = %123
br label %141
141: ; preds = %140, %112
%142 = load %struct.ts_eit*, %struct.ts_eit** %9
%143 = load i32, i32* %10
%144 = load i32, i32* %11
%145 = icmp ne i32 %144, 0
%146 = zext i1 %145 to i64
%147 = select i1 %145, i32 4, i32 1
%148 = load i32, i32* %12
%149 = load i32, i32* %13
%150 = load i32*, i32** %20
%151 = load i32, i32* %21
%152 = call i32 @ts_eit_add_stream(%struct.ts_eit* %142, i32 %143, i32 %147, i32 %148, i32 %149, i32* %150, i32 %151)
store i32 %152, i32* %8
br label %153
153: ; preds = %141, %54, %48
%154 = load i32, i32* %8
ret i32 %154
}

LLVM IR (-O2):
%struct.ts_eit = type { i32 }
@.str = [62 x i8] c"EIT short event descriptor size > 255 is not supported (%d)!\0A\00"
@.str.1 = [21 x i8] c"EIT event_len == 0!\0A\00"
define i32 @ts_eit_add_short_event_descriptor(%struct.ts_eit* %0, i32 %1, i32 %2, i32 %3, i32 %4, i8* %5, i8* %6) {
%8 = icmp eq i8* %5, null
br i1 %8, label %11, label %9
9: ; preds = %7
%10 = tail call i32 @strlen(i8* %5)
br label %11
11: ; preds = %7, %9
%12 = phi i32 [ %10, %9 ], [ 0, %7 ]
%13 = icmp eq i8* %6, null
br i1 %13, label %16, label %14
14: ; preds = %11
%15 = tail call i32 @strlen(i8* %6)
br label %16
16: ; preds = %11, %14
%17 = phi i32 [ %15, %14 ], [ 0, %11 ]
%18 = add i32 %17, %12
%19 = add i32 %18, 7
%20 = icmp sgt i32 %19, 255
br i1 %20, label %21, label %23
21: ; preds = %16
%22 = tail call i32 (i8*, ...) @ts_LOGf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str, i64 0, i64 0), i32 %19)
br label %77
23: ; preds = %16
%24 = icmp eq i32 %12, 0
br i1 %24, label %25, label %27
25: ; preds = %23
%26 = tail call i32 (i8*, ...) @ts_LOGf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
br label %77
27: ; preds = %23
%28 = tail call i32* @calloc(i32 1, i32 %19)
store i32 77, i32* %28
%29 = add i32 %18, 5
%30 = getelementptr inbounds i32, i32* %28, i64 1
store i32 %29, i32* %30
%31 = getelementptr inbounds i32, i32* %28, i64 2
store i32 98, i32* %31
%32 = getelementptr inbounds i32, i32* %28, i64 3
store i32 117, i32* %32
%33 = getelementptr inbounds i32, i32* %28, i64 4
store i32 108, i32* %33
%34 = getelementptr inbounds i32, i32* %28, i64 5
store i32 %12, i32* %34
%35 = load i8, i8* %5
%36 = icmp eq i8 %35, 0
br i1 %36, label %49, label %37
37: ; preds = %27, %37
%38 = phi i64 [ %42, %37 ], [ 6, %27 ]
%39 = phi i8 [ %45, %37 ], [ %35, %27 ]
%40 = phi i8* [ %44, %37 ], [ %5, %27 ]
%41 = sext i8 %39 to i32
%42 = add nuw i64 %38, 1
%43 = getelementptr inbounds i32, i32* %28, i64 %38
store i32 %41, i32* %43
%44 = getelementptr inbounds i8, i8* %40, i64 1
%45 = load i8, i8* %44
%46 = icmp eq i8 %45, 0
br i1 %46, label %47, label %37
47: ; preds = %37
%48 = trunc i64 %42 to i32
br label %49
49: ; preds = %47, %27
%50 = phi i32 [ 6, %27 ], [ %48, %47 ]
%51 = add i32 %50, 1
%52 = zext i32 %50 to i64
%53 = getelementptr inbounds i32, i32* %28, i64 %52
store i32 %17, i32* %53
%54 = icmp eq i32 %17, 0
br i1 %54, label %72, label %55
55: ; preds = %49
%56 = load i8, i8* %6
%57 = icmp eq i8 %56, 0
br i1 %57, label %72, label %58
58: ; preds = %55
%59 = zext i32 %51 to i64
br label %60
60: ; preds = %58, %60
%61 = phi i64 [ %59, %58 ], [ %65, %60 ]
%62 = phi i8 [ %56, %58 ], [ %68, %60 ]
%63 = phi i8* [ %6, %58 ], [ %67, %60 ]
%64 = sext i8 %62 to i32
%65 = add nuw i64 %61, 1
%66 = getelementptr inbounds i32, i32* %28, i64 %61
store i32 %64, i32* %66
%67 = getelementptr inbounds i8, i8* %63, i64 1
%68 = load i8, i8* %67
%69 = icmp eq i8 %68, 0
br i1 %69, label %70, label %60
70: ; preds = %60
%71 = trunc i64 %65 to i32
br label %72
72: ; preds = %70, %55, %49
%73 = phi i32 [ %51, %49 ], [ %51, %55 ], [ %71, %70 ]
%74 = icmp eq i32 %2, 0
%75 = select i1 %74, i32 1, i32 4
%76 = tail call i32 @ts_eit_add_stream(%struct.ts_eit* %0, i32 %1, i32 %75, i32 %3, i32 %4, i32* %28, i32 %73)
br label %77
77: ; preds = %72, %25, %21
%78 = phi i32 [ 0, %21 ], [ 0, %25 ], [ %76, %72 ]
ret i32 %78
}