#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;
struct freedv_vhf_deframer {
  int dummy;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ fflush(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int fread(int /*<<< orphan*/ *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ free(int /*<<< orphan*/ *);
struct freedv_vhf_deframer *fvhff_create_deframer(int, int /*<<< orphan*/);
int /*<<< orphan*/ fvhff_destroy_deframer(struct freedv_vhf_deframer *);
int /*<<< orphan*/ fvhff_frame_bits(int, int /*<<< orphan*/ *,
                                    int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                                    int /*<<< orphan*/ *);
int fvhff_get_codec2_size(struct freedv_vhf_deframer *);
int fvhff_get_frame_size(struct freedv_vhf_deframer *);
int /*<<< orphan*/ fwrite(int /*<<< orphan*/ *, int, int, int /*<<< orphan*/ *);
scalar_t__ malloc(int);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ *stdin;
int /*<<< orphan*/ *stdout;
scalar_t__ strcmp(char *, char *);
int main(int argc, char *argv[]) {
  struct freedv_vhf_deframer *deframer;
  FILE *fin, *fout;
  uint8_t *bitbuf;
  uint8_t *c2buf;
  int frame_fmt = 0;
  int fsize, c2size;
  if (argc < 3) {
    fprintf(stderr, "usage: %s (A|B) InpuC2File OutputOneBitPerCharFile\n",
            argv[0]);
    exit(1);
  }
  if (strcmp(argv[1], "A") == 0) {
    frame_fmt = 1;
  } else if (strcmp(argv[1], "B") == 0) {
    frame_fmt = 2;
  } else {
    fprintf(stderr, "usage: %s (A|B) InpuC2File OutputOneBitPerCharFile\n",
            argv[0]);
    exit(1);
  }
  if (strcmp(argv[2], "-") == 0) {
    fin = stdin;
  } else {
    fin = fopen(argv[2], "r");
  }
  if (strcmp(argv[3], "-") == 0) {
    fout = stdout;
  } else {
    fout = fopen(argv[3], "w");
  }
  deframer = fvhff_create_deframer(frame_fmt, 0);
  if (fin == NULL || fout == NULL || deframer == NULL) {
    fprintf(stderr, "Couldn't open test vector files\n");
    goto cleanup;
  }
  c2size = fvhff_get_codec2_size(deframer);
  fsize = fvhff_get_frame_size(deframer);
  bitbuf = (uint8_t *)malloc(sizeof(uint8_t) * fsize);
  c2buf = (uint8_t *)malloc(sizeof(uint8_t) * c2size);
  while (fread(c2buf, sizeof(uint8_t), c2size, fin) == c2size) {
    fvhff_frame_bits(frame_fmt, bitbuf, c2buf, NULL, NULL);
    fwrite(bitbuf, sizeof(uint8_t), fsize, fout);
    if (fin == stdin || fout == stdin) {
      fflush(fin);
      fflush(fout);
    }
  }
  free(bitbuf);
  free(c2buf);
cleanup:
  fclose(fin);
  fclose(fout);
  fvhff_destroy_deframer(deframer);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x3c(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    123f <main+0x4f>
mov    0x2dba(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xdd2(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xde6(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
jne    1269 <main+0x79>
movl   $0x1,-0x3c(%rbp)
jmp    12c0 <main+0xd0>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xdbe(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
jne    1293 <main+0xa3>
movl   $0x2,-0x3c(%rbp)
jmp    12bb <main+0xcb>
mov    0x2d3e(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xd56(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
jmp    12c0 <main+0xd0>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xd69(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
jne    12f1 <main+0x101>
mov    0x2d03(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
jmp    1309 <main+0x119>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xd3a(%rip),%rsi
call   10d0 <fopen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
lea    0xd20(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
jne    133a <main+0x14a>
mov    0x2ca2(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
jmp    1352 <main+0x162>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
lea    0xcf3(%rip),%rsi
call   10d0 <fopen@plt>
mov    %rax,-0x28(%rbp)
mov    -0x3c(%rbp),%edi
xor    %esi,%esi
call   10e0 <fvhff_create_deframer@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     1381 <main+0x191>
cmpq   $0x0,-0x28(%rbp)
je     1381 <main+0x191>
cmpq   $0x0,-0x18(%rbp)
jne    139d <main+0x1ad>
mov    0x2c50(%rip),%rax
mov    (%rax),%edi
lea    0xcad(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
jmp    1477 <main+0x287>
mov    -0x18(%rbp),%rdi
call   1060 <fvhff_get_codec2_size@plt>
mov    %eax,-0x44(%rbp)
mov    -0x18(%rbp),%rdi
call   1110 <fvhff_get_frame_size@plt>
mov    %eax,-0x40(%rbp)
movslq -0x40(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   10b0 <malloc@plt>
mov    %rax,-0x30(%rbp)
movslq -0x44(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   10b0 <malloc@plt>
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rdi
mov    -0x44(%rbp),%edx
mov    -0x20(%rbp),%rcx
mov    $0x4,%esi
call   1040 <fread@plt>
cmp    -0x44(%rbp),%eax
jne    1465 <main+0x275>
mov    -0x3c(%rbp),%edi
mov    -0x30(%rbp),%rsi
mov    -0x38(%rbp),%rdx
xor    %eax,%eax
mov    %eax,%r8d
mov    %r8,%rcx
call   1070 <fvhff_frame_bits@plt>
mov    -0x30(%rbp),%rdi
mov    -0x40(%rbp),%edx
mov    -0x28(%rbp),%rcx
mov    $0x4,%esi
call   1100 <fwrite@plt>
mov    -0x20(%rbp),%rax
mov    0x2bb7(%rip),%rcx
cmp    (%rcx),%rax
je     144e <main+0x25e>
mov    -0x28(%rbp),%rax
mov    0x2ba3(%rip),%rcx
cmp    (%rcx),%rax
jne    1460 <main+0x270>
mov    -0x20(%rbp),%rdi
call   10c0 <fflush@plt>
mov    -0x28(%rbp),%rdi
call   10c0 <fflush@plt>
jmp    13db <main+0x1eb>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
mov    -0x20(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x28(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x18(%rbp),%rdi
call   1080 <fvhff_destroy_deframer@plt>
xor    %edi,%edi
call   10f0 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%rbx
cmp    $0x2,%edi
jg     122a <main+0x3a>
mov    0x2dcb(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xde7(%rip),%rsi
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
mov    0x8(%rbx),%rdi
lea    0xdff(%rip),%rsi
call   1090 <strcmp@plt>
movl   $0x1,0xc(%rsp)
test   %rax,%rax
je     1264 <main+0x74>
mov    0x8(%rbx),%rdi
lea    0xde4(%rip),%rsi
call   1090 <strcmp@plt>
movl   $0x2,0xc(%rsp)
test   %rax,%rax
jne    1206 <main+0x16>
mov    0x10(%rbx),%rdi
lea    0xdc9(%rip),%rsi
call   1090 <strcmp@plt>
test   %rax,%rax
jne    1285 <main+0x95>
mov    0x2d68(%rip),%rax
mov    (%rax),%r12
jmp    1298 <main+0xa8>
mov    0x10(%rbx),%rdi
lea    0xdaa(%rip),%rsi
call   10d0 <fopen@plt>
mov    %rax,%r12
mov    0x18(%rbx),%rdi
lea    0xd95(%rip),%rsi
call   1090 <strcmp@plt>
test   %rax,%rax
jne    12b9 <main+0xc9>
mov    0x2d1c(%rip),%rax
mov    (%rax),%rbp
jmp    12cc <main+0xdc>
mov    0x18(%rbx),%rdi
lea    0xd78(%rip),%rsi
call   10d0 <fopen@plt>
mov    %rax,%rbp
mov    0xc(%rsp),%edi
xor    %esi,%esi
call   10e0 <fvhff_create_deframer@plt>
mov    %rax,%r14
test   %r12,%r12
je     13a3 <main+0x1b3>
test   %rbp,%rbp
je     13a3 <main+0x1b3>
test   %r14,%r14
je     13a3 <main+0x1b3>
mov    %r14,%rdi
call   1060 <fvhff_get_codec2_size@plt>
mov    %eax,%ebx
mov    %r14,0x10(%rsp)
mov    %r14,%rdi
call   1110 <fvhff_get_frame_size@plt>
mov    %eax,%r13d
lea    0x0(,%r13,4),%edi
call   10b0 <malloc@plt>
mov    %rax,%r15
lea    0x0(,%rbx,4),%edi
call   10b0 <malloc@plt>
mov    %rax,%r14
mov    %rax,%rdi
jmp    1353 <main+0x163>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r12,%rdi
call   10c0 <fflush@plt>
mov    %rbp,%rdi
call   10c0 <fflush@plt>
mov    %r14,%rdi
mov    $0x4,%esi
mov    %ebx,%edx
mov    %r12,%rcx
call   1040 <fread@plt>
cmp    %ebx,%eax
jne    13bc <main+0x1cc>
mov    0xc(%rsp),%edi
mov    %r15,%rsi
mov    %r14,%rdx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1070 <fvhff_frame_bits@plt>
mov    %r15,%rdi
mov    $0x4,%esi
mov    %r13d,%edx
mov    %rbp,%rcx
call   1100 <fwrite@plt>
mov    0x2c54(%rip),%rax
mov    (%rax),%rax
cmp    %rax,%r12
je     1340 <main+0x150>
cmp    %rax,%rbp
jne    1350 <main+0x160>
jmp    1340 <main+0x150>
mov    0x2c2e(%rip),%rax
mov    (%rax),%edi
lea    0xc8b(%rip),%rsi
xor    %eax,%eax
call   10a0 <fprintf@plt>
jmp    13d1 <main+0x1e1>
mov    %r15,%rdi
call   1030 <free@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    0x10(%rsp),%r14
mov    %r12,%rdi
call   1050 <fclose@plt>
mov    %rbp,%rdi
call   1050 <fclose@plt>
mov    %r14,%rdi
call   1080 <fvhff_destroy_deframer@plt>
xor    %edi,%edi
call   10f0 <exit@plt>

LLVM IR (-O0):
%struct.freedv_vhf_deframer = type { i32 }
@stderr = global i32 0
@.str = [52 x i8] c"usage: %s (A|B) InpuC2File OutputOneBitPerCharFile\0A\00"
@.str.1 = [2 x i8] c"A\00"
@.str.2 = [2 x i8] c"B\00"
@.str.3 = [2 x i8] c"-\00"
@stdin = global i32* null
@.str.4 = [2 x i8] c"r\00"
@stdout = global i32* null
@.str.5 = [2 x i8] c"w\00"
@.str.6 = [33 x i8] c"Couldn't open test vector files\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.freedv_vhf_deframer*
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca i32*
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %11
%14 = load i32, i32* %4
%15 = icmp slt i32 %14, 3
br i1 %15, label %16, label %23
16: ; preds = %2
%17 = load i32, i32* @stderr
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 0
%20 = load i8*, i8** %19
%21 = call i32 (i32, i8*, ...) @fprintf(i32 %17, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0), i8* %20)
%22 = call i32 @exit(i32 1)
unreachable
23: ; preds = %2
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 1
%26 = load i8*, i8** %25
%27 = call i64 @strcmp(i8* %26, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%28 = icmp eq i64 %27, 0
br i1 %28, label %29, label %30
29: ; preds = %23
store i32 1, i32* %11
br label %45
30: ; preds = %23
%31 = load i8**, i8*** %5
%32 = getelementptr inbounds i8*, i8** %31, i64 1
%33 = load i8*, i8** %32
%34 = call i64 @strcmp(i8* %33, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%35 = icmp eq i64 %34, 0
br i1 %35, label %36, label %37
36: ; preds = %30
store i32 2, i32* %11
br label %44
37: ; preds = %30
%38 = load i32, i32* @stderr
%39 = load i8**, i8*** %5
%40 = getelementptr inbounds i8*, i8** %39, i64 0
%41 = load i8*, i8** %40
%42 = call i32 (i32, i8*, ...) @fprintf(i32 %38, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0), i8* %41)
%43 = call i32 @exit(i32 1)
unreachable
44: ; preds = %36
br label %45
45: ; preds = %44, %29
%46 = load i8**, i8*** %5
%47 = getelementptr inbounds i8*, i8** %46, i64 2
%48 = load i8*, i8** %47
%49 = call i64 @strcmp(i8* %48, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%50 = icmp eq i64 %49, 0
br i1 %50, label %51, label %53
51: ; preds = %45
%52 = load i32*, i32** @stdin
store i32* %52, i32** %7
br label %58
53: ; preds = %45
%54 = load i8**, i8*** %5
%55 = getelementptr inbounds i8*, i8** %54, i64 2
%56 = load i8*, i8** %55
%57 = call i32* @fopen(i8* %56, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
store i32* %57, i32** %7
br label %58
58: ; preds = %53, %51
%59 = load i8**, i8*** %5
%60 = getelementptr inbounds i8*, i8** %59, i64 3
%61 = load i8*, i8** %60
%62 = call i64 @strcmp(i8* %61, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%63 = icmp eq i64 %62, 0
br i1 %63, label %64, label %66
64: ; preds = %58
%65 = load i32*, i32** @stdout
store i32* %65, i32** %8
br label %71
66: ; preds = %58
%67 = load i8**, i8*** %5
%68 = getelementptr inbounds i8*, i8** %67, i64 3
%69 = load i8*, i8** %68
%70 = call i32* @fopen(i8* %69, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
store i32* %70, i32** %8
br label %71
71: ; preds = %66, %64
%72 = load i32, i32* %11
%73 = call %struct.freedv_vhf_deframer* @fvhff_create_deframer(i32 %72, i32 0)
store %struct.freedv_vhf_deframer* %73, %struct.freedv_vhf_deframer** %6
%74 = load i32*, i32** %7
%75 = icmp eq i32* %74, null
br i1 %75, label %82, label %76
76: ; preds = %71
%77 = load i32*, i32** %8
%78 = icmp eq i32* %77, null
br i1 %78, label %82, label %79
79: ; preds = %76
%80 = load %struct.freedv_vhf_deframer*, %struct.freedv_vhf_deframer** %6
%81 = icmp eq %struct.freedv_vhf_deframer* %80, null
br i1 %81, label %82, label %85
82: ; preds = %79, %76, %71
%83 = load i32, i32* @stderr
%84 = call i32 (i32, i8*, ...) @fprintf(i32 %83, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.6, i64 0, i64 0))
br label %136
85: ; preds = %79
%86 = load %struct.freedv_vhf_deframer*, %struct.freedv_vhf_deframer** %6
%87 = call i32 @fvhff_get_codec2_size(%struct.freedv_vhf_deframer* %86)
store i32 %87, i32* %13
%88 = load %struct.freedv_vhf_deframer*, %struct.freedv_vhf_deframer** %6
%89 = call i32 @fvhff_get_frame_size(%struct.freedv_vhf_deframer* %88)
store i32 %89, i32* %12
%90 = load i32, i32* %12
%91 = sext i32 %90 to i64
%92 = mul i64 4, %91
%93 = trunc i64 %92 to i32
%94 = call i64 @malloc(i32 %93)
%95 = inttoptr i64 %94 to i32*
store i32* %95, i32** %9
%96 = load i32, i32* %13
%97 = sext i32 %96 to i64
%98 = mul i64 4, %97
%99 = trunc i64 %98 to i32
%100 = call i64 @malloc(i32 %99)
%101 = inttoptr i64 %100 to i32*
store i32* %101, i32** %10
br label %102
102: ; preds = %130, %85
%103 = load i32*, i32** %10
%104 = load i32, i32* %13
%105 = load i32*, i32** %7
%106 = call i32 @fread(i32* %103, i32 4, i32 %104, i32* %105)
%107 = load i32, i32* %13
%108 = icmp eq i32 %106, %107
br i1 %108, label %109, label %131
109: ; preds = %102
%110 = load i32, i32* %11
%111 = load i32*, i32** %9
%112 = load i32*, i32** %10
%113 = call i32 @fvhff_frame_bits(i32 %110, i32* %111, i32* %112, i32* null, i32* null)
%114 = load i32*, i32** %9
%115 = load i32, i32* %12
%116 = load i32*, i32** %8
%117 = call i32 @fwrite(i32* %114, i32 4, i32 %115, i32* %116)
%118 = load i32*, i32** %7
%119 = load i32*, i32** @stdin
%120 = icmp eq i32* %118, %119
br i1 %120, label %125, label %121
121: ; preds = %109
%122 = load i32*, i32** %8
%123 = load i32*, i32** @stdin
%124 = icmp eq i32* %122, %123
br i1 %124, label %125, label %130
125: ; preds = %121, %109
%126 = load i32*, i32** %7
%127 = call i32 @fflush(i32* %126)
%128 = load i32*, i32** %8
%129 = call i32 @fflush(i32* %128)
br label %130
130: ; preds = %125, %121
br label %102
131: ; preds = %102
%132 = load i32*, i32** %9
%133 = call i32 @free(i32* %132)
%134 = load i32*, i32** %10
%135 = call i32 @free(i32* %134)
br label %136
136: ; preds = %131, %82
%137 = load i32*, i32** %7
%138 = call i32 @fclose(i32* %137)
%139 = load i32*, i32** %8
%140 = call i32 @fclose(i32* %139)
%141 = load %struct.freedv_vhf_deframer*, %struct.freedv_vhf_deframer** %6
%142 = call i32 @fvhff_destroy_deframer(%struct.freedv_vhf_deframer* %141)
%143 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
%struct.freedv_vhf_deframer = type { i32 }
@stderr = global i32 0
@.str = [52 x i8] c"usage: %s (A|B) InpuC2File OutputOneBitPerCharFile\0A\00"
@.str.1 = [2 x i8] c"A\00"
@.str.2 = [2 x i8] c"B\00"
@.str.3 = [2 x i8] c"-\00"
@stdin = global i32* null
@.str.4 = [2 x i8] c"r\00"
@stdout = global i32* null
@.str.5 = [2 x i8] c"w\00"
@.str.6 = [33 x i8] c"Couldn't open test vector files\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 3
br i1 %3, label %4, label %9
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = load i8*, i8** %1
%7 = tail call i32 (i32, i8*, ...) @fprintf(i32 %5, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = tail call i32 @exit(i32 1)
unreachable
9: ; preds = %2
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = tail call i64 @strcmp(i8* %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%13 = icmp eq i64 %12, 0
br i1 %13, label %23, label %14
14: ; preds = %9
%15 = load i8*, i8** %10
%16 = tail call i64 @strcmp(i8* %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%17 = icmp eq i64 %16, 0
br i1 %17, label %23, label %18
18: ; preds = %14
%19 = load i32, i32* @stderr
%20 = load i8*, i8** %1
%21 = tail call i32 (i32, i8*, ...) @fprintf(i32 %19, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0), i8* %20)
%22 = tail call i32 @exit(i32 1)
unreachable
23: ; preds = %14, %9
%24 = phi i32 [ 1, %9 ], [ 2, %14 ]
%25 = getelementptr inbounds i8*, i8** %1, i64 2
%26 = load i8*, i8** %25
%27 = tail call i64 @strcmp(i8* %26, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%28 = icmp eq i64 %27, 0
br i1 %28, label %29, label %31
29: ; preds = %23
%30 = load i32*, i32** @stdin
br label %34
31: ; preds = %23
%32 = load i8*, i8** %25
%33 = tail call i32* @fopen(i8* %32, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %34
34: ; preds = %31, %29
%35 = phi i32* [ %30, %29 ], [ %33, %31 ]
%36 = getelementptr inbounds i8*, i8** %1, i64 3
%37 = load i8*, i8** %36
%38 = tail call i64 @strcmp(i8* %37, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%39 = icmp eq i64 %38, 0
br i1 %39, label %40, label %42
40: ; preds = %34
%41 = load i32*, i32** @stdout
br label %45
42: ; preds = %34
%43 = load i8*, i8** %36
%44 = tail call i32* @fopen(i8* %43, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %45
45: ; preds = %42, %40
%46 = phi i32* [ %41, %40 ], [ %44, %42 ]
%47 = tail call %struct.freedv_vhf_deframer* @fvhff_create_deframer(i32 %24, i32 0)
%48 = icmp eq i32* %35, null
%49 = icmp eq i32* %46, null
%50 = select i1 %48, i1 true, i1 %49
%51 = icmp eq %struct.freedv_vhf_deframer* %47, null
%52 = select i1 %50, i1 true, i1 %51
br i1 %52, label %53, label %56
53: ; preds = %45
%54 = load i32, i32* @stderr
%55 = tail call i32 (i32, i8*, ...) @fprintf(i32 %54, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.6, i64 0, i64 0))
br label %83
56: ; preds = %45
%57 = tail call i32 @fvhff_get_codec2_size(%struct.freedv_vhf_deframer* %47)
%58 = tail call i32 @fvhff_get_frame_size(%struct.freedv_vhf_deframer* %47)
%59 = shl i32 %58, 2
%60 = tail call i64 @malloc(i32 %59)
%61 = inttoptr i64 %60 to i32*
%62 = shl i32 %57, 2
%63 = tail call i64 @malloc(i32 %62)
%64 = inttoptr i64 %63 to i32*
%65 = tail call i32 @fread(i32* %64, i32 4, i32 %57, i32* %35)
%66 = icmp eq i32 %65, %57
br i1 %66, label %67, label %80
67: ; preds = %56, %77
%68 = tail call i32 @fvhff_frame_bits(i32 %24, i32* %61, i32* %64, i32* null, i32* null)
%69 = tail call i32 @fwrite(i32* %61, i32 4, i32 %58, i32* %46)
%70 = load i32*, i32** @stdin
%71 = icmp eq i32* %35, %70
%72 = icmp eq i32* %46, %70
%73 = select i1 %71, i1 true, i1 %72
br i1 %73, label %74, label %77
74: ; preds = %67
%75 = tail call i32 @fflush(i32* %35)
%76 = tail call i32 @fflush(i32* %46)
br label %77
77: ; preds = %67, %74
%78 = tail call i32 @fread(i32* %64, i32 4, i32 %57, i32* %35)
%79 = icmp eq i32 %78, %57
br i1 %79, label %67, label %80
80: ; preds = %77, %56
%81 = tail call i32 @free(i32* %61)
%82 = tail call i32 @free(i32* %64)
br label %83
83: ; preds = %80, %53
%84 = tail call i32 @fclose(i32* %35)
%85 = tail call i32 @fclose(i32* %46)
%86 = tail call i32 @fvhff_destroy_deframer(%struct.freedv_vhf_deframer* %47)
%87 = tail call i32 @exit(i32 0)
unreachable
}