#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 pow(int, int);
int numsplit(int num, int store[]) {
  int i;
  int powr[100];
  for (i = 1; i <= 100; ++i)
    powr[i] = pow(10, i);
  store[0] = num % powr[1];
}


x86 assembly (clang, -O0):
<numsplit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1b0,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
cmpl   $0x64,-0x14(%rbp)
jg     115b <numsplit+0x4b>
mov    -0x14(%rbp),%esi
mov    $0xa,%edi
call   1030 <pow@plt>
mov    %eax,%ecx
movslq -0x14(%rbp),%rax
mov    %ecx,-0x1b0(%rbp,%rax,4)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1129 <numsplit+0x19>
mov    -0x8(%rbp),%eax
cltd
idivl  -0x1ac(%rbp)
mov    -0x10(%rbp),%rax
mov    %edx,(%rax)
mov    -0x4(%rbp),%eax
add    $0x1b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<numsplit>:
push   %rbp
push   %r14
push   %rbx
sub    $0x190,%rsp
mov    %rsi,%r14
mov    %edi,%ebp
mov    $0x1,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
mov    $0xa,%edi
mov    %ebx,%esi
call   1030 <pow@plt>
mov    %eax,(%rsp,%rbx,4)
lea    0x1(%rbx),%esi
mov    $0xa,%edi
call   1030 <pow@plt>
mov    %eax,0x4(%rsp,%rbx,4)
lea    0x2(%rbx),%esi
mov    $0xa,%edi
call   1030 <pow@plt>
mov    %eax,0x8(%rsp,%rbx,4)
lea    0x3(%rbx),%esi
mov    $0xa,%edi
call   1030 <pow@plt>
mov    %eax,0xc(%rsp,%rbx,4)
lea    0x4(%rbx),%esi
mov    $0xa,%edi
call   1030 <pow@plt>
mov    %eax,0x10(%rsp,%rbx,4)
add    $0x5,%rbx
cmp    $0x65,%rbx
jne    1130 <numsplit+0x20>
mov    %ebp,%eax
cltd
idivl  0x4(%rsp)
mov    %edx,(%r14)
add    $0x190,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @numsplit(i32 %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32
%7 = alloca [100 x i32]
store i32 %0, i32* %4
store i32* %1, i32** %5
store i32 1, i32* %6
br label %8
8: ; preds = %17, %2
%9 = load i32, i32* %6
%10 = icmp sle i32 %9, 100
br i1 %10, label %11, label %20
11: ; preds = %8
%12 = load i32, i32* %6
%13 = call i32 @pow(i32 10, i32 %12)
%14 = load i32, i32* %6
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [100 x i32], [100 x i32]* %7, i64 0, i64 %15
store i32 %13, i32* %16
br label %17
17: ; preds = %11
%18 = load i32, i32* %6
%19 = add nsw i32 %18, 1
store i32 %19, i32* %6
br label %8
20: ; preds = %8
%21 = load i32, i32* %4
%22 = getelementptr inbounds [100 x i32], [100 x i32]* %7, i64 0, i64 1
%23 = load i32, i32* %22
%24 = srem i32 %21, %23
%25 = load i32*, i32** %5
%26 = getelementptr inbounds i32, i32* %25, i64 0
store i32 %24, i32* %26
%27 = load i32, i32* %3
ret i32 %27
}

LLVM IR (-O2):
define i32 @numsplit(i32 %0, i32* nocapture writeonly %1) {
%3 = alloca [100 x i32]
%4 = bitcast [100 x i32]* %3 to i8*
br label %5
5: ; preds = %5, %2
%6 = phi i64 [ 1, %2 ], [ %26, %5 ]
%7 = trunc i64 %6 to i32
%8 = tail call i32 @pow(i32 10, i32 %7)
%9 = getelementptr inbounds [100 x i32], [100 x i32]* %3, i64 0, i64 %6
store i32 %8, i32* %9
%10 = add nuw nsw i64 %6, 1
%11 = trunc i64 %10 to i32
%12 = tail call i32 @pow(i32 10, i32 %11)
%13 = getelementptr inbounds [100 x i32], [100 x i32]* %3, i64 0, i64 %10
store i32 %12, i32* %13
%14 = add nuw nsw i64 %6, 2
%15 = trunc i64 %14 to i32
%16 = tail call i32 @pow(i32 10, i32 %15)
%17 = getelementptr inbounds [100 x i32], [100 x i32]* %3, i64 0, i64 %14
store i32 %16, i32* %17
%18 = add nuw nsw i64 %6, 3
%19 = trunc i64 %18 to i32
%20 = tail call i32 @pow(i32 10, i32 %19)
%21 = getelementptr inbounds [100 x i32], [100 x i32]* %3, i64 0, i64 %18
store i32 %20, i32* %21
%22 = add nuw nsw i64 %6, 4
%23 = trunc i64 %22 to i32
%24 = tail call i32 @pow(i32 10, i32 %23)
%25 = getelementptr inbounds [100 x i32], [100 x i32]* %3, i64 0, i64 %22
store i32 %24, i32* %25
%26 = add nuw nsw i64 %6, 5
%27 = icmp eq i64 %26, 101
br i1 %27, label %28, label %5
28: ; preds = %5
%29 = getelementptr inbounds [100 x i32], [100 x i32]* %3, i64 0, i64 1
%30 = load i32, i32* %29
%31 = srem i32 %0, %30
store i32 %31, i32* %1
ret i32 undef
}