#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 convertCharNumberToInt(char *);
char *convertDecimalToBase(long, int);
long convertToDecimal(char *, int, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ getStringLength(char *);
int /*<<< orphan*/ printf(char *, char *, char *, char *, char *);
int main(int argc, char **argv) {
  char *inputNumber = argv[1];
  char *srcBase = argv[2];
  char *destBase = argv[3];
  int srcBaseInt = convertCharNumberToInt(srcBase);
  int destBaseInt = convertCharNumberToInt(destBase);
  long inputNumberLong = convertToDecimal(inputNumber, srcBaseInt, 0,
                                          getStringLength(inputNumber));
  printf("Conversion of %s base %s to base %s is : %s\n", inputNumber, srcBase,
         destBase, convertDecimalToBase(inputNumberLong, destBaseInt));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
call   1070 <convertCharNumberToInt@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x28(%rbp),%rdi
call   1070 <convertCharNumberToInt@plt>
mov    %eax,-0x30(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x60(%rbp)
mov    -0x2c(%rbp),%eax
mov    %eax,-0x54(%rbp)
mov    -0x18(%rbp),%rdi
call   1060 <getStringLength@plt>
mov    -0x60(%rbp),%rdi
mov    -0x54(%rbp),%esi
mov    %eax,%ecx
xor    %edx,%edx
call   1050 <convertToDecimal@plt>
mov    %rax,-0x38(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x38(%rbp),%rdi
mov    -0x30(%rbp),%esi
call   1040 <convertDecimalToBase@plt>
mov    -0x50(%rbp),%rsi
mov    -0x48(%rbp),%rdx
mov    -0x40(%rbp),%rcx
mov    %rax,%r8
lea    0xdf9(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    0x8(%rsi),%rbx
mov    0x10(%rsi),%r14
mov    0x18(%rsi),%r15
mov    %r14,%rdi
call   1070 <convertCharNumberToInt@plt>
mov    %eax,%ebp
mov    %r15,%rdi
call   1070 <convertCharNumberToInt@plt>
mov    %eax,%r12d
mov    %rbx,%rdi
call   1060 <getStringLength@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
xor    %edx,%edx
mov    %eax,%ecx
call   1050 <convertToDecimal@plt>
mov    %rax,%rdi
mov    %r12d,%esi
call   1040 <convertDecimalToBase@plt>
lea    0xe5f(%rip),%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
mov    %r15,%rcx
mov    %rax,%r8
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [45 x i8] c"Conversion of %s base %s to base %s is : %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
store i8* %14, i8** %6
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 2
%17 = load i8*, i8** %16
store i8* %17, i8** %7
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 3
%20 = load i8*, i8** %19
store i8* %20, i8** %8
%21 = load i8*, i8** %7
%22 = call i32 @convertCharNumberToInt(i8* %21)
store i32 %22, i32* %9
%23 = load i8*, i8** %8
%24 = call i32 @convertCharNumberToInt(i8* %23)
store i32 %24, i32* %10
%25 = load i8*, i8** %6
%26 = load i32, i32* %9
%27 = load i8*, i8** %6
%28 = call i32 @getStringLength(i8* %27)
%29 = call i64 @convertToDecimal(i8* %25, i32 %26, i32 0, i32 %28)
store i64 %29, i64* %11
%30 = load i8*, i8** %6
%31 = load i8*, i8** %7
%32 = load i8*, i8** %8
%33 = load i64, i64* %11
%34 = load i32, i32* %10
%35 = call i8* @convertDecimalToBase(i64 %33, i32 %34)
%36 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i8* %30, i8* %31, i8* %32, i8* %35)
ret i32 0
}

LLVM IR (-O2):
@.str = [45 x i8] c"Conversion of %s base %s to base %s is : %s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = getelementptr inbounds i8*, i8** %1, i64 2
%6 = load i8*, i8** %5
%7 = getelementptr inbounds i8*, i8** %1, i64 3
%8 = load i8*, i8** %7
%9 = tail call i32 @convertCharNumberToInt(i8* %6)
%10 = tail call i32 @convertCharNumberToInt(i8* %8)
%11 = tail call i32 @getStringLength(i8* %4)
%12 = tail call i64 @convertToDecimal(i8* %4, i32 %9, i32 0, i32 %11)
%13 = tail call i8* @convertDecimalToBase(i64 %12, i32 %10)
%14 = tail call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i8* %4, i8* %6, i8* %8, i8* %13)
ret i32 0
}