#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 */
scalar_t__ calloc(int, int);
unsigned int radixToTen(unsigned int *, int);
unsigned int *outMsg(unsigned int **orgMsg, int radix, int sz) {
  unsigned int *output = (unsigned int *)calloc(sz, sizeof(int));
  int x = 0;
  for (; x < sz; x++)
    output[x] = radixToTen(orgMsg[x], radix);
  return output;
}


x86 assembly (clang, -O0):
<outMsg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x10(%rbp),%edi
mov    $0x4,%esi
call   1040 <calloc@plt>
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1185 <outMsg+0x65>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0xc(%rbp),%esi
call   1030 <radixToTen@plt>
mov    %eax,%edx
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    114a <outMsg+0x2a>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<outMsg>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edx,%r15d
mov    %esi,%r14d
mov    %rdi,%r12
mov    %edx,%edi
mov    $0x4,%esi
call   1040 <calloc@plt>
mov    %rax,%r13
test   %r15d,%r15d
jle    116a <outMsg+0x4a>
mov    %r15d,%ebx
xor    %ebp,%ebp
nopl   (%rax)
mov    (%r12,%rbp,8),%rdi
mov    %r14d,%esi
call   1030 <radixToTen@plt>
mov    %eax,0x0(%r13,%rbp,4)
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    1150 <outMsg+0x30>
mov    %r13,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32* @outMsg(i32** %0, i32 %1, i32 %2) {
%4 = alloca i32**
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i32
store i32** %0, i32*** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%9 = load i32, i32* %6
%10 = call i64 @calloc(i32 %9, i32 4)
%11 = inttoptr i64 %10 to i32*
store i32* %11, i32** %7
store i32 0, i32* %8
br label %12
12: ; preds = %28, %3
%13 = load i32, i32* %8
%14 = load i32, i32* %6
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %31
16: ; preds = %12
%17 = load i32**, i32*** %4
%18 = load i32, i32* %8
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i32*, i32** %17, i64 %19
%21 = load i32*, i32** %20
%22 = load i32, i32* %5
%23 = call i32 @radixToTen(i32* %21, i32 %22)
%24 = load i32*, i32** %7
%25 = load i32, i32* %8
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i32, i32* %24, i64 %26
store i32 %23, i32* %27
br label %28
28: ; preds = %16
%29 = load i32, i32* %8
%30 = add nsw i32 %29, 1
store i32 %30, i32* %8
br label %12
31: ; preds = %12
%32 = load i32*, i32** %7
ret i32* %32
}

LLVM IR (-O2):
define i32* @outMsg(i32** nocapture %0, i32 %1, i32 %2) {
%4 = tail call i64 @calloc(i32 %2, i32 4)
%5 = inttoptr i64 %4 to i32*
%6 = icmp sgt i32 %2, 0
br i1 %6, label %7, label %17
7: ; preds = %3
%8 = zext i32 %2 to i64
br label %9
9: ; preds = %7, %9
%10 = phi i64 [ 0, %7 ], [ %15, %9 ]
%11 = getelementptr inbounds i32*, i32** %0, i64 %10
%12 = load i32*, i32** %11
%13 = tail call i32 @radixToTen(i32* %12, i32 %1)
%14 = getelementptr inbounds i32, i32* %5, i64 %10
store i32 %13, i32* %14
%15 = add nuw nsw i64 %10, 1
%16 = icmp eq i64 %15, %8
br i1 %16, label %17, label %9
17: ; preds = %9, %3
ret i32* %5
}