#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*/ FILE;

/* Variables and functions */
void *codec2_create();
int /*<<< orphan*/ codec2_decode(void *, short *, unsigned char *);
int /*<<< orphan*/ codec2_destroy(void *);
int /*<<< orphan*/ errno;
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 *, char *, char *);
int fread(unsigned char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fwrite(short *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ *stdin;
int /*<<< orphan*/ *stdout;
scalar_t__ strcmp(char *, char *);
char *strerror(int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  void *codec2;
  FILE *fin;
  FILE *fout;
  short buf[160];
  unsigned char bits[((50 + 7) / 8)];
  if (argc != 3) {
    printf("usage: %s InputBitFile OutputRawSpeechFile\n", argv[0]);
    exit(1);
  }
  if (strcmp(argv[1], "-") == 0)
    fin = stdin;
  else if ((fin = fopen(argv[1], "rb")) == NULL) {
    fprintf(stderr, "Error opening input bit file: %s: %s.\n", argv[1],
            strerror(errno));
    exit(1);
  }
  if (strcmp(argv[2], "-") == 0)
    fout = stdout;
  else if ((fout = fopen(argv[2], "wb")) == NULL) {
    fprintf(stderr, "Error opening output speech file: %s: %s.\n", argv[2],
            strerror(errno));
    exit(1);
  }
  codec2 = codec2_create();
  while (fread(bits, sizeof(char), ((50 + 7) / 8), fin) == ((50 + 7) / 8)) {
    codec2_decode(codec2, buf, bits);
    fwrite(buf, sizeof(short), 160, fout);
    if (fout == stdout)
      fflush(stdout);
    if (fin == stdin)
      fflush(stdin);
  }
  codec2_destroy(codec2);
  fclose(fin);
  fclose(fout);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1a0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     1210 <main+0x40>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xdff(%rip),%rdi
call   1070 <printf@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe0d(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    1241 <main+0x71>
mov    0x2db3(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
jmp    12ba <main+0xea>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xdde(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    12b5 <main+0xe5>
mov    0x2d6e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x184(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x180(%rbp)
mov    0x2d48(%rip),%rax
mov    (%rax),%edi
call   10f0 <strerror@plt>
mov    -0x184(%rbp),%edi
mov    -0x180(%rbp),%rdx
mov    %rax,%rcx
lea    0xd8b(%rip),%rsi
call   1090 <fprintf@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
jmp    12ba <main+0xea>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xd63(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    12eb <main+0x11b>
mov    0x2ce9(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
jmp    1364 <main+0x194>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xd5e(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
jne    135f <main+0x18f>
mov    0x2cc4(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x194(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x190(%rbp)
mov    0x2c9e(%rip),%rax
mov    (%rax),%edi
call   10f0 <strerror@plt>
mov    -0x194(%rbp),%edi
mov    -0x190(%rbp),%rdx
mov    %rax,%rcx
lea    0xd0b(%rip),%rsi
call   1090 <fprintf@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
jmp    1364 <main+0x194>
mov    $0x0,%al
call   10a0 <codec2_create@plt>
mov    %rax,-0x18(%rbp)
lea    -0x177(%rbp),%rdi
mov    -0x20(%rbp),%rcx
mov    $0x1,%esi
mov    $0x7,%edx
call   1050 <fread@plt>
cmp    $0x7,%eax
jne    140e <main+0x23e>
mov    -0x18(%rbp),%rdi
lea    -0x170(%rbp),%rsi
lea    -0x177(%rbp),%rdx
call   1040 <codec2_decode@plt>
lea    -0x170(%rbp),%rdi
mov    -0x28(%rbp),%rcx
mov    $0x2,%esi
mov    $0xa0,%edx
call   10e0 <fwrite@plt>
mov    -0x28(%rbp),%rax
mov    0x2bfa(%rip),%rcx
cmp    (%rcx),%rax
jne    13e6 <main+0x216>
mov    0x2bea(%rip),%rax
mov    (%rax),%rdi
call   10b0 <fflush@plt>
mov    -0x20(%rbp),%rax
mov    0x2bf7(%rip),%rcx
cmp    (%rcx),%rax
jne    1409 <main+0x239>
mov    0x2be7(%rip),%rax
mov    (%rax),%rdi
call   10b0 <fflush@plt>
jmp    136f <main+0x19f>
mov    -0x18(%rbp),%rdi
call   1030 <codec2_destroy@plt>
mov    -0x20(%rbp),%rdi
call   1060 <fclose@plt>
mov    -0x28(%rbp),%rdi
call   1060 <fclose@plt>
xor    %eax,%eax
add    $0x1a0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x158,%rsp
mov    %rsi,%r15
cmp    $0x3,%edi
jne    13a4 <main+0x1d4>
mov    0x8(%r15),%rdi
lea    0xe34(%rip),%rsi
call   1080 <strcmp@plt>
test   %rax,%rax
je     123e <main+0x6e>
mov    0x8(%r15),%rdi
lea    0xe21(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,%r14
test   %rax,%rax
jne    1248 <main+0x78>
mov    0x2db7(%rip),%rax
mov    (%rax),%ebx
mov    0x8(%r15),%r14
mov    0x2da2(%rip),%rax
mov    (%rax),%edi
call   10f0 <strerror@plt>
lea    0xdf5(%rip),%rsi
jmp    1297 <main+0xc7>
mov    0x2da3(%rip),%rax
mov    (%rax),%r14
mov    0x10(%r15),%rdi
lea    0xdd9(%rip),%rsi
call   1080 <strcmp@plt>
test   %rax,%rax
je     12ae <main+0xde>
mov    0x10(%r15),%rdi
lea    0xdf0(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    12b8 <main+0xe8>
mov    0x2d5c(%rip),%rax
mov    (%rax),%ebx
mov    0x10(%r15),%r14
mov    0x2d47(%rip),%rax
mov    (%rax),%edi
call   10f0 <strerror@plt>
lea    0xdc4(%rip),%rsi
mov    %ebx,%edi
mov    %r14,%rdx
mov    %rax,%rcx
call   1090 <fprintf@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
mov    0x2d13(%rip),%rax
mov    (%rax),%rbx
xor    %eax,%eax
call   10a0 <codec2_create@plt>
mov    %rax,%r15
lea    0x9(%rsp),%rdi
mov    $0x1,%esi
mov    $0x7,%edx
mov    %r14,%rcx
call   1050 <fread@plt>
cmp    $0x7,%eax
jne    1378 <main+0x1a8>
lea    0x10(%rsp),%r12
lea    0x9(%rsp),%r13
mov    0x2cf5(%rip),%rbp
jmp    131a <main+0x14a>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r13,%rdi
mov    $0x1,%esi
mov    $0x7,%edx
mov    %r14,%rcx
call   1050 <fread@plt>
cmp    $0x7,%eax
jne    1378 <main+0x1a8>
mov    %r15,%rdi
mov    %r12,%rsi
mov    %r13,%rdx
call   1040 <codec2_decode@plt>
mov    %r12,%rdi
mov    $0x2,%esi
mov    $0xa0,%edx
mov    %rbx,%rcx
call   10e0 <fwrite@plt>
mov    0x2c84(%rip),%rax
cmp    (%rax),%rbx
je     1360 <main+0x190>
cmp    0x0(%rbp),%r14
jne    1300 <main+0x130>
jmp    136e <main+0x19e>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   10b0 <fflush@plt>
cmp    0x0(%rbp),%r14
jne    1300 <main+0x130>
mov    %r14,%rdi
call   10b0 <fflush@plt>
jmp    1300 <main+0x130>
mov    %r15,%rdi
call   1030 <codec2_destroy@plt>
mov    %r14,%rdi
call   1060 <fclose@plt>
mov    %rbx,%rdi
call   1060 <fclose@plt>
xor    %eax,%eax
add    $0x158,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    (%r15),%rsi
lea    0xc52(%rip),%rdi
call   1070 <printf@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>

LLVM IR (-O0):
@.str = [44 x i8] c"usage: %s InputBitFile OutputRawSpeechFile\0A\00"
@.str.1 = [2 x i8] c"-\00"
@stdin = global i32* null
@.str.2 = [3 x i8] c"rb\00"
@stderr = global i32 0
@.str.3 = [39 x i8] c"Error opening input bit file: %s: %s.\0A\00"
@errno = global i32 0
@stdout = global i32* null
@.str.4 = [3 x i8] c"wb\00"
@.str.5 = [43 x i8] c"Error opening output speech file: %s: %s.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca [160 x i16]
%10 = alloca [7 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = load i32, i32* %4
%12 = icmp ne i32 %11, 3
br i1 %12, label %13, label %19
13: ; preds = %2
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 0
%16 = load i8*, i8** %15
%17 = call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i8* %16)
%18 = call i32 @exit(i32 1)
unreachable
19: ; preds = %2
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 1
%22 = load i8*, i8** %21
%23 = call i64 @strcmp(i8* %22, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%24 = icmp eq i64 %23, 0
br i1 %24, label %25, label %27
25: ; preds = %19
%26 = load i32*, i32** @stdin
store i32* %26, i32** %7
br label %43
27: ; preds = %19
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i64 1
%30 = load i8*, i8** %29
%31 = call i32* @fopen(i8* %30, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
store i32* %31, i32** %7
%32 = icmp eq i32* %31, null
br i1 %32, label %33, label %42
33: ; preds = %27
%34 = load i32, i32* @stderr
%35 = load i8**, i8*** %5
%36 = getelementptr inbounds i8*, i8** %35, i64 1
%37 = load i8*, i8** %36
%38 = load i32, i32* @errno
%39 = call i8* @strerror(i32 %38)
%40 = call i32 @fprintf(i32 %34, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0), i8* %37, i8* %39)
%41 = call i32 @exit(i32 1)
unreachable
42: ; preds = %27
br label %43
43: ; preds = %42, %25
%44 = load i8**, i8*** %5
%45 = getelementptr inbounds i8*, i8** %44, i64 2
%46 = load i8*, i8** %45
%47 = call i64 @strcmp(i8* %46, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%48 = icmp eq i64 %47, 0
br i1 %48, label %49, label %51
49: ; preds = %43
%50 = load i32*, i32** @stdout
store i32* %50, i32** %8
br label %67
51: ; preds = %43
%52 = load i8**, i8*** %5
%53 = getelementptr inbounds i8*, i8** %52, i64 2
%54 = load i8*, i8** %53
%55 = call i32* @fopen(i8* %54, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
store i32* %55, i32** %8
%56 = icmp eq i32* %55, null
br i1 %56, label %57, label %66
57: ; preds = %51
%58 = load i32, i32* @stderr
%59 = load i8**, i8*** %5
%60 = getelementptr inbounds i8*, i8** %59, i64 2
%61 = load i8*, i8** %60
%62 = load i32, i32* @errno
%63 = call i8* @strerror(i32 %62)
%64 = call i32 @fprintf(i32 %58, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.5, i64 0, i64 0), i8* %61, i8* %63)
%65 = call i32 @exit(i32 1)
unreachable
66: ; preds = %51
br label %67
67: ; preds = %66, %49
%68 = call i8* (...) @codec2_create()
store i8* %68, i8** %6
br label %69
69: ; preds = %95, %67
%70 = getelementptr inbounds [7 x i8], [7 x i8]* %10, i64 0, i64 0
%71 = load i32*, i32** %7
%72 = call i32 @fread(i8* %70, i32 1, i32 7, i32* %71)
%73 = icmp eq i32 %72, 7
br i1 %73, label %74, label %96
74: ; preds = %69
%75 = load i8*, i8** %6
%76 = getelementptr inbounds [160 x i16], [160 x i16]* %9, i64 0, i64 0
%77 = getelementptr inbounds [7 x i8], [7 x i8]* %10, i64 0, i64 0
%78 = call i32 @codec2_decode(i8* %75, i16* %76, i8* %77)
%79 = getelementptr inbounds [160 x i16], [160 x i16]* %9, i64 0, i64 0
%80 = load i32*, i32** %8
%81 = call i32 @fwrite(i16* %79, i32 2, i32 160, i32* %80)
%82 = load i32*, i32** %8
%83 = load i32*, i32** @stdout
%84 = icmp eq i32* %82, %83
br i1 %84, label %85, label %88
85: ; preds = %74
%86 = load i32*, i32** @stdout
%87 = call i32 @fflush(i32* %86)
br label %88
88: ; preds = %85, %74
%89 = load i32*, i32** %7
%90 = load i32*, i32** @stdin
%91 = icmp eq i32* %89, %90
br i1 %91, label %92, label %95
92: ; preds = %88
%93 = load i32*, i32** @stdin
%94 = call i32 @fflush(i32* %93)
br label %95
95: ; preds = %92, %88
br label %69
96: ; preds = %69
%97 = load i8*, i8** %6
%98 = call i32 @codec2_destroy(i8* %97)
%99 = load i32*, i32** %7
%100 = call i32 @fclose(i32* %99)
%101 = load i32*, i32** %8
%102 = call i32 @fclose(i32* %101)
ret i32 0
}

LLVM IR (-O2):
@.str = [44 x i8] c"usage: %s InputBitFile OutputRawSpeechFile\0A\00"
@.str.1 = [2 x i8] c"-\00"
@stdin = global i32* null
@.str.2 = [3 x i8] c"rb\00"
@stderr = global i32 0
@.str.3 = [39 x i8] c"Error opening input bit file: %s: %s.\0A\00"
@errno = global i32 0
@stdout = global i32* null
@.str.4 = [3 x i8] c"wb\00"
@.str.5 = [43 x i8] c"Error opening output speech file: %s: %s.\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [160 x i16]
%4 = alloca [7 x i8]
%5 = bitcast [160 x i16]* %3 to i8*
%6 = getelementptr inbounds [7 x i8], [7 x i8]* %4, i64 0, i64 0
%7 = icmp eq i32 %0, 3
br i1 %7, label %12, label %8
8: ; preds = %2
%9 = load i8*, i8** %1
%10 = tail call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i8* %9)
%11 = tail call i32 @exit(i32 1)
unreachable
12: ; preds = %2
%13 = getelementptr inbounds i8*, i8** %1, i64 1
%14 = load i8*, i8** %13
%15 = tail call i64 @strcmp(i8* %14, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %19
17: ; preds = %12
%18 = load i32*, i32** @stdin
br label %30
19: ; preds = %12
%20 = load i8*, i8** %13
%21 = tail call i32* @fopen(i8* %20, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%22 = icmp eq i32* %21, null
br i1 %22, label %23, label %30
23: ; preds = %19
%24 = load i32, i32* @stderr
%25 = load i8*, i8** %13
%26 = load i32, i32* @errno
%27 = tail call i8* @strerror(i32 %26)
%28 = tail call i32 @fprintf(i32 %24, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0), i8* %25, i8* %27)
%29 = tail call i32 @exit(i32 1)
unreachable
30: ; preds = %19, %17
%31 = phi i32* [ %18, %17 ], [ %21, %19 ]
%32 = getelementptr inbounds i8*, i8** %1, i64 2
%33 = load i8*, i8** %32
%34 = tail call i64 @strcmp(i8* %33, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%35 = icmp eq i64 %34, 0
br i1 %35, label %36, label %38
36: ; preds = %30
%37 = load i32*, i32** @stdout
br label %49
38: ; preds = %30
%39 = load i8*, i8** %32
%40 = tail call i32* @fopen(i8* %39, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%41 = icmp eq i32* %40, null
br i1 %41, label %42, label %49
42: ; preds = %38
%43 = load i32, i32* @stderr
%44 = load i8*, i8** %32
%45 = load i32, i32* @errno
%46 = tail call i8* @strerror(i32 %45)
%47 = tail call i32 @fprintf(i32 %43, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.5, i64 0, i64 0), i8* %44, i8* %46)
%48 = tail call i32 @exit(i32 1)
unreachable
49: ; preds = %38, %36
%50 = phi i32* [ %37, %36 ], [ %40, %38 ]
%51 = tail call i8* (...) @codec2_create()
%52 = call i32 @fread(i8* %6, i32 1, i32 7, i32* %31)
%53 = icmp eq i32 %52, 7
br i1 %53, label %54, label %71
54: ; preds = %49
%55 = getelementptr inbounds [160 x i16], [160 x i16]* %3, i64 0, i64 0
br label %56
56: ; preds = %54, %68
%57 = call i32 @codec2_decode(i8* %51, i16* %55, i8* %6)
%58 = call i32 @fwrite(i16* %55, i32 2, i32 160, i32* %50)
%59 = load i32*, i32** @stdout
%60 = icmp eq i32* %50, %59
br i1 %60, label %61, label %63
61: ; preds = %56
%62 = call i32 @fflush(i32* %50)
br label %63
63: ; preds = %61, %56
%64 = load i32*, i32** @stdin
%65 = icmp eq i32* %31, %64
br i1 %65, label %66, label %68
66: ; preds = %63
%67 = call i32 @fflush(i32* %31)
br label %68
68: ; preds = %66, %63
%69 = call i32 @fread(i8* %6, i32 1, i32 7, i32* %31)
%70 = icmp eq i32 %69, 7
br i1 %70, label %56, label %71
71: ; preds = %68, %49
%72 = call i32 @codec2_destroy(i8* %51)
%73 = call i32 @fclose(i32* %31)
%74 = call i32 @fclose(i32* %50)
ret i32 0
}