#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*/ Copy(unsigned int *, unsigned int *);
unsigned int Div(unsigned int *, int);
int ZeroCheck(unsigned int *);
void ToDecimal(unsigned a[], unsigned w[]) {
  int i;
  unsigned b[500];
  Copy(a, b);
  for (i = 0; i < 601; i++)
    w[i] = 0;
  i = 0;
  while (ZeroCheck(b) == -1)
    w[i++] = Div(b, 10000);
}


x86 assembly (clang, -O0):
<ToDecimal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x7f0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x7f0(%rbp),%rsi
call   1030 <Copy@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x259,-0x14(%rbp)
jge    1184 <ToDecimal+0x54>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    115a <ToDecimal+0x2a>
movl   $0x0,-0x14(%rbp)
lea    -0x7f0(%rbp),%rdi
call   1050 <ZeroCheck@plt>
cmp    $0xffffffff,%eax
jne    11cd <ToDecimal+0x9d>
lea    -0x7f0(%rbp),%rdi
mov    $0x2710,%esi
call   1040 <Div@plt>
mov    %eax,%edx
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    %esi,-0x14(%rbp)
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
jmp    118b <ToDecimal+0x5b>
add    $0x7f0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ToDecimal>:
push   %r14
push   %rbx
sub    $0x7d8,%rsp
mov    %rsi,%rbx
mov    %rsp,%r14
mov    %r14,%rsi
call   1030 <Copy@plt>
mov    $0x964,%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1060 <memset@plt>
mov    %r14,%rdi
call   1050 <ZeroCheck@plt>
cmp    $0xffffffff,%eax
jne    11a0 <ToDecimal+0x60>
mov    %rsp,%r14
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    $0x2710,%esi
call   1040 <Div@plt>
mov    %eax,(%rbx)
mov    %r14,%rdi
call   1050 <ZeroCheck@plt>
add    $0x4,%rbx
cmp    $0xffffffff,%eax
je     1180 <ToDecimal+0x40>
add    $0x7d8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @ToDecimal(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32
%6 = alloca [500 x i32]
store i32* %0, i32** %3
store i32* %1, i32** %4
%7 = load i32*, i32** %3
%8 = getelementptr inbounds [500 x i32], [500 x i32]* %6, i64 0, i64 0
%9 = call i32 @Copy(i32* %7, i32* %8)
store i32 0, i32* %5
br label %10
10: ; preds = %18, %2
%11 = load i32, i32* %5
%12 = icmp slt i32 %11, 601
br i1 %12, label %13, label %21
13: ; preds = %10
%14 = load i32*, i32** %4
%15 = load i32, i32* %5
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i32, i32* %14, i64 %16
store i32 0, i32* %17
br label %18
18: ; preds = %13
%19 = load i32, i32* %5
%20 = add nsw i32 %19, 1
store i32 %20, i32* %5
br label %10
21: ; preds = %10
store i32 0, i32* %5
br label %22
22: ; preds = %26, %21
%23 = getelementptr inbounds [500 x i32], [500 x i32]* %6, i64 0, i64 0
%24 = call i32 @ZeroCheck(i32* %23)
%25 = icmp eq i32 %24, -1
br i1 %25, label %26, label %34
26: ; preds = %22
%27 = getelementptr inbounds [500 x i32], [500 x i32]* %6, i64 0, i64 0
%28 = call i32 @Div(i32* %27, i32 10000)
%29 = load i32*, i32** %4
%30 = load i32, i32* %5
%31 = add nsw i32 %30, 1
store i32 %31, i32* %5
%32 = sext i32 %30 to i64
%33 = getelementptr inbounds i32, i32* %29, i64 %32
store i32 %28, i32* %33
br label %22
34: ; preds = %22
ret void
}

LLVM IR (-O2):
define void @ToDecimal(i32* %0, i32* nocapture writeonly %1) {
%3 = bitcast i32* %1 to i8*
%4 = alloca [500 x i32]
%5 = bitcast [500 x i32]* %4 to i8*
%6 = getelementptr inbounds [500 x i32], [500 x i32]* %4, i64 0, i64 0
%7 = call i32 @Copy(i32* %0, i32* %6)
%8 = call i32 @ZeroCheck(i32* %6)
%9 = icmp eq i32 %8, -1
br i1 %9, label %10, label %17
10: ; preds = %2, %10
%11 = phi i64 [ %13, %10 ], [ 0, %2 ]
%12 = call i32 @Div(i32* %6, i32 10000)
%13 = add nuw i64 %11, 1
%14 = getelementptr inbounds i32, i32* %1, i64 %11
store i32 %12, i32* %14
%15 = call i32 @ZeroCheck(i32* %6)
%16 = icmp eq i32 %15, -1
br i1 %16, label %10, label %17
17: ; preds = %10, %2
ret void
}