#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 */
long index_of_number(long, long *);
scalar_t__ isspace(char);
long strtol(char *, char **, int /*<<< orphan*/);
long index_of_number_from_string(long number, char *string,
                                 long numberOfLongsInArray) {
  long arrayOfLongs[numberOfLongsInArray];
  char *tail;
  int i = 0;
  while (i != numberOfLongsInArray) {
    long next;
    while (isspace(*string))
      string++;
    arrayOfLongs[i] = strtol(string, &tail, 0);
    ;
    string = tail;
    i++;
  }
  return index_of_number(number, arrayOfLongs);
}


x86 assembly (clang, -O0):
<index_of_number_from_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rsp,%rcx
mov    %rcx,-0x20(%rbp)
lea    0xf(,%rax,8),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x48(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x34(%rbp)
movslq -0x34(%rbp),%rax
cmp    -0x18(%rbp),%rax
je     11e1 <index_of_number_from_string+0xb1>
jmp    1186 <index_of_number_from_string+0x56>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1040 <isspace@plt>
cmp    $0x0,%rax
je     11ad <index_of_number_from_string+0x7d>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1186 <index_of_number_from_string+0x56>
mov    -0x10(%rbp),%rdi
lea    -0x30(%rbp),%rsi
xor    %edx,%edx
call   1050 <strtol@plt>
mov    %rax,%rdx
mov    -0x48(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x30(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1173 <index_of_number_from_string+0x43>
mov    -0x48(%rbp),%rsi
mov    -0x8(%rbp),%rdi
call   1030 <index_of_number@plt>
mov    -0x20(%rbp),%rcx
mov    %rcx,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<index_of_number_from_string>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdi,-0x30(%rbp)
mov    %rsp,%r12
lea    0xf(,%rdx,8),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r12
mov    %r12,%rsp
test   %rdx,%rdx
je     11b0 <index_of_number_from_string+0x80>
mov    %rdx,%r15
mov    %rsi,%rbx
xor    %r14d,%r14d
lea    -0x38(%rbp),%r13
nopl   0x0(%rax)
add    $0xffffffffffffffff,%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsbl 0x1(%rbx),%edi
add    $0x1,%rbx
call   1040 <isspace@plt>
test   %rax,%rax
jne    1180 <index_of_number_from_string+0x50>
mov    %rbx,%rdi
mov    %r13,%rsi
xor    %edx,%edx
call   1050 <strtol@plt>
mov    %rax,(%r12,%r14,8)
mov    -0x38(%rbp),%rbx
add    $0x1,%r14
cmp    %r15,%r14
jne    1170 <index_of_number_from_string+0x40>
mov    -0x30(%rbp),%rdi
mov    %r12,%rsi
call   1030 <index_of_number@plt>
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i64 @index_of_number_from_string(i64 %0, i8* %1, i64 %2) {
%4 = alloca i64
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i8*
%8 = alloca i64
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i64
store i64 %0, i64* %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%12 = load i64, i64* %6
%13 = call i8* @llvm.stacksave()
store i8* %13, i8** %7
%14 = alloca i64, i64 %12
store i64 %12, i64* %8
store i32 0, i32* %10
br label %15
15: ; preds = %29, %3
%16 = load i32, i32* %10
%17 = sext i32 %16 to i64
%18 = load i64, i64* %6
%19 = icmp ne i64 %17, %18
br i1 %19, label %20, label %38
20: ; preds = %15
br label %21
21: ; preds = %26, %20
%22 = load i8*, i8** %5
%23 = load i8, i8* %22
%24 = call i64 @isspace(i8 signext %23)
%25 = icmp ne i64 %24, 0
br i1 %25, label %26, label %29
26: ; preds = %21
%27 = load i8*, i8** %5
%28 = getelementptr inbounds i8, i8* %27, i32 1
store i8* %28, i8** %5
br label %21
29: ; preds = %21
%30 = load i8*, i8** %5
%31 = call i64 @strtol(i8* %30, i8** %9, i32 0)
%32 = load i32, i32* %10
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i64, i64* %14, i64 %33
store i64 %31, i64* %34
%35 = load i8*, i8** %9
store i8* %35, i8** %5
%36 = load i32, i32* %10
%37 = add nsw i32 %36, 1
store i32 %37, i32* %10
br label %15
38: ; preds = %15
%39 = load i64, i64* %4
%40 = call i64 @index_of_number(i64 %39, i64* %14)
%41 = load i8*, i8** %7
ret i64 %40
}

LLVM IR (-O2):
define i64 @index_of_number_from_string(i64 %0, i8* %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i64, i64 %2
%6 = bitcast i8** %4 to i8*
%7 = icmp eq i64 %2, 0
br i1 %7, label %23, label %8
8: ; preds = %3, %17
%9 = phi i64 [ %21, %17 ], [ 0, %3 ]
%10 = phi i8* [ %20, %17 ], [ %1, %3 ]
br label %11
11: ; preds = %11, %8
%12 = phi i8* [ %16, %11 ], [ %10, %8 ]
%13 = load i8, i8* %12
%14 = tail call i64 @isspace(i8 signext %13)
%15 = icmp eq i64 %14, 0
%16 = getelementptr inbounds i8, i8* %12, i64 1
br i1 %15, label %17, label %11
17: ; preds = %11
%18 = call i64 @strtol(i8* %12, i8** %4, i32 0)
%19 = getelementptr inbounds i64, i64* %5, i64 %9
store i64 %18, i64* %19
%20 = load i8*, i8** %4
%21 = add nuw i64 %9, 1
%22 = icmp eq i64 %21, %2
br i1 %22, label %23, label %8
23: ; preds = %17, %3
%24 = call i64 @index_of_number(i64 %0, i64* %5)
ret i64 %24
}