#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*/ decode(int, int *);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ reset();
int main() {
  int xout[3];
  int i, j, f;
  static int compressed[100], result[100];
  static int test_data[] = {
      0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44,
      0x44, 0x44, 0x44, 0x44, 0x44, 0x43, 0x43, 0x43, 0x43, 0x43, 0x43, 0x43,
      0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x41, 0x41, 0x41, 0x41, 0x41, 0x40,
      0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f,
      0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d,
      0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3b, 0x3b, 0x3b,
      0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b,
      0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3c, 0x3c, 0x3c, 0x3c,
      0x3c, 0x3c, 0x3c, 0x3c};
  reset();
  j = 10;
  f = 100;
  for (i = 0; i < 100; i += 2) {
    decode(compressed[i / 2], xout);
    result[i] = xout[1];
    result[i + 1] = xout[2];
  }
  if (xout[1] == 11113 && xout[2] == -11197) {
    puts("adpcm: success\n");
  } else {
    puts("adpcm: failed\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <reset@plt>
movl   $0xa,-0x18(%rbp)
movl   $0x64,-0x1c(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x64,-0x14(%rbp)
jge    11bb <main+0x8b>
mov    -0x14(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
movslq %eax,%rcx
lea    0x3066(%rip),%rax
mov    (%rax,%rcx,4),%edi
lea    -0x10(%rbp),%rsi
call   1050 <decode@plt>
mov    -0xc(%rbp),%edx
movslq -0x14(%rbp),%rcx
lea    0x31dc(%rip),%rax
mov    %edx,(%rax,%rcx,4)
mov    -0x8(%rbp),%edx
mov    -0x14(%rbp),%eax
add    $0x1,%eax
movslq %eax,%rcx
lea    0x31c6(%rip),%rax
mov    %edx,(%rax,%rcx,4)
mov    -0x14(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x14(%rbp)
jmp    115b <main+0x2b>
cmpl   $0x2b69,-0xc(%rbp)
jne    11e6 <main+0xb6>
cmpl   $0xffffd443,-0x8(%rbp)
jne    11e6 <main+0xb6>
lea    0xe24(%rip),%rdi
call   1030 <puts@plt>
jmp    11f2 <main+0xc2>
lea    0xe23(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
xor    %eax,%eax
call   1040 <reset@plt>
mov    $0xfffffffe,%ebp
lea    0xc(%rsp),%rbx
nopw   0x0(%rax,%rax,1)
xor    %edi,%edi
mov    %rbx,%rsi
call   1050 <decode@plt>
add    $0x2,%ebp
cmp    $0x62,%ebp
jb     1150 <main+0x20>
mov    $0x2b69,%eax
xor    0x10(%rsp),%eax
mov    $0xffffd443,%ecx
xor    0x14(%rsp),%ecx
lea    0xe85(%rip),%rdx
lea    0xe8e(%rip),%rdi
or     %eax,%ecx
cmove  %rdx,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@main.compressed = internal global [100 x i32] zeroinitializer
@main.result = internal global [100 x i32] zeroinitializer
@main.test_data = internal global [100 x i32] [i32 68, i32 68, i32 68, i32 68, i32 68, i32 68, i32 68, i32 68, i32 68, i32 68, i32 68, i32 68, i32 68, i32 68, i32 68, i32 68, i32 68, i32 67, i32 67, i32 67, i32 67, i32 67, i32 67, i32 67, i32 66, i32 66, i32 66, i32 66, i32 66, i32 66, i32 65, i32 65, i32 65, i32 65, i32 65, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 63, i32 63, i32 63, i32 63, i32 63, i32 62, i32 62, i32 62, i32 62, i32 62, i32 62, i32 61, i32 61, i32 61, i32 61, i32 61, i32 61, i32 60, i32 60, i32 60, i32 60, i32 60, i32 60, i32 60, i32 60, i32 60, i32 59, i32 59, i32 59, i32 59, i32 59, i32 59, i32 59, i32 59, i32 59, i32 59, i32 59, i32 59, i32 59, i32 59, i32 59, i32 59, i32 59, i32 59, i32 59, i32 59, i32 59, i32 59, i32 59, i32 60, i32 60, i32 60, i32 60, i32 60, i32 60, i32 60, i32 60]
@.str = [16 x i8] c"adpcm: success\0A\00"
@.str.1 = [15 x i8] c"adpcm: failed\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [3 x i32]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = call i32 (...) @reset()
store i32 10, i32* %4
store i32 100, i32* %5
store i32 0, i32* %3
br label %7
7: ; preds = %29, %0
%8 = load i32, i32* %3
%9 = icmp slt i32 %8, 100
br i1 %9, label %10, label %32
10: ; preds = %7
%11 = load i32, i32* %3
%12 = sdiv i32 %11, 2
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [100 x i32], [100 x i32]* @main.compressed, i64 0, i64 %13
%15 = load i32, i32* %14
%16 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 0
%17 = call i32 @decode(i32 %15, i32* %16)
%18 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 1
%19 = load i32, i32* %18
%20 = load i32, i32* %3
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [100 x i32], [100 x i32]* @main.result, i64 0, i64 %21
store i32 %19, i32* %22
%23 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 2
%24 = load i32, i32* %23
%25 = load i32, i32* %3
%26 = add nsw i32 %25, 1
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [100 x i32], [100 x i32]* @main.result, i64 0, i64 %27
store i32 %24, i32* %28
br label %29
29: ; preds = %10
%30 = load i32, i32* %3
%31 = add nsw i32 %30, 2
store i32 %31, i32* %3
br label %7
32: ; preds = %7
%33 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 1
%34 = load i32, i32* %33
%35 = icmp eq i32 %34, 11113
br i1 %35, label %36, label %42
36: ; preds = %32
%37 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 2
%38 = load i32, i32* %37
%39 = icmp eq i32 %38, -11197
br i1 %39, label %40, label %42
40: ; preds = %36
%41 = call i32 @puts(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
br label %44
42: ; preds = %36, %32
%43 = call i32 @puts(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
br label %44
44: ; preds = %42, %40
ret i32 0
}

LLVM IR (-O2):
@.str = [16 x i8] c"adpcm: success\0A\00"
@.str.1 = [15 x i8] c"adpcm: failed\0A\00"
define i32 @main() {
%1 = alloca [3 x i32]
%2 = bitcast [3 x i32]* %1 to i8*
%3 = tail call i32 (...) @reset()
%4 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 0
br label %5
5: ; preds = %0, %5
%6 = phi i32 [ 0, %0 ], [ %8, %5 ]
%7 = call i32 @decode(i32 0, i32* %4)
%8 = add nuw nsw i32 %6, 2
%9 = icmp ult i32 %6, 98
br i1 %9, label %5, label %10
10: ; preds = %5
%11 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 1
%12 = load i32, i32* %11
%13 = icmp eq i32 %12, 11113
%14 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 2
%15 = load i32, i32* %14
%16 = icmp eq i32 %15, -11197
%17 = select i1 %13, i1 %16, i1 false
%18 = select i1 %17, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0)
%19 = call i32 @puts(i8* dereferenceable(1) %18)
ret i32 0
}