#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*/ atoi(char *);
scalar_t__ strtok_r(char *, char *, char **);
void bdf_parseintline(char *line, unsigned int count, int *info) {
  char *str, *token, *saveptr1;
  str = line;
  token = (char *)strtok_r(str, " ", &saveptr1);
  while ((token = (char *)strtok_r(NULL, " ", &saveptr1)) && count--) {
    *(info++) = atoi(token);
  }
}


x86 assembly (clang, -O0):
<bdf_parseintline>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xeba(%rip),%rsi
lea    -0x30(%rbp),%rdx
call   1030 <strtok_r@plt>
mov    %rax,-0x28(%rbp)
xor    %eax,%eax
mov    %eax,%edi
lea    0xea2(%rip),%rsi
lea    -0x30(%rbp),%rdx
call   1030 <strtok_r@plt>
mov    %rax,%rcx
mov    %rcx,-0x28(%rbp)
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x31(%rbp)
je     1191 <bdf_parseintline+0x71>
mov    -0xc(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0xc(%rbp)
cmp    $0x0,%eax
setne  %al
mov    %al,-0x31(%rbp)
mov    -0x31(%rbp),%al
test   $0x1,%al
jne    11a1 <bdf_parseintline+0x81>
jmp    11c2 <bdf_parseintline+0xa2>
mov    -0x28(%rbp),%rdi
call   1040 <atoi@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %rax,%rdx
add    $0x4,%rdx
mov    %rdx,-0x18(%rbp)
mov    %ecx,(%rax)
jmp    1153 <bdf_parseintline+0x33>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bdf_parseintline>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %rdx,%r14
mov    %esi,%r13d
lea    0xec6(%rip),%r15
lea    0x8(%rsp),%r12
mov    %r15,%rsi
mov    %r12,%rdx
call   1030 <strtok_r@plt>
xor    %edi,%edi
mov    %r15,%rsi
mov    %r12,%rdx
call   1030 <strtok_r@plt>
test   %rax,%rax
je     11aa <bdf_parseintline+0x8a>
test   %r13d,%r13d
je     11aa <bdf_parseintline+0x8a>
add    $0xffffffff,%r13d
xor    %ebx,%ebx
lea    0xe92(%rip),%r15
lea    0x8(%rsp),%r12
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %rax,%rdi
call   1040 <atoi@plt>
mov    %eax,(%r14,%rbx,4)
xor    %edi,%edi
mov    %r15,%rsi
mov    %r12,%rdx
call   1030 <strtok_r@plt>
test   %rax,%rax
je     11aa <bdf_parseintline+0x8a>
lea    0x1(%rbx),%rcx
cmp    %ebx,%r13d
mov    %rcx,%rbx
jne    1180 <bdf_parseintline+0x60>
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [2 x i8] c" \00"
define void @bdf_parseintline(i8* %0, i32 %1, i32* %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32* %2, i32** %6
%10 = load i8*, i8** %4
store i8* %10, i8** %7
%11 = load i8*, i8** %7
%12 = call i64 @strtok_r(i8* %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %9)
%13 = inttoptr i64 %12 to i8*
store i8* %13, i8** %8
br label %14
14: ; preds = %24, %3
%15 = call i64 @strtok_r(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %9)
%16 = inttoptr i64 %15 to i8*
store i8* %16, i8** %8
%17 = icmp ne i8* %16, null
br i1 %17, label %18, label %22
18: ; preds = %14
%19 = load i32, i32* %5
%20 = add i32 %19, -1
store i32 %20, i32* %5
%21 = icmp ne i32 %19, 0
br label %22
22: ; preds = %18, %14
%23 = phi i1 [ false, %14 ], [ %21, %18 ]
br i1 %23, label %24, label %29
24: ; preds = %22
%25 = load i8*, i8** %8
%26 = call i32 @atoi(i8* %25)
%27 = load i32*, i32** %6
%28 = getelementptr inbounds i32, i32* %27, i32 1
store i32* %28, i32** %6
store i32 %26, i32* %27
br label %14
29: ; preds = %22
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c" \00"
define void @bdf_parseintline(i8* %0, i32 %1, i32* nocapture writeonly %2) {
%4 = alloca i8*
%5 = bitcast i8** %4 to i8*
%6 = call i64 @strtok_r(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %4)
%7 = call i64 @strtok_r(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %4)
%8 = icmp eq i64 %7, 0
%9 = icmp eq i32 %1, 0
%10 = or i1 %8, %9
br i1 %10, label %23, label %11
11: ; preds = %3, %11
%12 = phi i64 [ %19, %11 ], [ %7, %3 ]
%13 = phi i32 [ %16, %11 ], [ %1, %3 ]
%14 = phi i32* [ %18, %11 ], [ %2, %3 ]
%15 = inttoptr i64 %12 to i8*
%16 = add i32 %13, -1
%17 = call i32 @atoi(i8* %15)
%18 = getelementptr inbounds i32, i32* %14, i64 1
store i32 %17, i32* %14
%19 = call i64 @strtok_r(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %4)
%20 = icmp eq i64 %19, 0
%21 = icmp eq i32 %16, 0
%22 = select i1 %20, i1 true, i1 %21
br i1 %22, label %23, label %11
23: ; preds = %11, %3
ret void
}