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

/* Variables and functions */
int /*<<< orphan*/ EncodingAmr(char *, int);
int /*<<< orphan*/ ParsingAmr(char *, int);
int /*<<< orphan*/ memcpy(char *, char *, int);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *);
int strlen(char *);
int main() {
  char szAmrData[] =
      "3c08556d944c71a1a081e7ead204244480000ecd82b81118000097c4794e7740";
  int nLen = 0;
  char szBeData[] =
      "F3C2155B65131C68682079FAB4810911200003B360AE0446000025F11E539DD0";
  char szOaData[] =
      "F03c08556d944c71a1a081e7ead204244480000ecd82b81118000097c4794e7740";
  nLen = strlen(szAmrData);
  printf("-------------------------Decoding BE\n");
  ParsingAmr(szBeData, 0);
  memset(szOaData, 0, sizeof(szOaData));
  memcpy(&szOaData[0], "F0", 2);
  memcpy(&szOaData[2], szAmrData, nLen);
  printf("-------------------------Decoding OA\n");
  ParsingAmr(szOaData, 1);
  printf("-------------------------Encoding BE\n");
  EncodingAmr(szAmrData, 0);
  printf("-------------------------Encoding OA\n");
  EncodingAmr(szAmrData, 1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x50(%rbp),%rdi
lea    0xe83(%rip),%rsi
mov    $0x41,%edx
call   1060 <memcpy@plt>
movl   $0x0,-0x54(%rbp)
lea    -0xa0(%rbp),%rdi
lea    0xeb4(%rip),%rsi
mov    $0x41,%edx
call   1060 <memcpy@plt>
lea    -0xf0(%rbp),%rdi
lea    0xeec(%rip),%rsi
mov    $0x43,%edx
call   1060 <memcpy@plt>
lea    -0x50(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x54(%rbp)
lea    0xf12(%rip),%rdi
call   1040 <printf@plt>
lea    -0xa0(%rbp),%rdi
xor    %esi,%esi
call   1070 <ParsingAmr@plt>
lea    -0xf0(%rbp),%rdi
xor    %esi,%esi
mov    $0x43,%edx
call   1050 <memset@plt>
lea    -0xf0(%rbp),%rdi
lea    0xf04(%rip),%rsi
mov    $0x2,%edx
call   1060 <memcpy@plt>
lea    -0xf0(%rbp),%rdi
add    $0x2,%rdi
lea    -0x50(%rbp),%rsi
mov    -0x54(%rbp),%edx
call   1060 <memcpy@plt>
lea    0xedf(%rip),%rdi
call   1040 <printf@plt>
lea    -0xf0(%rbp),%rdi
mov    $0x1,%esi
call   1070 <ParsingAmr@plt>
lea    0xee8(%rip),%rdi
call   1040 <printf@plt>
lea    -0x50(%rbp),%rdi
xor    %esi,%esi
call   1080 <EncodingAmr@plt>
lea    0xef7(%rip),%rdi
call   1040 <printf@plt>
lea    -0x50(%rbp),%rdi
mov    $0x1,%esi
call   1080 <EncodingAmr@plt>
xor    %eax,%eax
add    $0xf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0xf0,%rsp
movaps 0xebe(%rip),%xmm0
movaps %xmm0,0xd0(%rsp)
movaps 0xe9f(%rip),%xmm0
movaps %xmm0,0xc0(%rsp)
movaps 0xe80(%rip),%xmm0
movaps %xmm0,0xb0(%rsp)
movaps 0xe61(%rip),%xmm0
movaps %xmm0,0xa0(%rsp)
movb   $0x0,0xe0(%rsp)
movaps 0xeca(%rip),%xmm0
movaps %xmm0,0x80(%rsp)
movaps 0xeab(%rip),%xmm0
movaps %xmm0,0x70(%rsp)
movaps 0xe8f(%rip),%xmm0
movaps %xmm0,0x60(%rsp)
movaps 0xe73(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movb   $0x0,0x90(%rsp)
movaps 0xedf(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xec3(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xea7(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xe8b(%rip),%xmm0
movaps %xmm0,(%rsp)
movl   $0x303437,0x3f(%rsp)
lea    0xa0(%rsp),%r14
mov    %r14,%rdi
call   1040 <strlen@plt>
mov    %eax,%ebp
lea    0xeac(%rip),%rdi
call   1030 <puts@plt>
lea    0x50(%rsp),%rdi
xor    %esi,%esi
call   1070 <ParsingAmr@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x43,%edx
call   1050 <memset@plt>
lea    0xe7f(%rip),%rsi
mov    %rbx,%rdi
mov    $0x2,%edx
call   1060 <memcpy@plt>
lea    0x2(%rsp),%rdi
mov    %r14,%rsi
mov    %ebp,%edx
call   1060 <memcpy@plt>
lea    0xe84(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
call   1070 <ParsingAmr@plt>
lea    0xe90(%rip),%rdi
call   1030 <puts@plt>
mov    %r14,%rdi
xor    %esi,%esi
call   1080 <EncodingAmr@plt>
lea    0xe9f(%rip),%rdi
call   1030 <puts@plt>
mov    %r14,%rdi
mov    $0x1,%esi
call   1080 <EncodingAmr@plt>
xor    %eax,%eax
add    $0xf0,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@__const.main.szAmrData = [65 x i8] c"3c08556d944c71a1a081e7ead204244480000ecd82b81118000097c4794e7740\00"
@__const.main.szBeData = [65 x i8] c"F3C2155B65131C68682079FAB4810911200003B360AE0446000025F11E539DD0\00"
@__const.main.szOaData = [67 x i8] c"F03c08556d944c71a1a081e7ead204244480000ecd82b81118000097c4794e7740\00"
@.str = [38 x i8] c"-------------------------Decoding BE\0A\00"
@.str.1 = [3 x i8] c"F0\00"
@.str.2 = [38 x i8] c"-------------------------Decoding OA\0A\00"
@.str.3 = [38 x i8] c"-------------------------Encoding BE\0A\00"
@.str.4 = [38 x i8] c"-------------------------Encoding OA\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [65 x i8]
%3 = alloca i32
%4 = alloca [65 x i8]
%5 = alloca [67 x i8]
store i32 0, i32* %1
%6 = bitcast [65 x i8]* %2 to i8*
store i32 0, i32* %3
%7 = bitcast [65 x i8]* %4 to i8*
%8 = bitcast [67 x i8]* %5 to i8*
%9 = getelementptr inbounds [65 x i8], [65 x i8]* %2, i64 0, i64 0
%10 = call i32 @strlen(i8* %9)
store i32 %10, i32* %3
%11 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%12 = getelementptr inbounds [65 x i8], [65 x i8]* %4, i64 0, i64 0
%13 = call i32 @ParsingAmr(i8* %12, i32 0)
%14 = getelementptr inbounds [67 x i8], [67 x i8]* %5, i64 0, i64 0
%15 = call i32 @memset(i8* %14, i32 0, i32 67)
%16 = getelementptr inbounds [67 x i8], [67 x i8]* %5, i64 0, i64 0
%17 = call i32 @memcpy(i8* %16, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 2)
%18 = getelementptr inbounds [67 x i8], [67 x i8]* %5, i64 0, i64 2
%19 = getelementptr inbounds [65 x i8], [65 x i8]* %2, i64 0, i64 0
%20 = load i32, i32* %3
%21 = call i32 @memcpy(i8* %18, i8* %19, i32 %20)
%22 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0))
%23 = getelementptr inbounds [67 x i8], [67 x i8]* %5, i64 0, i64 0
%24 = call i32 @ParsingAmr(i8* %23, i32 1)
%25 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0))
%26 = getelementptr inbounds [65 x i8], [65 x i8]* %2, i64 0, i64 0
%27 = call i32 @EncodingAmr(i8* %26, i32 0)
%28 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.4, i64 0, i64 0))
%29 = getelementptr inbounds [65 x i8], [65 x i8]* %2, i64 0, i64 0
%30 = call i32 @EncodingAmr(i8* %29, i32 1)
ret i32 0
}

LLVM IR (-O2):
@__const.main.szAmrData = [65 x i8] c"3c08556d944c71a1a081e7ead204244480000ecd82b81118000097c4794e7740\00"
@__const.main.szBeData = [65 x i8] c"F3C2155B65131C68682079FAB4810911200003B360AE0446000025F11E539DD0\00"
@__const.main.szOaData = [67 x i8] c"F03c08556d944c71a1a081e7ead204244480000ecd82b81118000097c4794e7740\00"
@.str.1 = [3 x i8] c"F0\00"
@str = [37 x i8] c"-------------------------Decoding BE\00"
@str.5 = [37 x i8] c"-------------------------Decoding OA\00"
@str.6 = [37 x i8] c"-------------------------Encoding BE\00"
@str.7 = [37 x i8] c"-------------------------Encoding OA\00"
define i32 @main() {
%1 = alloca [65 x i8]
%2 = alloca [65 x i8]
%3 = alloca [67 x i8]
%4 = getelementptr inbounds [65 x i8], [65 x i8]* %1, i64 0, i64 0
%5 = getelementptr inbounds [65 x i8], [65 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds [67 x i8], [67 x i8]* %3, i64 0, i64 0
%7 = call i32 @strlen(i8* %4)
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str, i64 0, i64 0))
%9 = call i32 @ParsingAmr(i8* %5, i32 0)
%10 = call i32 @memset(i8* %6, i32 0, i32 67)
%11 = call i32 @memcpy(i8* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 2)
%12 = getelementptr inbounds [67 x i8], [67 x i8]* %3, i64 0, i64 2
%13 = call i32 @memcpy(i8* %12, i8* %4, i32 %7)
%14 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str.5, i64 0, i64 0))
%15 = call i32 @ParsingAmr(i8* %6, i32 1)
%16 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str.6, i64 0, i64 0))
%17 = call i32 @EncodingAmr(i8* %4, i32 0)
%18 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str.7, i64 0, i64 0))
%19 = call i32 @EncodingAmr(i8* %4, i32 1)
ret i32 0
}