#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 uint32_t;

/* Variables and functions */
int /*<<< orphan*/ convertToBase(int *, char *, int);
int /*<<< orphan*/ printf(char *, int, char *);
void test(int base) {
  uint32_t a[8] = {
      0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
      0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
  };
  uint32_t b[8] = {1, 2, 3, 4, 5, 6, 7, 8};
  uint32_t c[3] = {0x1, 0x7f, 0xff};
  char buf[500];
  convertToBase(a, buf, base);
  printf("%2d : %s\n", base, buf);
  convertToBase(b, buf, base);
  printf("%2d : %s\n", base, buf);
  convertToBase(c, buf, base);
  printf("%2d : %s\n", base, buf);
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x250,%rsp
mov    %edi,-0x4(%rbp)
mov    0xecb(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xec8(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xec5(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xec2(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xebf(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    0xebc(%rip),%rax
mov    %rax,-0x48(%rbp)
mov    0xeb9(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xeb6(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    0xeb3(%rip),%rax
mov    %rax,-0x5c(%rbp)
mov    0xeb1(%rip),%eax
mov    %eax,-0x54(%rbp)
lea    -0x30(%rbp),%rdi
lea    -0x250(%rbp),%rsi
mov    -0x4(%rbp),%edx
call   1040 <convertToBase@plt>
mov    -0x4(%rbp),%esi
lea    -0x250(%rbp),%rdx
lea    0xe8e(%rip),%rdi
call   1030 <printf@plt>
lea    -0x50(%rbp),%rdi
lea    -0x250(%rbp),%rsi
mov    -0x4(%rbp),%edx
call   1040 <convertToBase@plt>
mov    -0x4(%rbp),%esi
lea    -0x250(%rbp),%rdx
lea    0xe65(%rip),%rdi
call   1030 <printf@plt>
lea    -0x5c(%rbp),%rdi
lea    -0x250(%rbp),%rsi
mov    -0x4(%rbp),%edx
call   1040 <convertToBase@plt>
mov    -0x4(%rbp),%esi
lea    -0x250(%rbp),%rdx
lea    0xe3c(%rip),%rdi
call   1030 <printf@plt>
add    $0x250,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
push   %r15
push   %r14
push   %rbx
sub    $0x250,%rsp
mov    %edi,%ebx
pcmpeqd %xmm0,%xmm0
movdqa %xmm0,0x40(%rsp)
movdqa %xmm0,0x30(%rsp)
movaps 0xecb(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xeaf(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
mov    0xecc(%rip),%eax
mov    %eax,0x8(%rsp)
mov    0xeb9(%rip),%rax
mov    %rax,(%rsp)
lea    0x30(%rsp),%rdi
lea    0x50(%rsp),%r14
mov    %r14,%rsi
mov    %ebx,%edx
call   1040 <convertToBase@plt>
lea    0xea6(%rip),%r15
mov    %r15,%rdi
mov    %ebx,%esi
mov    %r14,%rdx
call   1030 <printf@plt>
lea    0x10(%rsp),%rdi
mov    %r14,%rsi
mov    %ebx,%edx
call   1040 <convertToBase@plt>
mov    %r15,%rdi
mov    %ebx,%esi
mov    %r14,%rdx
call   1030 <printf@plt>
mov    %rsp,%rdi
mov    %r14,%rsi
mov    %ebx,%edx
call   1040 <convertToBase@plt>
mov    %r15,%rdi
mov    %ebx,%esi
mov    %r14,%rdx
call   1030 <printf@plt>
add    $0x250,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.test.a = [8 x i32] [i32 -1, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1]
@__const.test.b = [8 x i32] [i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8]
@__const.test.c = [3 x i32] [i32 1, i32 127, i32 255]
@.str = [10 x i8] c"%2d : %s\0A\00"
define void @test(i32 %0) {
%2 = alloca i32
%3 = alloca [8 x i32]
%4 = alloca [8 x i32]
%5 = alloca [3 x i32]
%6 = alloca [500 x i8]
store i32 %0, i32* %2
%7 = bitcast [8 x i32]* %3 to i8*
%8 = bitcast [8 x i32]* %4 to i8*
%9 = bitcast [3 x i32]* %5 to i8*
%10 = getelementptr inbounds [8 x i32], [8 x i32]* %3, i64 0, i64 0
%11 = getelementptr inbounds [500 x i8], [500 x i8]* %6, i64 0, i64 0
%12 = load i32, i32* %2
%13 = call i32 @convertToBase(i32* %10, i8* %11, i32 %12)
%14 = load i32, i32* %2
%15 = getelementptr inbounds [500 x i8], [500 x i8]* %6, i64 0, i64 0
%16 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %14, i8* %15)
%17 = getelementptr inbounds [8 x i32], [8 x i32]* %4, i64 0, i64 0
%18 = getelementptr inbounds [500 x i8], [500 x i8]* %6, i64 0, i64 0
%19 = load i32, i32* %2
%20 = call i32 @convertToBase(i32* %17, i8* %18, i32 %19)
%21 = load i32, i32* %2
%22 = getelementptr inbounds [500 x i8], [500 x i8]* %6, i64 0, i64 0
%23 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %21, i8* %22)
%24 = getelementptr inbounds [3 x i32], [3 x i32]* %5, i64 0, i64 0
%25 = getelementptr inbounds [500 x i8], [500 x i8]* %6, i64 0, i64 0
%26 = load i32, i32* %2
%27 = call i32 @convertToBase(i32* %24, i8* %25, i32 %26)
%28 = load i32, i32* %2
%29 = getelementptr inbounds [500 x i8], [500 x i8]* %6, i64 0, i64 0
%30 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %28, i8* %29)
ret void
}

LLVM IR (-O2):
@__const.test.b = [8 x i32] [i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8]
@__const.test.c = [3 x i32] [i32 1, i32 127, i32 255]
@.str = [10 x i8] c"%2d : %s\0A\00"
define void @test(i32 %0) {
%2 = alloca [8 x i32]
%3 = alloca [8 x i32]
%4 = alloca [3 x i32]
%5 = alloca [500 x i8]
%6 = bitcast [8 x i32]* %2 to i8*
%7 = bitcast [8 x i32]* %3 to i8*
%8 = bitcast [3 x i32]* %4 to i8*
%9 = getelementptr inbounds [500 x i8], [500 x i8]* %5, i64 0, i64 0
%10 = getelementptr inbounds [8 x i32], [8 x i32]* %2, i64 0, i64 0
%11 = call i32 @convertToBase(i32* %10, i8* %9, i32 %0)
%12 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %0, i8* %9)
%13 = getelementptr inbounds [8 x i32], [8 x i32]* %3, i64 0, i64 0
%14 = call i32 @convertToBase(i32* %13, i8* %9, i32 %0)
%15 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %0, i8* %9)
%16 = getelementptr inbounds [3 x i32], [3 x i32]* %4, i64 0, i64 0
%17 = call i32 @convertToBase(i32* %16, i8* %9, i32 %0)
%18 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %0, i8* %9)
ret void
}