#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 */
scalar_t__ malloc(int);
scalar_t__ strisspace(char *);
long strtol(char *, char **, int);
long *indicator2table(const char *indicator) {
  char *rest, *previous;
  long int index, *indic_table = (long int *)NULL;
  int i, table_len;
  table_len = 0;
  rest = (char *)indicator;
  do {
    table_len++;
    previous = rest;
    index = strtol(previous, &rest, 10);
  } while ((*rest) && (previous < rest));
  if (strisspace(previous))
    table_len--;
  indic_table = (long int *)malloc(sizeof(long int) * (table_len + 1));
  if (!indic_table)
    return (indic_table);
  indic_table[0] = table_len;
  rest = (char *)indicator;
  for (i = 1; i <= table_len; i++)
    indic_table[i] = strtol(rest, &rest, 10);
  return (indic_table);
}


x86 assembly (clang, -O0):
<indicator2table>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
movq   $0x0,-0x30(%rbp)
movl   $0x0,-0x38(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
lea    -0x18(%rbp),%rsi
mov    $0xa,%edx
call   1040 <strtol@plt>
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x39(%rbp)
je     119d <indicator2table+0x6d>
mov    -0x20(%rbp),%rax
cmp    -0x18(%rbp),%rax
setb   %al
mov    %al,-0x39(%rbp)
mov    -0x39(%rbp),%al
test   $0x1,%al
jne    1153 <indicator2table+0x23>
mov    -0x20(%rbp),%rdi
call   1030 <strisspace@plt>
cmp    $0x0,%rax
je     11c4 <indicator2table+0x94>
mov    -0x38(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x38(%rbp)
mov    -0x38(%rbp),%eax
add    $0x1,%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    11f3 <indicator2table+0xc3>
mov    -0x30(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1250 <indicator2table+0x120>
movslq -0x38(%rbp),%rcx
mov    -0x30(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
movl   $0x1,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x38(%rbp),%eax
jg     1248 <indicator2table+0x118>
mov    -0x18(%rbp),%rdi
lea    -0x18(%rbp),%rsi
mov    $0xa,%edx
call   1040 <strtol@plt>
mov    %rax,%rdx
mov    -0x30(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    120d <indicator2table+0xdd>
mov    -0x30(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<indicator2table>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%r14
mov    %rdi,0x8(%rsp)
mov    $0xffffffff,%r12d
lea    0x8(%rsp),%r15
mov    %rdi,%rax
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r15,%rsi
mov    $0xa,%edx
call   1040 <strtol@plt>
mov    0x8(%rsp),%rax
add    $0x1,%r12d
cmp    %rax,%rbx
jae    1186 <indicator2table+0x56>
cmpb   $0x0,(%rax)
jne    1160 <indicator2table+0x30>
mov    %rbx,%rdi
call   1030 <strisspace@plt>
lea    0x1(%r12),%r13d
test   %rax,%rax
cmovne %r12d,%r13d
lea    0x8(,%r13,8),%edi
call   1050 <malloc@plt>
mov    %rax,%r15
test   %rax,%rax
je     1210 <indicator2table+0xe0>
mov    %r13d,%eax
mov    %rax,(%r15)
mov    %r14,0x8(%rsp)
test   %r13d,%r13d
je     1210 <indicator2table+0xe0>
add    $0x1,%r13d
lea    0x8(%rsp),%rsi
mov    %r14,%rdi
mov    $0xa,%edx
call   1040 <strtol@plt>
mov    %rax,0x8(%r15)
cmp    $0x2,%r13d
je     1210 <indicator2table+0xe0>
add    $0xfffffffffffffffe,%r13
xor    %ebx,%ebx
lea    0x8(%rsp),%r14
nopw   0x0(%rax,%rax,1)
mov    0x8(%rsp),%rdi
mov    %r14,%rsi
mov    $0xa,%edx
call   1040 <strtol@plt>
mov    %rax,0x10(%r15,%rbx,8)
add    $0x1,%rbx
cmp    %rbx,%r13
jne    11f0 <indicator2table+0xc0>
mov    %r15,%rax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i64* @indicator2table(i8* %0) {
%2 = alloca i64*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i64*
%8 = alloca i32
%9 = alloca i32
store i8* %0, i8** %3
store i64* null, i64** %7
store i32 0, i32* %9
%10 = load i8*, i8** %3
store i8* %10, i8** %4
br label %11
11: ; preds = %26, %1
%12 = load i32, i32* %9
%13 = add nsw i32 %12, 1
store i32 %13, i32* %9
%14 = load i8*, i8** %4
store i8* %14, i8** %5
%15 = load i8*, i8** %5
%16 = call i64 @strtol(i8* %15, i8** %4, i32 10)
store i64 %16, i64* %6
br label %17
17: ; preds = %11
%18 = load i8*, i8** %4
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = icmp ne i32 %20, 0
br i1 %21, label %22, label %26
22: ; preds = %17
%23 = load i8*, i8** %5
%24 = load i8*, i8** %4
%25 = icmp ult i8* %23, %24
br label %26
26: ; preds = %22, %17
%27 = phi i1 [ false, %17 ], [ %25, %22 ]
br i1 %27, label %11, label %28
28: ; preds = %26
%29 = load i8*, i8** %5
%30 = call i64 @strisspace(i8* %29)
%31 = icmp ne i64 %30, 0
br i1 %31, label %32, label %35
32: ; preds = %28
%33 = load i32, i32* %9
%34 = add nsw i32 %33, -1
store i32 %34, i32* %9
br label %35
35: ; preds = %32, %28
%36 = load i32, i32* %9
%37 = add nsw i32 %36, 1
%38 = sext i32 %37 to i64
%39 = mul i64 8, %38
%40 = trunc i64 %39 to i32
%41 = call i64 @malloc(i32 %40)
%42 = inttoptr i64 %41 to i64*
store i64* %42, i64** %7
%43 = load i64*, i64** %7
%44 = icmp ne i64* %43, null
br i1 %44, label %47, label %45
45: ; preds = %35
%46 = load i64*, i64** %7
store i64* %46, i64** %2
br label %69
47: ; preds = %35
%48 = load i32, i32* %9
%49 = sext i32 %48 to i64
%50 = load i64*, i64** %7
%51 = getelementptr inbounds i64, i64* %50, i64 0
store i64 %49, i64* %51
%52 = load i8*, i8** %3
store i8* %52, i8** %4
store i32 1, i32* %8
br label %53
53: ; preds = %64, %47
%54 = load i32, i32* %8
%55 = load i32, i32* %9
%56 = icmp sle i32 %54, %55
br i1 %56, label %57, label %67
57: ; preds = %53
%58 = load i8*, i8** %4
%59 = call i64 @strtol(i8* %58, i8** %4, i32 10)
%60 = load i64*, i64** %7
%61 = load i32, i32* %8
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds i64, i64* %60, i64 %62
store i64 %59, i64* %63
br label %64
64: ; preds = %57
%65 = load i32, i32* %8
%66 = add nsw i32 %65, 1
store i32 %66, i32* %8
br label %53
67: ; preds = %53
%68 = load i64*, i64** %7
store i64* %68, i64** %2
br label %69
69: ; preds = %67, %45
%70 = load i64*, i64** %2
ret i64* %70
}

LLVM IR (-O2):
define i64* @indicator2table(i8* %0) {
%2 = alloca i8*
%3 = bitcast i8** %2 to i8*
store i8* %0, i8** %2
br label %4
4: ; preds = %4, %1
%5 = phi i8* [ %0, %1 ], [ %9, %4 ]
%6 = phi i32 [ 0, %1 ], [ %7, %4 ]
%7 = add nuw nsw i32 %6, 1
%8 = call i64 @strtol(i8* %5, i8** %2, i32 10)
%9 = load i8*, i8** %2
%10 = load i8, i8* %9
%11 = icmp ne i8 %10, 0
%12 = icmp ult i8* %5, %9
%13 = and i1 %12, %11
br i1 %13, label %4, label %14
14: ; preds = %4
%15 = tail call i64 @strisspace(i8* %5)
%16 = icmp eq i64 %15, 0
%17 = select i1 %16, i32 %7, i32 %6
%18 = shl i32 %17, 3
%19 = add i32 %18, 8
%20 = tail call i64 @malloc(i32 %19)
%21 = inttoptr i64 %20 to i64*
%22 = icmp eq i64 %20, 0
br i1 %22, label %39, label %23
23: ; preds = %14
%24 = zext i32 %17 to i64
store i64 %24, i64* %21
store i8* %0, i8** %2
%25 = icmp eq i32 %17, 0
br i1 %25, label %39, label %26
26: ; preds = %23
%27 = add nuw i32 %17, 1
%28 = zext i32 %27 to i64
%29 = call i64 @strtol(i8* %0, i8** %2, i32 10)
%30 = getelementptr inbounds i64, i64* %21, i64 1
store i64 %29, i64* %30
%31 = icmp eq i32 %27, 2
br i1 %31, label %39, label %32
32: ; preds = %26, %32
%33 = phi i64 [ %37, %32 ], [ 2, %26 ]
%34 = load i8*, i8** %2
%35 = call i64 @strtol(i8* %34, i8** %2, i32 10)
%36 = getelementptr inbounds i64, i64* %21, i64 %33
store i64 %35, i64* %36
%37 = add nuw nsw i64 %33, 1
%38 = icmp eq i64 %37, %28
br i1 %38, label %39, label %32
39: ; preds = %32, %26, %23, %14
ret i64* %21
}