#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*/ CIntOct(int *, int);
scalar_t__ Hex2Dec(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ dispArray(int *, int, int /*<<< orphan*/);
int /*<<< orphan*/ initArray(int *, int);
int /*<<< orphan*/ pow(int, int);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  char target[] = "235";
  int digit = 3;
  int decimalTarget;
  int OctTarget[10];
  decimalTarget = (int)Hex2Dec(target, pow(16, digit - 1), digit);
  printf("%s(16) = %d(10)\n", target, decimalTarget);
  initArray(OctTarget, 10);
  CIntOct(&OctTarget[9], decimalTarget);
  printf("%s(16) = ", target);
  dispArray(OctTarget, 10, 0);
  printf("(8)\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xe8b(%rip),%eax
mov    %eax,-0x8(%rbp)
movl   $0x3,-0xc(%rbp)
lea    -0x8(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0xc(%rbp),%esi
sub    $0x1,%esi
mov    $0x10,%edi
call   1080 <pow@plt>
mov    -0x48(%rbp),%rdi
mov    %eax,%esi
mov    -0xc(%rbp),%edx
call   1070 <Hex2Dec@plt>
mov    %eax,-0x10(%rbp)
lea    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%edx
lea    0xe4e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x40(%rbp),%rdi
mov    $0xa,%esi
call   1050 <initArray@plt>
lea    -0x40(%rbp),%rdi
add    $0x24,%rdi
mov    -0x10(%rbp),%esi
call   1060 <CIntOct@plt>
lea    -0x8(%rbp),%rsi
lea    0xe2f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x40(%rbp),%rdi
mov    $0xa,%esi
xor    %edx,%edx
call   1030 <dispArray@plt>
lea    0xe1b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x40,%rsp
movl   $0x353332,0xc(%rsp)
mov    $0x10,%edi
mov    $0x2,%esi
call   1090 <pow@plt>
lea    0xc(%rsp),%r14
mov    %r14,%rdi
mov    %eax,%esi
mov    $0x3,%edx
call   1080 <Hex2Dec@plt>
mov    %rax,%rbx
lea    0xe52(%rip),%rdi
mov    %r14,%rsi
mov    %ebx,%edx
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x10(%rsp),%r15
mov    %r15,%rdi
mov    $0xa,%esi
call   1060 <initArray@plt>
lea    0x34(%rsp),%rdi
mov    %ebx,%esi
call   1070 <CIntOct@plt>
lea    0xe32(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r15,%rdi
mov    $0xa,%esi
xor    %edx,%edx
call   1030 <dispArray@plt>
lea    0xe1c(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.target = [4 x i8] c"235\00"
@.str = [17 x i8] c"%s(16) = %d(10)\0A\00"
@.str.1 = [10 x i8] c"%s(16) = \00"
@.str.2 = [5 x i8] c"(8)\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [4 x i8]
%3 = alloca i32
%4 = alloca i32
%5 = alloca [10 x i32]
store i32 0, i32* %1
%6 = bitcast [4 x i8]* %2 to i8*
store i32 3, i32* %3
%7 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%8 = load i32, i32* %3
%9 = sub nsw i32 %8, 1
%10 = call i32 @pow(i32 16, i32 %9)
%11 = load i32, i32* %3
%12 = call i64 @Hex2Dec(i8* %7, i32 %10, i32 %11)
%13 = trunc i64 %12 to i32
store i32 %13, i32* %4
%14 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%15 = load i32, i32* %4
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %14, i32 %15)
%17 = getelementptr inbounds [10 x i32], [10 x i32]* %5, i64 0, i64 0
%18 = call i32 @initArray(i32* %17, i32 10)
%19 = getelementptr inbounds [10 x i32], [10 x i32]* %5, i64 0, i64 9
%20 = load i32, i32* %4
%21 = call i32 @CIntOct(i32* %19, i32 %20)
%22 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* %22)
%24 = getelementptr inbounds [10 x i32], [10 x i32]* %5, i64 0, i64 0
%25 = call i32 @dispArray(i32* %24, i32 10, i32 0)
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"%s(16) = %d(10)\0A\00"
@.str.1 = [10 x i8] c"%s(16) = \00"
@str = [4 x i8] c"(8)\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i32]
%3 = bitcast i32* %1 to i8*
store i32 3486514, i32* %1
%4 = bitcast [10 x i32]* %2 to i8*
%5 = tail call i32 @pow(i32 16, i32 2)
%6 = call i64 @Hex2Dec(i8* %3, i32 %5, i32 3)
%7 = trunc i64 %6 to i32
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32* %1, i32 %7)
%9 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%10 = call i32 @initArray(i32* %9, i32 10)
%11 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 9
%12 = call i32 @CIntOct(i32* %11, i32 %7)
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%14 = call i32 @dispArray(i32* %9, i32 10, i32 0)
%15 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str, i64 0, i64 0))
ret i32 0
}