#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 short uint8_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/);
short atoi(char *);
int /*<<< orphan*/ display_help();
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
short fread(short *, int, short, int /*<<< orphan*/ *);
int /*<<< orphan*/ freq_shift_complex_buf(short *, short, int *, int *);
int /*<<< orphan*/ fwrite(short *, int, int, int /*<<< orphan*/ *);
int getopt(int, char **, char *);
int /*<<< orphan*/ *stdin;
int /*<<< orphan*/ *stdout;
scalar_t__ strcmp(char *, char *);
int main(int argc, char *argv[]) {
  FILE *fin, *fout;
  short dec;
  int lo_i[3], lo_q[3];
  if (argc < 3) {
    display_help();
    exit(1);
  }
  if (strcmp(argv[1], "-") == 0)
    fin = stdin;
  else
    fin = fopen(argv[1], "rb");
  assert(fin != NULL);
  if (strcmp(argv[2], "-") == 0)
    fout = stdout;
  else
    fout = fopen(argv[2], "wb");
  assert(fout != NULL);
  dec = atoi(argv[3]);
  int channels = 1;
  int freq_shift = 0;
  lo_i[0] = -1;
  lo_i[1] = 0;
  lo_q[0] = 0;
  lo_q[1] = -1;
  int opt;
  int format = 0;
  while ((opt = getopt(argc, argv, "cdf")) != -1) {
    switch (opt) {
    case 'c':
      channels = 2;
      break;
    case 'd':
      channels = 2;
      format = 1;
      break;
    case 'f':
      freq_shift = 1;
      break;
    default:
      display_help();
      exit(1);
    }
  }
  if (format == 0) {
    short buf[dec * channels];
    while (fread(buf, sizeof(short) * channels, dec, fin) == dec) {
      if (freq_shift)
        freq_shift_complex_buf(buf, dec * channels, lo_i, lo_q);
      exit(0);
      fwrite(buf, sizeof(short), channels, fout);
    }
  } else {
    uint8_t inbuf[dec * channels];
    short outbuf[dec * channels];
    short sam, i;
    while (fread(inbuf, sizeof(uint8_t) * channels, dec, fin) == dec) {
      for (i = 0; i < dec * channels; i++) {
        sam = (short)inbuf[i];
        sam <<= 8;
        outbuf[i] = sam;
      }
      if (freq_shift)
        freq_shift_complex_buf(outbuf, dec * channels, lo_i, lo_q);
      fwrite(outbuf, sizeof(short), channels, fout);
    }
  }
  fclose(fout);
  fclose(fin);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    11e4 <main+0x34>
mov    $0x0,%al
call   1060 <display_help@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe0d(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    1215 <main+0x65>
mov    0x2ddf(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
jmp    122d <main+0x7d>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xdde(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xdb2(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    1270 <main+0xc0>
mov    0x2d74(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
jmp    1288 <main+0xd8>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xd86(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   10b0 <atoi@plt>
mov    %ax,-0x22(%rbp)
movl   $0x1,-0x40(%rbp)
movl   $0x0,-0x44(%rbp)
movl   $0xffffffff,-0x30(%rbp)
movl   $0x0,-0x2c(%rbp)
movl   $0x0,-0x3c(%rbp)
movl   $0xffffffff,-0x38(%rbp)
movl   $0x0,-0x4c(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xd1e(%rip),%rdx
call   10a0 <getopt@plt>
mov    %eax,-0x48(%rbp)
cmp    $0xffffffff,%eax
je     1372 <main+0x1c2>
mov    -0x48(%rbp),%eax
mov    %eax,-0x80(%rbp)
sub    $0x63,%eax
je     1331 <main+0x181>
jmp    130f <main+0x15f>
mov    -0x80(%rbp),%eax
sub    $0x64,%eax
je     133d <main+0x18d>
jmp    1320 <main+0x170>
mov    -0x80(%rbp),%eax
sub    $0x66,%eax
je     1350 <main+0x1a0>
jmp    135c <main+0x1ac>
movl   $0x2,-0x40(%rbp)
jmp    136d <main+0x1bd>
movl   $0x2,-0x40(%rbp)
movl   $0x1,-0x4c(%rbp)
jmp    136d <main+0x1bd>
movl   $0x1,-0x44(%rbp)
jmp    136d <main+0x1bd>
mov    $0x0,%al
call   1060 <display_help@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
jmp    12dc <main+0x12c>
cmpl   $0x0,-0x4c(%rbp)
jne    1414 <main+0x264>
movswl -0x22(%rbp),%eax
mov    -0x40(%rbp),%ecx
imul   %ecx,%eax
mov    %rsp,%rcx
mov    %rcx,-0x58(%rbp)
lea    0xf(%rax,%rax,1),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x88(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x60(%rbp)
mov    -0x88(%rbp),%rdi
movslq -0x40(%rbp),%rax
shl    $0x1,%rax
mov    %eax,%esi
mov    -0x22(%rbp),%ax
mov    -0x18(%rbp),%rcx
movswl %ax,%edx
call   1030 <fread@plt>
cwtl
movswl -0x22(%rbp),%ecx
cmp    %ecx,%eax
jne    1408 <main+0x258>
cmpl   $0x0,-0x44(%rbp)
je     1401 <main+0x251>
mov    -0x88(%rbp),%rdi
movswl -0x22(%rbp),%eax
imul   -0x40(%rbp),%eax
lea    -0x30(%rbp),%rdx
lea    -0x3c(%rbp),%rcx
movswl %ax,%esi
call   1050 <freq_shift_complex_buf@plt>
xor    %edi,%edi
call   10c0 <exit@plt>
mov    -0x58(%rbp),%rax
mov    %rax,%rsp
jmp    1542 <main+0x392>
movswl -0x22(%rbp),%eax
mov    -0x40(%rbp),%ecx
imul   %ecx,%eax
mov    %rsp,%rcx
mov    %rcx,-0x68(%rbp)
lea    0xf(%rax,%rax,1),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x98(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x70(%rbp)
movswl -0x22(%rbp),%eax
mov    -0x40(%rbp),%ecx
imul   %ecx,%eax
lea    0xf(%rax,%rax,1),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x90(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x78(%rbp)
mov    -0x98(%rbp),%rdi
movslq -0x40(%rbp),%rax
shl    $0x1,%rax
mov    %eax,%esi
mov    -0x22(%rbp),%ax
mov    -0x18(%rbp),%rcx
movswl %ax,%edx
call   1030 <fread@plt>
cwtl
movswl -0x22(%rbp),%ecx
cmp    %ecx,%eax
jne    153b <main+0x38b>
movw   $0x0,-0x7c(%rbp)
movswl -0x7c(%rbp),%eax
movswl -0x22(%rbp),%ecx
imul   -0x40(%rbp),%ecx
cmp    %ecx,%eax
jge    14f5 <main+0x345>
mov    -0x90(%rbp),%rax
mov    -0x98(%rbp),%rcx
movswq -0x7c(%rbp),%rdx
mov    (%rcx,%rdx,2),%cx
mov    %cx,-0x7a(%rbp)
movswl -0x7a(%rbp),%ecx
shl    $0x8,%ecx
mov    %cx,-0x7a(%rbp)
mov    -0x7a(%rbp),%dx
movswq -0x7c(%rbp),%rcx
mov    %dx,(%rax,%rcx,2)
mov    -0x7c(%rbp),%ax
add    $0x1,%ax
mov    %ax,-0x7c(%rbp)
jmp    149d <main+0x2ed>
cmpl   $0x0,-0x44(%rbp)
je     151e <main+0x36e>
mov    -0x90(%rbp),%rdi
movswl -0x22(%rbp),%eax
imul   -0x40(%rbp),%eax
lea    -0x30(%rbp),%rdx
lea    -0x3c(%rbp),%rcx
movswl %ax,%esi
call   1050 <freq_shift_complex_buf@plt>
mov    -0x90(%rbp),%rdi
mov    -0x40(%rbp),%edx
mov    -0x20(%rbp),%rcx
mov    $0x2,%esi
call   10d0 <fwrite@plt>
jmp    1469 <main+0x2b9>
mov    -0x68(%rbp),%rax
mov    %rax,%rsp
mov    -0x20(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
cmp    $0x2,%edi
jle    1557 <main+0x3a7>
mov    %rsi,%r13
mov    %edi,%r14d
mov    0x8(%rsi),%rdi
lea    0xe25(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     11fa <main+0x4a>
mov    0x8(%r13),%rdi
lea    0xe12(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,%rbx
jmp    1204 <main+0x54>
mov    0x2de7(%rip),%rax
mov    (%rax),%rbx
xor    %edi,%edi
test   %rbx,%rbx
setne  %dil
call   1080 <assert@plt>
mov    0x10(%r13),%rdi
lea    0xde3(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
mov    %rbx,-0x40(%rbp)
je     123d <main+0x8d>
mov    0x10(%r13),%rdi
lea    0xdcf(%rip),%rsi
call   1090 <fopen@plt>
jmp    1247 <main+0x97>
mov    0x2d94(%rip),%rax
mov    (%rax),%rax
xor    %edi,%edi
mov    %rax,-0x48(%rbp)
test   %rax,%rax
setne  %dil
call   1080 <assert@plt>
mov    0x18(%r13),%rdi
call   10b0 <atoi@plt>
mov    %eax,%r12d
mov    $0xffffffff,%eax
mov    %rax,-0x80(%rbp)
movabs $0xffffffff00000000,%rax
ff ff ff
mov    %rax,-0x74(%rbp)
mov    $0x1,%r15d
movl   $0x0,-0x34(%rbp)
mov    $0x1,%al
mov    %eax,-0x30(%rbp)
lea    0xd73(%rip),%rbx
mov    %r15d,%ecx
nopl   0x0(%rax,%rax,1)
mov    %ecx,%r15d
mov    %r14d,%edi
mov    %r13,%rsi
mov    %rbx,%rdx
call   10a0 <getopt@plt>
mov    $0x2,%ecx
cmp    $0x63,%eax
je     12a0 <main+0xf0>
cmp    $0xffffffff,%eax
je     12ef <main+0x13f>
cmp    $0x64,%eax
je     12e0 <main+0x130>
cmp    $0x66,%eax
jne    1557 <main+0x3a7>
movl   $0x1,-0x34(%rbp)
jmp    1295 <main+0xe5>
nopw   0x0(%rax,%rax,1)
mov    $0x2,%r15d
movl   $0x0,-0x30(%rbp)
jmp    1295 <main+0xe5>
mov    %rsp,%r13
movswl %r12w,%edx
mov    %r15d,%r12d
imul   %edx,%r12d
lea    (%r12,%r12,1),%rax
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
mov    %rsp,%rbx
sub    %rax,%rbx
mov    %rbx,%rsp
testb  $0x1,-0x30(%rbp)
je     1342 <main+0x192>
add    %r15d,%r15d
mov    %rbx,%rdi
mov    %r15d,%esi
mov    %edx,%r15d
mov    -0x40(%rbp),%r14
mov    %r14,%rcx
call   1030 <fread@plt>
cmp    %r15w,%ax
je     1568 <main+0x3b8>
mov    %r13,%rsp
jmp    1535 <main+0x385>
mov    %r13,-0x68(%rbp)
mov    %edx,%r13d
mov    %rsp,%r14
sub    %rax,%r14
mov    %r14,%rsp
lea    (%r15,%r15,1),%esi
mov    %rbx,%rdi
mov    %esi,-0x60(%rbp)
mov    -0x40(%rbp),%rcx
call   1030 <fread@plt>
mov    %r13d,-0x30(%rbp)
cmp    %r13w,%ax
jne    152d <main+0x37d>
lea    -0x1(%r12),%eax
lea    -0x10(%r12),%ecx
mov    %ecx,-0x58(%rbp)
mov    %ecx,%edx
shr    $0x4,%edx
add    $0x1,%edx
movzwl %ax,%ecx
cmp    $0x7fff,%ecx
setae  %cl
cmp    $0x8000,%eax
setae  %al
or     %cl,%al
mov    %al,-0x29(%rbp)
mov    %r12d,%eax
and    $0xfffffff0,%eax
mov    %eax,-0x50(%rbp)
mov    %edx,-0x54(%rbp)
and    $0xfffffffe,%edx
mov    %edx,-0x4c(%rbp)
movabs $0x10000000000000,%r8
movabs $0x20000000000000,%rdi
movswl %r12w,%eax
mov    %eax,-0x5c(%rbp)
mov    -0x30(%rbp),%r13d
jmp    1424 <main+0x274>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r14,%rdi
mov    $0x2,%esi
mov    %r15d,%edx
mov    -0x48(%rbp),%rcx
call   10d0 <fwrite@plt>
mov    %rbx,%rdi
mov    -0x60(%rbp),%esi
mov    %r13d,%edx
mov    -0x40(%rbp),%rcx
call   1030 <fread@plt>
cmp    %r13w,%ax
movabs $0x10000000000000,%r8
movabs $0x20000000000000,%rdi
jne    152d <main+0x37d>
test   %r12d,%r12d
jle    150b <main+0x35b>
cmp    $0x10,%r12d
setb   %cl
xor    %eax,%eax
or     -0x29(%rbp),%cl
jne    14f0 <main+0x340>
cmpl   $0x10,-0x58(%rbp)
jb     14ae <main+0x2fe>
xor    %ecx,%ecx
mov    -0x4c(%rbp),%edx
xor    %eax,%eax
nopl   0x0(%rax)
mov    %rcx,%rsi
sar    $0x2f,%rsi
movdqa (%rbx,%rsi,1),%xmm0
movdqu 0x10(%rbx,%rsi,1),%xmm1
psllw  $0x8,%xmm0
psllw  $0x8,%xmm1
movdqa %xmm0,(%r14,%rsi,1)
movdqu %xmm1,0x10(%r14,%rsi,1)
lea    (%rcx,%r8,1),%rsi
sar    $0x2f,%rsi
movdqa (%rbx,%rsi,1),%xmm0
movdqu 0x10(%rbx,%rsi,1),%xmm1
psllw  $0x8,%xmm0
psllw  $0x8,%xmm1
movdqa %xmm0,(%r14,%rsi,1)
movdqu %xmm1,0x10(%r14,%rsi,1)
add    $0x20,%eax
add    %rdi,%rcx
add    $0xfffffffe,%edx
jne    1450 <main+0x2a0>
testb  $0x1,-0x54(%rbp)
je     14da <main+0x32a>
movswq %ax,%rax
movdqa (%rbx,%rax,2),%xmm0
movdqu 0x10(%rbx,%rax,2),%xmm1
psllw  $0x8,%xmm0
psllw  $0x8,%xmm1
movdqa %xmm0,(%r14,%rax,2)
movdqu %xmm1,0x10(%r14,%rax,2)
mov    -0x50(%rbp),%ecx
mov    %ecx,%eax
cmp    %ecx,%r12d
je     150b <main+0x35b>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movswq %ax,%rcx
movzwl (%rbx,%rcx,2),%edx
shl    $0x8,%edx
mov    %dx,(%r14,%rcx,2)
add    $0x1,%eax
movswl %ax,%ecx
cmp    %ecx,%r12d
jg     14f0 <main+0x340>
cmpl   $0x0,-0x34(%rbp)
je     13e0 <main+0x230>
mov    %r14,%rdi
mov    -0x5c(%rbp),%esi
lea    -0x80(%rbp),%rdx
lea    -0x74(%rbp),%rcx
call   1050 <freq_shift_complex_buf@plt>
jmp    13e0 <main+0x230>
mov    -0x68(%rbp),%rsp
mov    -0x40(%rbp),%r14
mov    -0x48(%rbp),%rdi
call   1040 <fclose@plt>
mov    %r14,%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %eax,%eax
call   1060 <display_help@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
cmpl   $0x0,-0x34(%rbp)
je     1582 <main+0x3d2>
movswl %r12w,%esi
lea    -0x80(%rbp),%rdx
lea    -0x74(%rbp),%rcx
mov    %rbx,%rdi
call   1050 <freq_shift_complex_buf@plt>
xor    %edi,%edi
call   10c0 <exit@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"-\00"
@stdin = global i32* null
@.str.1 = [3 x i8] c"rb\00"
@stdout = global i32* null
@.str.2 = [3 x i8] c"wb\00"
@.str.3 = [4 x i8] c"cdf\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i16
%9 = alloca [3 x i32]
%10 = alloca [3 x i32]
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i8*
%16 = alloca i64
%17 = alloca i8*
%18 = alloca i64
%19 = alloca i64
%20 = alloca i16
%21 = alloca i16
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%22 = load i32, i32* %4
%23 = icmp slt i32 %22, 3
br i1 %23, label %24, label %27
24: ; preds = %2
%25 = call i32 (...) @display_help()
%26 = call i32 @exit(i32 1)
unreachable
27: ; preds = %2
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i64 1
%30 = load i8*, i8** %29
%31 = call i64 @strcmp(i8* %30, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%32 = icmp eq i64 %31, 0
br i1 %32, label %33, label %35
33: ; preds = %27
%34 = load i32*, i32** @stdin
store i32* %34, i32** %6
br label %40
35: ; preds = %27
%36 = load i8**, i8*** %5
%37 = getelementptr inbounds i8*, i8** %36, i64 1
%38 = load i8*, i8** %37
%39 = call i32* @fopen(i8* %38, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %39, i32** %6
br label %40
40: ; preds = %35, %33
%41 = load i32*, i32** %6
%42 = icmp ne i32* %41, null
%43 = zext i1 %42 to i32
%44 = call i32 @assert(i32 %43)
%45 = load i8**, i8*** %5
%46 = getelementptr inbounds i8*, i8** %45, i64 2
%47 = load i8*, i8** %46
%48 = call i64 @strcmp(i8* %47, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%49 = icmp eq i64 %48, 0
br i1 %49, label %50, label %52
50: ; preds = %40
%51 = load i32*, i32** @stdout
store i32* %51, i32** %7
br label %57
52: ; preds = %40
%53 = load i8**, i8*** %5
%54 = getelementptr inbounds i8*, i8** %53, i64 2
%55 = load i8*, i8** %54
%56 = call i32* @fopen(i8* %55, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
store i32* %56, i32** %7
br label %57
57: ; preds = %52, %50
%58 = load i32*, i32** %7
%59 = icmp ne i32* %58, null
%60 = zext i1 %59 to i32
%61 = call i32 @assert(i32 %60)
%62 = load i8**, i8*** %5
%63 = getelementptr inbounds i8*, i8** %62, i64 3
%64 = load i8*, i8** %63
%65 = call signext i16 @atoi(i8* %64)
store i16 %65, i16* %8
store i32 1, i32* %11
store i32 0, i32* %12
%66 = getelementptr inbounds [3 x i32], [3 x i32]* %9, i64 0, i64 0
store i32 -1, i32* %66
%67 = getelementptr inbounds [3 x i32], [3 x i32]* %9, i64 0, i64 1
store i32 0, i32* %67
%68 = getelementptr inbounds [3 x i32], [3 x i32]* %10, i64 0, i64 0
store i32 0, i32* %68
%69 = getelementptr inbounds [3 x i32], [3 x i32]* %10, i64 0, i64 1
store i32 -1, i32* %69
store i32 0, i32* %14
br label %70
70: ; preds = %83, %57
%71 = load i32, i32* %4
%72 = load i8**, i8*** %5
%73 = call i32 @getopt(i32 %71, i8** %72, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
store i32 %73, i32* %13
%74 = icmp ne i32 %73, -1
br i1 %74, label %75, label %84
75: ; preds = %70
%76 = load i32, i32* %13
switch i32 %76, label %80 [
i32 99, label %77
i32 100, label %78
i32 102, label %79
]
77: ; preds = %75
store i32 2, i32* %11
br label %83
78: ; preds = %75
store i32 2, i32* %11
store i32 1, i32* %14
br label %83
79: ; preds = %75
store i32 1, i32* %12
br label %83
80: ; preds = %75
%81 = call i32 (...) @display_help()
%82 = call i32 @exit(i32 1)
unreachable
83: ; preds = %79, %78, %77
br label %70
84: ; preds = %70
%85 = load i32, i32* %14
%86 = icmp eq i32 %85, 0
br i1 %86, label %87, label %123
87: ; preds = %84
%88 = load i16, i16* %8
%89 = sext i16 %88 to i32
%90 = load i32, i32* %11
%91 = mul nsw i32 %89, %90
%92 = zext i32 %91 to i64
%93 = call i8* @llvm.stacksave()
store i8* %93, i8** %15
%94 = alloca i16, i64 %92
store i64 %92, i64* %16
br label %95
95: ; preds = %87
%96 = load i32, i32* %11
%97 = sext i32 %96 to i64
%98 = mul i64 2, %97
%99 = trunc i64 %98 to i32
%100 = load i16, i16* %8
%101 = load i32*, i32** %6
%102 = call signext i16 @fread(i16* %94, i32 %99, i16 signext %100, i32* %101)
%103 = sext i16 %102 to i32
%104 = load i16, i16* %8
%105 = sext i16 %104 to i32
%106 = icmp eq i32 %103, %105
br i1 %106, label %107, label %121
107: ; preds = %95
%108 = load i32, i32* %12
%109 = icmp ne i32 %108, 0
br i1 %109, label %110, label %119
110: ; preds = %107
%111 = load i16, i16* %8
%112 = sext i16 %111 to i32
%113 = load i32, i32* %11
%114 = mul nsw i32 %112, %113
%115 = trunc i32 %114 to i16
%116 = getelementptr inbounds [3 x i32], [3 x i32]* %9, i64 0, i64 0
%117 = getelementptr inbounds [3 x i32], [3 x i32]* %10, i64 0, i64 0
%118 = call i32 @freq_shift_complex_buf(i16* %94, i16 signext %115, i32* %116, i32* %117)
br label %119
119: ; preds = %110, %107
%120 = call i32 @exit(i32 0)
unreachable
121: ; preds = %95
%122 = load i8*, i8** %15
br label %192
123: ; preds = %84
%124 = load i16, i16* %8
%125 = sext i16 %124 to i32
%126 = load i32, i32* %11
%127 = mul nsw i32 %125, %126
%128 = zext i32 %127 to i64
%129 = call i8* @llvm.stacksave()
store i8* %129, i8** %17
%130 = alloca i16, i64 %128
store i64 %128, i64* %18
%131 = load i16, i16* %8
%132 = sext i16 %131 to i32
%133 = load i32, i32* %11
%134 = mul nsw i32 %132, %133
%135 = zext i32 %134 to i64
%136 = alloca i16, i64 %135
store i64 %135, i64* %19
br label %137
137: ; preds = %186, %123
%138 = load i32, i32* %11
%139 = sext i32 %138 to i64
%140 = mul i64 2, %139
%141 = trunc i64 %140 to i32
%142 = load i16, i16* %8
%143 = load i32*, i32** %6
%144 = call signext i16 @fread(i16* %130, i32 %141, i16 signext %142, i32* %143)
%145 = sext i16 %144 to i32
%146 = load i16, i16* %8
%147 = sext i16 %146 to i32
%148 = icmp eq i32 %145, %147
br i1 %148, label %149, label %190
149: ; preds = %137
store i16 0, i16* %21
br label %150
150: ; preds = %171, %149
%151 = load i16, i16* %21
%152 = sext i16 %151 to i32
%153 = load i16, i16* %8
%154 = sext i16 %153 to i32
%155 = load i32, i32* %11
%156 = mul nsw i32 %154, %155
%157 = icmp slt i32 %152, %156
br i1 %157, label %158, label %174
158: ; preds = %150
%159 = load i16, i16* %21
%160 = sext i16 %159 to i64
%161 = getelementptr inbounds i16, i16* %130, i64 %160
%162 = load i16, i16* %161
store i16 %162, i16* %20
%163 = load i16, i16* %20
%164 = sext i16 %163 to i32
%165 = shl i32 %164, 8
%166 = trunc i32 %165 to i16
store i16 %166, i16* %20
%167 = load i16, i16* %20
%168 = load i16, i16* %21
%169 = sext i16 %168 to i64
%170 = getelementptr inbounds i16, i16* %136, i64 %169
store i16 %167, i16* %170
br label %171
171: ; preds = %158
%172 = load i16, i16* %21
%173 = add i16 %172, 1
store i16 %173, i16* %21
br label %150
174: ; preds = %150
%175 = load i32, i32* %12
%176 = icmp ne i32 %175, 0
br i1 %176, label %177, label %186
177: ; preds = %174
%178 = load i16, i16* %8
%179 = sext i16 %178 to i32
%180 = load i32, i32* %11
%181 = mul nsw i32 %179, %180
%182 = trunc i32 %181 to i16
%183 = getelementptr inbounds [3 x i32], [3 x i32]* %9, i64 0, i64 0
%184 = getelementptr inbounds [3 x i32], [3 x i32]* %10, i64 0, i64 0
%185 = call i32 @freq_shift_complex_buf(i16* %136, i16 signext %182, i32* %183, i32* %184)
br label %186
186: ; preds = %177, %174
%187 = load i32, i32* %11
%188 = load i32*, i32** %7
%189 = call i32 @fwrite(i16* %136, i32 2, i32 %187, i32* %188)
br label %137
190: ; preds = %137
%191 = load i8*, i8** %17
br label %192
192: ; preds = %190, %121
%193 = load i32*, i32** %7
%194 = call i32 @fclose(i32* %193)
%195 = load i32*, i32** %6
%196 = call i32 @fclose(i32* %195)
ret i32 0
}

LLVM IR (-O2):
@.str = [2 x i8] c"-\00"
@stdin = global i32* null
@.str.1 = [3 x i8] c"rb\00"
@stdout = global i32* null
@.str.2 = [3 x i8] c"wb\00"
@.str.3 = [4 x i8] c"cdf\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca [3 x i32]
%4 = alloca [3 x i32]
%5 = bitcast [3 x i32]* %3 to i8*
%6 = bitcast [3 x i32]* %4 to i8*
%7 = icmp slt i32 %0, 3
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = tail call i32 (...) @display_help()
%10 = tail call i32 @exit(i32 1)
unreachable
11: ; preds = %2
%12 = getelementptr inbounds i8*, i8** %1, i64 1
%13 = load i8*, i8** %12
%14 = tail call i64 @strcmp(i8* %13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %11
%17 = load i32*, i32** @stdin
br label %21
18: ; preds = %11
%19 = load i8*, i8** %12
%20 = tail call i32* @fopen(i8* %19, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %21
21: ; preds = %18, %16
%22 = phi i32* [ %17, %16 ], [ %20, %18 ]
%23 = icmp ne i32* %22, null
%24 = zext i1 %23 to i32
%25 = tail call i32 @assert(i32 %24)
%26 = getelementptr inbounds i8*, i8** %1, i64 2
%27 = load i8*, i8** %26
%28 = tail call i64 @strcmp(i8* %27, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%29 = icmp eq i64 %28, 0
br i1 %29, label %30, label %32
30: ; preds = %21
%31 = load i32*, i32** @stdout
br label %35
32: ; preds = %21
%33 = load i8*, i8** %26
%34 = tail call i32* @fopen(i8* %33, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %35
35: ; preds = %32, %30
%36 = phi i32* [ %31, %30 ], [ %34, %32 ]
%37 = icmp ne i32* %36, null
%38 = zext i1 %37 to i32
%39 = tail call i32 @assert(i32 %38)
%40 = getelementptr inbounds i8*, i8** %1, i64 3
%41 = load i8*, i8** %40
%42 = tail call signext i16 @atoi(i8* %41)
%43 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 0
store i32 -1, i32* %43
%44 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 1
store i32 0, i32* %44
%45 = getelementptr inbounds [3 x i32], [3 x i32]* %4, i64 0, i64 0
store i32 0, i32* %45
%46 = getelementptr inbounds [3 x i32], [3 x i32]* %4, i64 0, i64 1
store i32 -1, i32* %46
br label %47
47: ; preds = %54, %35
%48 = phi i1 [ true, %35 ], [ false, %54 ]
%49 = phi i32 [ 0, %35 ], [ %52, %54 ]
%50 = phi i32 [ 1, %35 ], [ 2, %54 ]
br label %51
51: ; preds = %54, %47
%52 = phi i32 [ %49, %47 ], [ 1, %54 ]
%53 = phi i32 [ %50, %47 ], [ %55, %54 ]
br label %54
54: ; preds = %51, %54
%55 = phi i32 [ 2, %54 ], [ %53, %51 ]
%56 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
switch i32 %56, label %57 [
i32 -1, label %60
i32 99, label %54
i32 100, label %47
i32 102, label %51
]
57: ; preds = %54
%58 = tail call i32 (...) @display_help()
%59 = tail call i32 @exit(i32 1)
unreachable
60: ; preds = %54
%61 = sext i16 %42 to i32
%62 = mul i32 %55, %61
%63 = zext i32 %62 to i64
%64 = tail call i8* @llvm.stacksave()
%65 = alloca i16, i64 %63
br i1 %48, label %66, label %78
66: ; preds = %60
%67 = shl nuw i32 %55, 1
%68 = call signext i16 @fread(i16* %65, i32 %67, i16 signext %42, i32* %22)
%69 = icmp eq i16 %68, %42
br i1 %69, label %70, label %77
70: ; preds = %66
%71 = icmp eq i32 %52, 0
br i1 %71, label %75, label %72
72: ; preds = %70
%73 = trunc i32 %62 to i16
%74 = call i32 @freq_shift_complex_buf(i16* %65, i16 signext %73, i32* %43, i32* %45)
br label %75
75: ; preds = %72, %70
%76 = call i32 @exit(i32 0)
unreachable
77: ; preds = %66
tail call void @llvm.stackrestore(i8* %64)
br label %183
78: ; preds = %60
%79 = alloca i16, i64 %63
%80 = shl nuw i32 %55, 1
%81 = call signext i16 @fread(i16* %65, i32 %80, i16 signext %42, i32* %22)
%82 = icmp eq i16 %81, %42
br i1 %82, label %83, label %182
83: ; preds = %78
%84 = icmp sgt i32 %62, 0
%85 = icmp eq i32 %52, 0
%86 = trunc i32 %62 to i16
%87 = add i32 %62, -1
%88 = add i32 %62, -16
%89 = lshr i32 %88, 4
%90 = add nuw nsw i32 %89, 1
%91 = icmp ult i32 %62, 16
%92 = trunc i32 %87 to i16
%93 = icmp ugt i16 %92, 32766
%94 = icmp ugt i32 %87, 32767
%95 = or i1 %93, %94
%96 = and i32 %62, -16
%97 = trunc i32 %96 to i16
%98 = and i32 %90, 1
%99 = icmp ult i32 %88, 16
%100 = and i32 %90, 536870910
%101 = icmp eq i32 %98, 0
%102 = icmp eq i32 %62, %96
br label %103
103: ; preds = %83, %178
br i1 %84, label %104, label %175
104: ; preds = %103
%105 = select i1 %91, i1 true, i1 %95
br i1 %105, label %163, label %106
106: ; preds = %104
br i1 %99, label %144, label %107
107: ; preds = %106, %107
%108 = phi i32 [ %141, %107 ], [ 0, %106 ]
%109 = phi i32 [ %142, %107 ], [ 0, %106 ]
%110 = zext i32 %108 to i64
%111 = shl i64 %110, 48
%112 = ashr exact i64 %111, 48
%113 = getelementptr inbounds i16, i16* %65, i64 %112
%114 = bitcast i16* %113 to <8 x i16>*
%115 = load <8 x i16>, <8 x i16>* %114
%116 = getelementptr inbounds i16, i16* %113, i64 8
%117 = bitcast i16* %116 to <8 x i16>*
%118 = load <8 x i16>, <8 x i16>* %117
%119 = shl <8 x i16> %115, <i16 8, i16 8, i16 8, i16 8, i16 8, i16 8, i16 8, i16 8>
%120 = shl <8 x i16> %118, <i16 8, i16 8, i16 8, i16 8, i16 8, i16 8, i16 8, i16 8>
%121 = getelementptr inbounds i16, i16* %79, i64 %112
%122 = bitcast i16* %121 to <8 x i16>*
store <8 x i16> %119, <8 x i16>* %122
%123 = getelementptr inbounds i16, i16* %121, i64 8
%124 = bitcast i16* %123 to <8 x i16>*
store <8 x i16> %120, <8 x i16>* %124
%125 = or i32 %108, 16
%126 = zext i32 %125 to i64
%127 = shl i64 %126, 48
%128 = ashr exact i64 %127, 48
%129 = getelementptr inbounds i16, i16* %65, i64 %128
%130 = bitcast i16* %129 to <8 x i16>*
%131 = load <8 x i16>, <8 x i16>* %130
%132 = getelementptr inbounds i16, i16* %129, i64 8
%133 = bitcast i16* %132 to <8 x i16>*
%134 = load <8 x i16>, <8 x i16>* %133
%135 = shl <8 x i16> %131, <i16 8, i16 8, i16 8, i16 8, i16 8, i16 8, i16 8, i16 8>
%136 = shl <8 x i16> %134, <i16 8, i16 8, i16 8, i16 8, i16 8, i16 8, i16 8, i16 8>
%137 = getelementptr inbounds i16, i16* %79, i64 %128
%138 = bitcast i16* %137 to <8 x i16>*
store <8 x i16> %135, <8 x i16>* %138
%139 = getelementptr inbounds i16, i16* %137, i64 8
%140 = bitcast i16* %139 to <8 x i16>*
store <8 x i16> %136, <8 x i16>* %140
%141 = add nuw i32 %108, 32
%142 = add i32 %109, 2
%143 = icmp eq i32 %142, %100
br i1 %143, label %144, label %107
144: ; preds = %107, %106
%145 = phi i32 [ 0, %106 ], [ %141, %107 ]
br i1 %101, label %162, label %146
146: ; preds = %144
%147 = zext i32 %145 to i64
%148 = shl i64 %147, 48
%149 = ashr exact i64 %148, 48
%150 = getelementptr inbounds i16, i16* %65, i64 %149
%151 = bitcast i16* %150 to <8 x i16>*
%152 = load <8 x i16>, <8 x i16>* %151
%153 = getelementptr inbounds i16, i16* %150, i64 8
%154 = bitcast i16* %153 to <8 x i16>*
%155 = load <8 x i16>, <8 x i16>* %154
%156 = shl <8 x i16> %152, <i16 8, i16 8, i16 8, i16 8, i16 8, i16 8, i16 8, i16 8>
%157 = shl <8 x i16> %155, <i16 8, i16 8, i16 8, i16 8, i16 8, i16 8, i16 8, i16 8>
%158 = getelementptr inbounds i16, i16* %79, i64 %149
%159 = bitcast i16* %158 to <8 x i16>*
store <8 x i16> %156, <8 x i16>* %159
%160 = getelementptr inbounds i16, i16* %158, i64 8
%161 = bitcast i16* %160 to <8 x i16>*
store <8 x i16> %157, <8 x i16>* %161
br label %162
162: ; preds = %144, %146
br i1 %102, label %175, label %163
163: ; preds = %104, %162
%164 = phi i16 [ 0, %104 ], [ %97, %162 ]
br label %165
165: ; preds = %163, %165
%166 = phi i16 [ %172, %165 ], [ %164, %163 ]
%167 = sext i16 %166 to i64
%168 = getelementptr inbounds i16, i16* %65, i64 %167
%169 = load i16, i16* %168
%170 = shl i16 %169, 8
%171 = getelementptr inbounds i16, i16* %79, i64 %167
store i16 %170, i16* %171
%172 = add i16 %166, 1
%173 = sext i16 %172 to i32
%174 = icmp sgt i32 %62, %173
br i1 %174, label %165, label %175
175: ; preds = %165, %162, %103
br i1 %85, label %178, label %176
176: ; preds = %175
%177 = call i32 @freq_shift_complex_buf(i16* %79, i16 signext %86, i32* %43, i32* %45)
br label %178
178: ; preds = %176, %175
%179 = call i32 @fwrite(i16* %79, i32 2, i32 %55, i32* %36)
%180 = call signext i16 @fread(i16* %65, i32 %80, i16 signext %42, i32* %22)
%181 = icmp eq i16 %180, %42
br i1 %181, label %103, label %182
182: ; preds = %178, %78
br label %183
183: ; preds = %182, %77
%184 = call i32 @fclose(i32* %36)
%185 = call i32 @fclose(i32* %22)
ret i32 0
}