#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 BCDToAscii(int);
int asciiToBCD(int);
int bit_reverse(int);
unsigned char ccipher(char, int);
int /*<<< orphan*/ char_reverse(char *, int);
unsigned char cipher(char);
int /*<<< orphan*/ fib(int, int *);
int /*<<< orphan*/ word_reverse(char *, int);
int /*<<< orphan*/ word_reverse_compiled(char *, int);
int __main(void) {
  int store[20];
  volatile unsigned char r;
  char text[] = "1234";
  char test[] = "hello";
  volatile int result = asciiToBCD(0x30);
  result = asciiToBCD(0x3239);
  result = BCDToAscii(0x1234);
  result = BCDToAscii(0x0);
  r = cipher('A');
  r = cipher('Z');
  r = ccipher('A', 5);
  result = bit_reverse(0xAAAA0000);
  fib(20, store);
  char_reverse(text, 4);
  word_reverse(text, 4);
  word_reverse(test, 5);
  word_reverse_compiled(text, 4);
  word_reverse_compiled(test, 5);
  return 0;
}


x86 assembly (clang, -O0):
<__main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    0xe62(%rip),%eax
mov    %eax,-0x56(%rbp)
mov    0xe5d(%rip),%al
mov    %al,-0x52(%rbp)
mov    0xe55(%rip),%eax
mov    %eax,-0x5c(%rbp)
mov    0xe4f(%rip),%ax
mov    %ax,-0x58(%rbp)
mov    $0x30,%edi
call   1080 <asciiToBCD@plt>
mov    %eax,-0x60(%rbp)
mov    $0x3239,%edi
call   1080 <asciiToBCD@plt>
mov    %eax,-0x60(%rbp)
mov    $0x1234,%edi
call   1030 <BCDToAscii@plt>
mov    %eax,-0x60(%rbp)
xor    %edi,%edi
call   1030 <BCDToAscii@plt>
mov    %eax,-0x60(%rbp)
mov    $0x41,%edi
call   10a0 <cipher@plt>
mov    %al,-0x51(%rbp)
mov    $0x5a,%edi
call   10a0 <cipher@plt>
mov    %al,-0x51(%rbp)
mov    $0x41,%edi
mov    $0x5,%esi
call   10b0 <ccipher@plt>
mov    %al,-0x51(%rbp)
mov    $0xaaaa0000,%edi
call   1060 <bit_reverse@plt>
mov    %eax,-0x60(%rbp)
lea    -0x50(%rbp),%rsi
mov    $0x14,%edi
call   1090 <fib@plt>
lea    -0x56(%rbp),%rdi
mov    $0x4,%esi
call   1070 <char_reverse@plt>
lea    -0x56(%rbp),%rdi
mov    $0x4,%esi
call   1050 <word_reverse@plt>
lea    -0x5c(%rbp),%rdi
mov    $0x5,%esi
call   1050 <word_reverse@plt>
lea    -0x56(%rbp),%rdi
mov    $0x4,%esi
call   1040 <word_reverse_compiled@plt>
lea    -0x5c(%rbp),%rdi
mov    $0x5,%esi
call   1040 <word_reverse_compiled@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__main>:
push   %r14
push   %rbx
sub    $0x78,%rsp
movb   $0x0,0x14(%rsp)
movl   $0x34333231,0x10(%rsp)
34
movw   $0x6f,0x1c(%rsp)
movl   $0x6c6c6568,0x18(%rsp)
6c
mov    $0x30,%edi
call   1080 <asciiToBCD@plt>
mov    %eax,0xc(%rsp)
mov    $0x3239,%edi
call   1080 <asciiToBCD@plt>
mov    %eax,0xc(%rsp)
mov    $0x1234,%edi
call   1030 <BCDToAscii@plt>
mov    %eax,0xc(%rsp)
xor    %edi,%edi
call   1030 <BCDToAscii@plt>
mov    %eax,0xc(%rsp)
mov    $0x41,%edi
call   10a0 <cipher@plt>
mov    %al,0xb(%rsp)
mov    $0x5a,%edi
call   10a0 <cipher@plt>
mov    %al,0xb(%rsp)
mov    $0x41,%edi
mov    $0x5,%esi
call   10b0 <ccipher@plt>
mov    %al,0xb(%rsp)
mov    $0xaaaa0000,%edi
call   1060 <bit_reverse@plt>
mov    %eax,0xc(%rsp)
lea    0x20(%rsp),%rsi
mov    $0x14,%edi
call   1090 <fib@plt>
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x4,%esi
call   1070 <char_reverse@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
call   1050 <word_reverse@plt>
lea    0x18(%rsp),%r14
mov    %r14,%rdi
mov    $0x5,%esi
call   1050 <word_reverse@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
call   1040 <word_reverse_compiled@plt>
mov    %r14,%rdi
mov    $0x5,%esi
call   1040 <word_reverse_compiled@plt>
xor    %eax,%eax
add    $0x78,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.__main.text = [5 x i8] c"1234\00"
@__const.__main.test = [6 x i8] c"hello\00"
define i32 @__main() {
%1 = alloca [20 x i32]
%2 = alloca i8
%3 = alloca [5 x i8]
%4 = alloca [6 x i8]
%5 = alloca i32
%6 = bitcast [5 x i8]* %3 to i8*
%7 = bitcast [6 x i8]* %4 to i8*
%8 = call i32 @asciiToBCD(i32 48)
store volatile i32 %8, i32* %5
%9 = call i32 @asciiToBCD(i32 12857)
store volatile i32 %9, i32* %5
%10 = call i32 @BCDToAscii(i32 4660)
store volatile i32 %10, i32* %5
%11 = call i32 @BCDToAscii(i32 0)
store volatile i32 %11, i32* %5
%12 = call zeroext i8 @cipher(i8 signext 65)
store volatile i8 %12, i8* %2
%13 = call zeroext i8 @cipher(i8 signext 90)
store volatile i8 %13, i8* %2
%14 = call zeroext i8 @ccipher(i8 signext 65, i32 5)
store volatile i8 %14, i8* %2
%15 = call i32 @bit_reverse(i32 -1431699456)
store volatile i32 %15, i32* %5
%16 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 0
%17 = call i32 @fib(i32 20, i32* %16)
%18 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 0
%19 = call i32 @char_reverse(i8* %18, i32 4)
%20 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 0
%21 = call i32 @word_reverse(i8* %20, i32 4)
%22 = getelementptr inbounds [6 x i8], [6 x i8]* %4, i64 0, i64 0
%23 = call i32 @word_reverse(i8* %22, i32 5)
%24 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 0
%25 = call i32 @word_reverse_compiled(i8* %24, i32 4)
%26 = getelementptr inbounds [6 x i8], [6 x i8]* %4, i64 0, i64 0
%27 = call i32 @word_reverse_compiled(i8* %26, i32 5)
ret i32 0
}

LLVM IR (-O2):
@__const.__main.text = [5 x i8] c"1234\00"
@__const.__main.test = [6 x i8] c"hello\00"
define i32 @__main() {
%1 = alloca [20 x i32]
%2 = alloca i8
%3 = alloca [5 x i8]
%4 = alloca [6 x i8]
%5 = alloca i32
%6 = bitcast [20 x i32]* %1 to i8*
%7 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 0
%8 = getelementptr inbounds [6 x i8], [6 x i8]* %4, i64 0, i64 0
%9 = bitcast i32* %5 to i8*
%10 = tail call i32 @asciiToBCD(i32 48)
store volatile i32 %10, i32* %5
%11 = tail call i32 @asciiToBCD(i32 12857)
store volatile i32 %11, i32* %5
%12 = tail call i32 @BCDToAscii(i32 4660)
store volatile i32 %12, i32* %5
%13 = tail call i32 @BCDToAscii(i32 0)
store volatile i32 %13, i32* %5
%14 = tail call zeroext i8 @cipher(i8 signext 65)
store volatile i8 %14, i8* %2
%15 = tail call zeroext i8 @cipher(i8 signext 90)
store volatile i8 %15, i8* %2
%16 = tail call zeroext i8 @ccipher(i8 signext 65, i32 5)
store volatile i8 %16, i8* %2
%17 = tail call i32 @bit_reverse(i32 -1431699456)
store volatile i32 %17, i32* %5
%18 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 0
%19 = call i32 @fib(i32 20, i32* %18)
%20 = call i32 @char_reverse(i8* %7, i32 4)
%21 = call i32 @word_reverse(i8* %7, i32 4)
%22 = call i32 @word_reverse(i8* %8, i32 5)
%23 = call i32 @word_reverse_compiled(i8* %7, i32 4)
%24 = call i32 @word_reverse_compiled(i8* %8, i32 5)
ret i32 0
}