#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 atoi(char *);
char *strtok_r(char *, char *, char **);
void AnalyseSymbolList(char *SymbolList, double *NumberOfSymbols,
                       double *NumberOfArity0, double *MinArity,
                       double *MaxArity) {
  char *SymbolRecord;
  char *RecordRestart;
  char *SymbolField;
  char *FieldRestart;
  int Arity;
  *NumberOfSymbols = 0;
  *NumberOfArity0 = 0;
  *MinArity = -1;
  *MaxArity = -1;
  SymbolRecord = strtok_r(SymbolList, "\n", &RecordRestart);
  while (SymbolRecord != NULL) {
    (*NumberOfSymbols)++;
    SymbolField = strtok_r(SymbolRecord, "/", &FieldRestart);
    SymbolField = strtok_r(NULL, "/", &FieldRestart);
    Arity = atoi(SymbolField);
    if (Arity == 0) {
      (*NumberOfArity0)++;
    }
    if (*MinArity == -1 || Arity < *MinArity) {
      *MinArity = Arity;
    }
    if (*MaxArity == -1 || Arity > *MaxArity) {
      *MaxArity = Arity;
    }
    SymbolRecord = strtok_r(NULL, "\n", &RecordRestart);
  }
}


x86 assembly (clang, -O0):
<AnalyseSymbolList>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x10(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
mov    -0x18(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
mov    -0x20(%rbp),%rax
movsd  0xea2(%rip),%xmm0
movsd  %xmm0,(%rax)
mov    -0x28(%rbp),%rax
movsd  0xe92(%rip),%xmm0
movsd  %xmm0,(%rax)
mov    -0x8(%rbp),%rdi
lea    0xe93(%rip),%rsi
lea    -0x38(%rbp),%rdx
call   1030 <strtok_r@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
je     12ae <AnalyseSymbolList+0x18e>
mov    -0x10(%rbp),%rax
movsd  0xe67(%rip),%xmm0
addsd  (%rax),%xmm0
movsd  %xmm0,(%rax)
mov    -0x30(%rbp),%rdi
lea    0xe5e(%rip),%rsi
lea    -0x48(%rbp),%rdx
call   1030 <strtok_r@plt>
mov    %rax,-0x40(%rbp)
xor    %eax,%eax
mov    %eax,%edi
lea    0xe46(%rip),%rsi
lea    -0x48(%rbp),%rdx
call   1030 <strtok_r@plt>
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rdi
call   1040 <atoi@plt>
mov    %eax,-0x4c(%rbp)
cmpl   $0x0,-0x4c(%rbp)
jne    1203 <AnalyseSymbolList+0xe3>
mov    -0x18(%rbp),%rax
movsd  0xe0d(%rip),%xmm0
addsd  (%rax),%xmm0
movsd  %xmm0,(%rax)
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm0
movsd  0xded(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    1228 <AnalyseSymbolList+0x108>
jp     1228 <AnalyseSymbolList+0x108>
jmp    123f <AnalyseSymbolList+0x11f>
cvtsi2sdl -0x4c(%rbp),%xmm1
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm0
ucomisd %xmm1,%xmm0
jbe    124c <AnalyseSymbolList+0x12c>
cvtsi2sdl -0x4c(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x28(%rbp),%rax
movsd  (%rax),%xmm0
movsd  0xda4(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    1271 <AnalyseSymbolList+0x151>
jp     1271 <AnalyseSymbolList+0x151>
jmp    1284 <AnalyseSymbolList+0x164>
cvtsi2sdl -0x4c(%rbp),%xmm0
mov    -0x28(%rbp),%rax
ucomisd (%rax),%xmm0
jbe    1291 <AnalyseSymbolList+0x171>
cvtsi2sdl -0x4c(%rbp),%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,(%rax)
xor    %eax,%eax
mov    %eax,%edi
lea    0xd74(%rip),%rsi
lea    -0x38(%rbp),%rdx
call   1030 <strtok_r@plt>
mov    %rax,-0x30(%rbp)
jmp    118a <AnalyseSymbolList+0x6a>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<AnalyseSymbolList>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r8,%r14
mov    %rcx,%r12
mov    %rdx,%r15
mov    %rsi,%rbx
movq   $0x0,(%rsi)
movq   $0x0,(%rdx)
movabs $0xbff0000000000000,%rax
mov    %rax,(%rcx)
mov    %rax,(%r8)
lea    0xeb1(%rip),%rsi
lea    0x8(%rsp),%rdx
call   1030 <strtok_r@plt>
test   %rax,%rax
je     1233 <AnalyseSymbolList+0x113>
lea    0xe99(%rip),%r13
lea    0x10(%rsp),%rbp
jmp    11a1 <AnalyseSymbolList+0x81>
movsd  %xmm0,(%r14)
xor    %edi,%edi
lea    0xe82(%rip),%rsi
lea    0x8(%rsp),%rdx
call   1030 <strtok_r@plt>
test   %rax,%rax
je     1233 <AnalyseSymbolList+0x113>
movsd  (%rbx),%xmm0
addsd  0xe53(%rip),%xmm0
movsd  %xmm0,(%rbx)
mov    %rax,%rdi
mov    %r13,%rsi
mov    %rbp,%rdx
call   1030 <strtok_r@plt>
xor    %edi,%edi
mov    %r13,%rsi
mov    %rbp,%rdx
call   1030 <strtok_r@plt>
mov    %rax,%rdi
call   1040 <atoi@plt>
test   %eax,%eax
jne    11ea <AnalyseSymbolList+0xca>
movsd  (%r15),%xmm0
addsd  0xe1b(%rip),%xmm0
movsd  %xmm0,(%r15)
movsd  (%r12),%xmm1
ucomisd 0xe10(%rip),%xmm1
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
jne    1203 <AnalyseSymbolList+0xe3>
jnp    1209 <AnalyseSymbolList+0xe9>
ucomisd %xmm0,%xmm1
jbe    120f <AnalyseSymbolList+0xef>
movsd  %xmm0,(%r12)
movsd  (%r14),%xmm1
ucomisd 0xdec(%rip),%xmm1
jne    1224 <AnalyseSymbolList+0x104>
jnp    1180 <AnalyseSymbolList+0x60>
ucomisd %xmm1,%xmm0
jbe    1185 <AnalyseSymbolList+0x65>
jmp    1180 <AnalyseSymbolList+0x60>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
@.str.1 = [2 x i8] c"/\00"
define void @AnalyseSymbolList(i8* %0, double* %1, double* %2, double* %3, double* %4) {
%6 = alloca i8*
%7 = alloca double*
%8 = alloca double*
%9 = alloca double*
%10 = alloca double*
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i8*
%14 = alloca i8*
%15 = alloca i32
store i8* %0, i8** %6
store double* %1, double** %7
store double* %2, double** %8
store double* %3, double** %9
store double* %4, double** %10
%16 = load double*, double** %7
store double 0.000000e+00, double* %16
%17 = load double*, double** %8
store double 0.000000e+00, double* %17
%18 = load double*, double** %9
store double -1.000000e+00, double* %18
%19 = load double*, double** %10
store double -1.000000e+00, double* %19
%20 = load i8*, i8** %6
%21 = call i8* @strtok_r(i8* %20, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %12)
store i8* %21, i8** %11
br label %22
22: ; preds = %68, %5
%23 = load i8*, i8** %11
%24 = icmp ne i8* %23, null
br i1 %24, label %25, label %70
25: ; preds = %22
%26 = load double*, double** %7
%27 = load double, double* %26
%28 = fadd double %27, 1.000000e+00
store double %28, double* %26
%29 = load i8*, i8** %11
%30 = call i8* @strtok_r(i8* %29, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8** %14)
store i8* %30, i8** %13
%31 = call i8* @strtok_r(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8** %14)
store i8* %31, i8** %13
%32 = load i8*, i8** %13
%33 = call i32 @atoi(i8* %32)
store i32 %33, i32* %15
%34 = load i32, i32* %15
%35 = icmp eq i32 %34, 0
br i1 %35, label %36, label %40
36: ; preds = %25
%37 = load double*, double** %8
%38 = load double, double* %37
%39 = fadd double %38, 1.000000e+00
store double %39, double* %37
br label %40
40: ; preds = %36, %25
%41 = load double*, double** %9
%42 = load double, double* %41
%43 = fcmp oeq double %42, -1.000000e+00
br i1 %43, label %50, label %44
44: ; preds = %40
%45 = load i32, i32* %15
%46 = sitofp i32 %45 to double
%47 = load double*, double** %9
%48 = load double, double* %47
%49 = fcmp olt double %46, %48
br i1 %49, label %50, label %54
50: ; preds = %44, %40
%51 = load i32, i32* %15
%52 = sitofp i32 %51 to double
%53 = load double*, double** %9
store double %52, double* %53
br label %54
54: ; preds = %50, %44
%55 = load double*, double** %10
%56 = load double, double* %55
%57 = fcmp oeq double %56, -1.000000e+00
br i1 %57, label %64, label %58
58: ; preds = %54
%59 = load i32, i32* %15
%60 = sitofp i32 %59 to double
%61 = load double*, double** %10
%62 = load double, double* %61
%63 = fcmp ogt double %60, %62
br i1 %63, label %64, label %68
64: ; preds = %58, %54
%65 = load i32, i32* %15
%66 = sitofp i32 %65 to double
%67 = load double*, double** %10
store double %66, double* %67
br label %68
68: ; preds = %64, %58
%69 = call i8* @strtok_r(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %12)
store i8* %69, i8** %11
br label %22
70: ; preds = %22
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"\0A\00"
@.str.1 = [2 x i8] c"/\00"
define void @AnalyseSymbolList(i8* %0, double* nocapture %1, double* nocapture %2, double* nocapture %3, double* nocapture %4) {
%6 = alloca i8*
%7 = alloca i8*
%8 = bitcast i8** %6 to i8*
%9 = bitcast i8** %7 to i8*
store double 0.000000e+00, double* %1
store double 0.000000e+00, double* %2
store double -1.000000e+00, double* %3
store double -1.000000e+00, double* %4
%10 = call i8* @strtok_r(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %6)
%11 = icmp eq i8* %10, null
br i1 %11, label %39, label %12
12: ; preds = %5, %36
%13 = phi i8* [ %37, %36 ], [ %10, %5 ]
%14 = load double, double* %1
%15 = fadd double %14, 1.000000e+00
store double %15, double* %1
%16 = call i8* @strtok_r(i8* %13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8** %7)
%17 = call i8* @strtok_r(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8** %7)
%18 = call i32 @atoi(i8* %17)
%19 = icmp eq i32 %18, 0
br i1 %19, label %20, label %23
20: ; preds = %12
%21 = load double, double* %2
%22 = fadd double %21, 1.000000e+00
store double %22, double* %2
br label %23
23: ; preds = %20, %12
%24 = load double, double* %3
%25 = fcmp oeq double %24, -1.000000e+00
%26 = sitofp i32 %18 to double
%27 = fcmp ogt double %24, %26
%28 = select i1 %25, i1 true, i1 %27
br i1 %28, label %29, label %30
29: ; preds = %23
store double %26, double* %3
br label %30
30: ; preds = %23, %29
%31 = load double, double* %4
%32 = fcmp oeq double %31, -1.000000e+00
%33 = fcmp olt double %31, %26
%34 = select i1 %32, i1 true, i1 %33
br i1 %34, label %35, label %36
35: ; preds = %30
store double %26, double* %4
br label %36
36: ; preds = %30, %35
%37 = call i8* @strtok_r(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %6)
%38 = icmp eq i8* %37, null
br i1 %38, label %39, label %12
39: ; preds = %36, %5
ret void
}