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

/* Variables and functions */
scalar_t__ EOF;
scalar_t__ getline(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ strcpy(char *, char *);
char *strtok(char *, char *);
int read(char (*Info)[100], size_t s, FILE *pf) {
  char str[100];
  int pos = 0;
  if (getline(str, 100, pf) == EOF)
    return EOF;
  char *delims = ",";
  char *result = strtok(str, delims);
  while (result != NULL) {
    strcpy(Info[pos++], result);
    if (pos >= s)
      break;
    result = strtok(NULL, delims);
  }
  return 1;
}


x86 assembly (clang, -O0):
<read>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
movl   $0x0,-0x94(%rbp)
lea    -0x90(%rbp),%rdi
mov    -0x20(%rbp),%rdx
mov    $0x64,%esi
call   1050 <getline@plt>
mov    0x2e7b(%rip),%rcx
cmp    (%rcx),%rax
jne    1188 <read+0x58>
mov    0x2e6b(%rip),%rax
mov    (%rax),%rax
mov    %eax,-0x4(%rbp)
jmp    1221 <read+0xf1>
lea    0xe71(%rip),%rax
mov    %rax,-0xa0(%rbp)
lea    -0x90(%rbp),%rdi
mov    -0xa0(%rbp),%rsi
call   1040 <strtok@plt>
mov    %rax,-0xa8(%rbp)
cmpq   $0x0,-0xa8(%rbp)
je     121a <read+0xea>
mov    -0x10(%rbp),%rdi
mov    -0x94(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x94(%rbp)
cltq
imul   $0x64,%rax,%rax
add    %rax,%rdi
mov    -0xa8(%rbp),%rsi
call   1030 <strcpy@plt>
movslq -0x94(%rbp),%rax
cmp    -0x18(%rbp),%rax
jb     11fe <read+0xce>
jmp    121a <read+0xea>
mov    -0xa0(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edi
call   1040 <strtok@plt>
mov    %rax,-0xa8(%rbp)
jmp    11b0 <read+0x80>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x68,%rsp
mov    %rsi,%r15
mov    %rdi,%r12
mov    %rsp,%rdi
mov    $0x64,%esi
call   1050 <getline@plt>
mov    %rax,%r14
mov    0x2e90(%rip),%rax
cmp    (%rax),%r14
je     11b4 <read+0x84>
lea    0xe9c(%rip),%rsi
mov    %rsp,%rdi
call   1040 <strtok@plt>
mov    $0x1,%r14d
test   %rax,%rax
je     11b4 <read+0x84>
cmp    $0x2,%r15
mov    $0x1,%ebx
cmovae %r15,%rbx
lea    0xe75(%rip),%r15
nopl   0x0(%rax,%rax,1)
mov    %r12,%rdi
mov    %rax,%rsi
call   1030 <strcpy@plt>
add    $0xffffffffffffffff,%rbx
je     11b4 <read+0x84>
add    $0x64,%r12
xor    %edi,%edi
mov    %r15,%rsi
call   1040 <strtok@plt>
test   %rax,%rax
jne    1190 <read+0x60>
mov    %r14d,%eax
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@EOF = global i64 0
@.str = [2 x i8] c",\00"
define i32 @read([100 x i8]* %0, i64 %1, i32* %2) {
%4 = alloca i32
%5 = alloca [100 x i8]*
%6 = alloca i64
%7 = alloca i32*
%8 = alloca [100 x i8]
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i8*
store [100 x i8]* %0, [100 x i8]** %5
store i64 %1, i64* %6
store i32* %2, i32** %7
store i32 0, i32* %9
%12 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%13 = load i32*, i32** %7
%14 = call i64 @getline(i8* %12, i32 100, i32* %13)
%15 = load i64, i64* @EOF
%16 = icmp eq i64 %14, %15
br i1 %16, label %17, label %20
17: ; preds = %3
%18 = load i64, i64* @EOF
%19 = trunc i64 %18 to i32
store i32 %19, i32* %4
br label %45
20: ; preds = %3
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %10
%21 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%22 = load i8*, i8** %10
%23 = call i8* @strtok(i8* %21, i8* %22)
store i8* %23, i8** %11
br label %24
24: ; preds = %41, %20
%25 = load i8*, i8** %11
%26 = icmp ne i8* %25, null
br i1 %26, label %27, label %44
27: ; preds = %24
%28 = load [100 x i8]*, [100 x i8]** %5
%29 = load i32, i32* %9
%30 = add nsw i32 %29, 1
store i32 %30, i32* %9
%31 = sext i32 %29 to i64
%32 = getelementptr inbounds [100 x i8], [100 x i8]* %28, i64 %31
%33 = getelementptr inbounds [100 x i8], [100 x i8]* %32, i64 0, i64 0
%34 = load i8*, i8** %11
%35 = call i32 @strcpy(i8* %33, i8* %34)
%36 = load i32, i32* %9
%37 = sext i32 %36 to i64
%38 = load i64, i64* %6
%39 = icmp uge i64 %37, %38
br i1 %39, label %40, label %41
40: ; preds = %27
br label %44
41: ; preds = %27
%42 = load i8*, i8** %10
%43 = call i8* @strtok(i8* null, i8* %42)
store i8* %43, i8** %11
br label %24
44: ; preds = %40, %24
store i32 1, i32* %4
br label %45
45: ; preds = %44, %17
%46 = load i32, i32* %4
ret i32 %46
}

LLVM IR (-O2):
@EOF = global i64 0
@.str = [2 x i8] c",\00"
define i32 @read([100 x i8]* %0, i64 %1, i32* %2) {
%4 = alloca [100 x i8]
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%6 = call i64 @getline(i8* %5, i32 100, i32* %2)
%7 = load i64, i64* @EOF
%8 = icmp eq i64 %6, %7
br i1 %8, label %9, label %11
9: ; preds = %3
%10 = trunc i64 %6 to i32
br label %27
11: ; preds = %3
%12 = call i8* @strtok(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%13 = icmp eq i8* %12, null
br i1 %13, label %27, label %14
14: ; preds = %11
%15 = call i64 @llvm.umax.i64(i64 %1, i64 1)
%16 = add i64 %15, -1
br label %17
17: ; preds = %14, %23
%18 = phi i64 [ 0, %14 ], [ %24, %23 ]
%19 = phi i8* [ %12, %14 ], [ %25, %23 ]
%20 = getelementptr inbounds [100 x i8], [100 x i8]* %0, i64 %18, i64 0
%21 = call i32 @strcpy(i8* %20, i8* %19)
%22 = icmp eq i64 %18, %16
br i1 %22, label %27, label %23
23: ; preds = %17
%24 = add nuw i64 %18, 1
%25 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%26 = icmp eq i8* %25, null
br i1 %26, label %27, label %17
27: ; preds = %17, %23, %11, %9
%28 = phi i32 [ %10, %9 ], [ 1, %11 ], [ 1, %23 ], [ 1, %17 ]
ret i32 %28
}