#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*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ num_to_string(int, int, char *);
int /*<<< orphan*/ printf(char *, int, char *);
void main(void) {
  int x = 114473;
  char *c, *c_ptr;
  c_ptr = c;
  num_to_string(x, 0, c_ptr);
  printf("\n\nNumber is %d converted to DECIMAL is %s\n\n", x, c);
  num_to_string(x, 1, c_ptr);
  printf("Number is %d converted to HEX is %s\n\n", x, c);
  num_to_string(x, 2, c_ptr);
  printf("Number is %d converted to OCT is %s\n\n", x, c);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x1bf29,-0x4(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x18(%rbp),%rdx
xor    %esi,%esi
call   1040 <num_to_string@plt>
mov    -0x4(%rbp),%esi
mov    -0x10(%rbp),%rdx
lea    0xe9d(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%edi
mov    -0x18(%rbp),%rdx
mov    $0x1,%esi
call   1040 <num_to_string@plt>
mov    -0x4(%rbp),%esi
mov    -0x10(%rbp),%rdx
lea    0xea5(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%edi
mov    -0x18(%rbp),%rdx
mov    $0x2,%esi
call   1040 <num_to_string@plt>
mov    -0x4(%rbp),%esi
mov    -0x10(%rbp),%rdx
lea    0xea7(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1bf29,%edi
xor    %esi,%esi
call   1040 <num_to_string@plt>
lea    0xebc(%rip),%rdi
mov    $0x1bf29,%esi
call   1030 <printf@plt>
mov    $0x1bf29,%edi
mov    $0x1,%esi
call   1040 <num_to_string@plt>
lea    0xec8(%rip),%rdi
mov    $0x1bf29,%esi
call   1030 <printf@plt>
mov    $0x1bf29,%edi
mov    $0x2,%esi
call   1040 <num_to_string@plt>
lea    0xece(%rip),%rdi
mov    $0x1bf29,%esi
call   1030 <printf@plt>
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [44 x i8] c"\0A\0ANumber is %d converted to DECIMAL is %s\0A\0A\00"
@.str.1 = [38 x i8] c"Number is %d converted to HEX is %s\0A\0A\00"
@.str.2 = [38 x i8] c"Number is %d converted to OCT is %s\0A\0A\00"
define void @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8*
store i32 114473, i32* %1
%4 = load i8*, i8** %2
store i8* %4, i8** %3
%5 = load i32, i32* %1
%6 = load i8*, i8** %3
%7 = call i32 @num_to_string(i32 %5, i32 0, i8* %6)
%8 = load i32, i32* %1
%9 = load i8*, i8** %2
%10 = call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i32 %8, i8* %9)
%11 = load i32, i32* %1
%12 = load i8*, i8** %3
%13 = call i32 @num_to_string(i32 %11, i32 1, i8* %12)
%14 = load i32, i32* %1
%15 = load i8*, i8** %2
%16 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i32 %14, i8* %15)
%17 = load i32, i32* %1
%18 = load i8*, i8** %3
%19 = call i32 @num_to_string(i32 %17, i32 2, i8* %18)
%20 = load i32, i32* %1
%21 = load i8*, i8** %2
%22 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0), i32 %20, i8* %21)
%23 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [44 x i8] c"\0A\0ANumber is %d converted to DECIMAL is %s\0A\0A\00"
@.str.1 = [38 x i8] c"Number is %d converted to HEX is %s\0A\0A\00"
@.str.2 = [38 x i8] c"Number is %d converted to OCT is %s\0A\0A\00"
define void @main() {
%1 = tail call i32 @num_to_string(i32 114473, i32 0, i8* undef)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i32 114473, i8* undef)
%3 = tail call i32 @num_to_string(i32 114473, i32 1, i8* undef)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i32 114473, i8* undef)
%5 = tail call i32 @num_to_string(i32 114473, i32 2, i8* undef)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0), i32 114473, i8* undef)
%7 = tail call i32 @exit(i32 0)
unreachable
}