#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 /*<<< orphan*/ uint64_t;

/* Variables and functions */
int /*<<< orphan*/ strtoll(char const *, char **, int);
void fill_array(const char src[], uint64_t dest[], size_t size) {
  char *token;
  dest[0] = strtoll(src, &token, 10);
  int i;
  for (i = 1; i < size; i++) {
    dest[i] = strtoll(token, &token, 10);
  }
}


x86 assembly (clang, -O0):
<fill_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x20(%rbp),%rsi
mov    $0xa,%edx
call   1030 <strtoll@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x1,-0x24(%rbp)
movslq -0x24(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    1180 <fill_array+0x70>
mov    -0x20(%rbp),%rdi
lea    -0x20(%rbp),%rsi
mov    $0xa,%edx
call   1030 <strtoll@plt>
mov    %eax,%edx
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1145 <fill_array+0x35>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fill_array>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%r12
mov    %rsp,%rsi
mov    $0xa,%edx
call   1030 <strtoll@plt>
mov    %eax,(%r12)
cmp    $0x2,%r14
jb     115e <fill_array+0x4e>
mov    $0x1,%ebx
mov    %rsp,%r15
nopl   (%rax)
mov    (%rsp),%rdi
mov    %r15,%rsi
mov    $0xa,%edx
call   1030 <strtoll@plt>
mov    %eax,(%r12,%rbx,4)
add    $0x1,%rbx
cmp    %rbx,%r14
jne    1140 <fill_array+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

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