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

/* Variables and functions */
int /*<<< orphan*/ sscanf(char *, char const *, void *);
char *strtok(char *, char *);
void read_sequence(char *line, void *v, int *nvals, char const *format) {
  char *t;
  *nvals = 0;
  t = strtok(line, " ;#\r\n");
  while (t != NULL && *nvals < 300) {
    sscanf(t, format, v + (*nvals) * sizeof(v));
    (*nvals)++;
    t = strtok(NULL, " ;#\r\n");
  }
}


x86 assembly (clang, -O0):
<read_sequence>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x18(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x8(%rbp),%rdi
lea    0xeb3(%rip),%rsi
call   1040 <strtok@plt>
mov    %rax,-0x28(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x28(%rbp)
mov    %al,-0x29(%rbp)
je     1176 <read_sequence+0x56>
mov    -0x18(%rbp),%rax
cmpl   $0x12c,(%rax)
setl   %al
mov    %al,-0x29(%rbp)
mov    -0x29(%rbp),%al
test   $0x1,%al
jne    1186 <read_sequence+0x66>
jmp    11c9 <read_sequence+0xa9>
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rax
movslq (%rax),%rax
shl    $0x3,%rax
add    %rax,%rdx
call   1030 <sscanf@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
xor    %eax,%eax
mov    %eax,%edi
lea    0xe45(%rip),%rsi
call   1040 <strtok@plt>
mov    %rax,-0x28(%rbp)
jmp    1156 <read_sequence+0x36>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_sequence>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %rdx,%rbx
mov    %rsi,%r15
movl   $0x0,(%rdx)
lea    0xec2(%rip),%rsi
call   1040 <strtok@plt>
test   %rax,%rax
je     117d <read_sequence+0x5d>
lea    0xeb1(%rip),%r12
nop
movslq (%rbx),%rcx
cmp    $0x12b,%rcx
jg     117d <read_sequence+0x5d>
lea    (%r15,%rcx,8),%rdx
mov    %rax,%rdi
mov    %r14,%rsi
call   1030 <sscanf@plt>
addl   $0x1,(%rbx)
xor    %edi,%edi
mov    %r12,%rsi
call   1040 <strtok@plt>
test   %rax,%rax
jne    1150 <read_sequence+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [6 x i8] c" ;#\0D\0A\00"
define void @read_sequence(i8* %0, i8* %1, i32* %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32*
%8 = alloca i8*
%9 = alloca i8*
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32* %2, i32** %7
store i8* %3, i8** %8
%10 = load i32*, i32** %7
store i32 0, i32* %10
%11 = load i8*, i8** %5
%12 = call i8* @strtok(i8* %11, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
store i8* %12, i8** %9
br label %13
13: ; preds = %22, %4
%14 = load i8*, i8** %9
%15 = icmp ne i8* %14, null
br i1 %15, label %16, label %20
16: ; preds = %13
%17 = load i32*, i32** %7
%18 = load i32, i32* %17
%19 = icmp slt i32 %18, 300
br label %20
20: ; preds = %16, %13
%21 = phi i1 [ false, %13 ], [ %19, %16 ]
br i1 %21, label %22, label %36
22: ; preds = %20
%23 = load i8*, i8** %9
%24 = load i8*, i8** %8
%25 = load i8*, i8** %6
%26 = load i32*, i32** %7
%27 = load i32, i32* %26
%28 = sext i32 %27 to i64
%29 = mul i64 %28, 8
%30 = getelementptr i8, i8* %25, i64 %29
%31 = call i32 @sscanf(i8* %23, i8* %24, i8* %30)
%32 = load i32*, i32** %7
%33 = load i32, i32* %32
%34 = add nsw i32 %33, 1
store i32 %34, i32* %32
%35 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
store i8* %35, i8** %9
br label %13
36: ; preds = %20
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c" ;#\0D\0A\00"
define void @read_sequence(i8* %0, i8* %1, i32* nocapture %2, i8* nocapture %3) {
store i32 0, i32* %2
%5 = tail call i8* @strtok(i8* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%6 = icmp eq i8* %5, null
br i1 %6, label %20, label %7
7: ; preds = %4, %11
%8 = phi i8* [ %18, %11 ], [ %5, %4 ]
%9 = load i32, i32* %2
%10 = icmp slt i32 %9, 300
br i1 %10, label %11, label %20
11: ; preds = %7
%12 = sext i32 %9 to i64
%13 = shl nsw i64 %12, 3
%14 = getelementptr i8, i8* %1, i64 %13
%15 = tail call i32 @sscanf(i8* %8, i8* %3, i8* %14)
%16 = load i32, i32* %2
%17 = add nsw i32 %16, 1
store i32 %17, i32* %2
%18 = tail call i8* @strtok(i8* null, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%19 = icmp eq i8* %18, null
br i1 %19, label %20, label %7
20: ; preds = %7, %11, %4
ret void
}