#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 EXIT_FAILURE;
int EXIT_SUCCESS;
char *__strtok_r(char *, char *, char **);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stdin;
int main(int argc, char const *argv[]) {
  char line[101];
  if (fgets(line, 101 - 1, stdin) == NULL) {
    printf("Error while reading line from stdin.\n");
    return EXIT_FAILURE;
  }
  char *str1, *str2, *token, *subtoken;
  char *saveptr1, *saveptr2;
  int j;
  for (j = 1, str1 = line;; j++, str1 = NULL) {
    token = __strtok_r(str1, "|;", &saveptr1);
    if (token == NULL)
      break;
    printf("%d: %s\n", j, token);
    for (str2 = token;; str2 = NULL) {
      subtoken = __strtok_r(str2, " ", &saveptr2);
      if (subtoken == NULL)
        break;
      printf(" --> %s\n", subtoken);
    }
  }
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x80(%rbp),%rdi
mov    0x2e94(%rip),%rax
mov    (%rax),%edx
mov    $0x64,%esi
call   1050 <fgets@plt>
cmp    $0x0,%rax
jne    1189 <main+0x59>
lea    0xe8f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2e59(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1284 <main+0x154>
movl   $0x1,-0xb4(%rbp)
lea    -0x80(%rbp),%rax
mov    %rax,-0x88(%rbp)
mov    -0x88(%rbp),%rdi
lea    0xe7a(%rip),%rsi
lea    -0xa8(%rbp),%rdx
call   1040 <__strtok_r@plt>
mov    %rax,-0x98(%rbp)
cmpq   $0x0,-0x98(%rbp)
jne    11d2 <main+0xa2>
jmp    1278 <main+0x148>
mov    -0xb4(%rbp),%esi
mov    -0x98(%rbp),%rdx
lea    0xe43(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x98(%rbp),%rax
mov    %rax,-0x90(%rbp)
mov    -0x90(%rbp),%rdi
lea    0xe28(%rip),%rsi
lea    -0xb0(%rbp),%rdx
call   1040 <__strtok_r@plt>
mov    %rax,-0xa0(%rbp)
cmpq   $0x0,-0xa0(%rbp)
jne    122f <main+0xff>
jmp    1254 <main+0x124>
mov    -0xa0(%rbp),%rsi
lea    0xdf6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movq   $0x0,-0x90(%rbp)
jmp    11fb <main+0xcb>
jmp    1259 <main+0x129>
mov    -0xb4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb4(%rbp)
movq   $0x0,-0x88(%rbp)
jmp    119e <main+0x6e>
mov    0x2d51(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
mov    0x2e93(%rip),%rax
mov    (%rax),%edx
lea    0x10(%rsp),%rdi
mov    $0x64,%esi
call   1060 <fgets@plt>
test   %rax,%rax
je     121a <main+0xda>
lea    0xe8a(%rip),%rsi
lea    0x10(%rsp),%rdi
mov    %rsp,%rdx
call   1050 <__strtok_r@plt>
test   %rax,%rax
je     1211 <main+0xd1>
mov    %rax,%r12
mov    $0x1,%r15d
lea    0xe6f(%rip),%rbx
lea    0x8(%rsp),%rbp
mov    %rsp,%r13
lea    0xe62(%rip),%r14
jmp    11cd <main+0x8d>
nopl   (%rax)
add    $0x1,%r15d
xor    %edi,%edi
lea    0xe43(%rip),%rsi
mov    %r13,%rdx
call   1050 <__strtok_r@plt>
mov    %rax,%r12
test   %rax,%rax
je     1211 <main+0xd1>
lea    0xe2f(%rip),%rdi
mov    %r15d,%esi
mov    %r12,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r12,%rdi
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rbx,%rsi
mov    %rbp,%rdx
call   1050 <__strtok_r@plt>
test   %rax,%rax
je     11b0 <main+0x70>
mov    %r14,%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %edi,%edi
jmp    11f0 <main+0xb0>
mov    0x2db8(%rip),%rax
jmp    122d <main+0xed>
lea    0xdf5(%rip),%rdi
call   1030 <puts@plt>
mov    0x2dab(%rip),%rax
mov    (%rax),%eax
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stdin = global i32 0
@.str = [38 x i8] c"Error while reading line from stdin.\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [3 x i8] c"|;\00"
@.str.2 = [8 x i8] c"%d: %s\0A\00"
@.str.3 = [2 x i8] c" \00"
@.str.4 = [9 x i8] c" --> %s\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [101 x i8]
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%14 = getelementptr inbounds [101 x i8], [101 x i8]* %6, i64 0, i64 0
%15 = load i32, i32* @stdin
%16 = call i32* @fgets(i8* %14, i32 100, i32 %15)
%17 = icmp eq i32* %16, null
br i1 %17, label %18, label %21
18: ; preds = %2
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%20 = load i32, i32* @EXIT_FAILURE
store i32 %20, i32* %3
br label %50
21: ; preds = %2
store i32 1, i32* %13
%22 = getelementptr inbounds [101 x i8], [101 x i8]* %6, i64 0, i64 0
store i8* %22, i8** %7
br label %23
23: ; preds = %45, %21
%24 = load i8*, i8** %7
%25 = call i8* @__strtok_r(i8* %24, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8** %11)
store i8* %25, i8** %9
%26 = load i8*, i8** %9
%27 = icmp eq i8* %26, null
br i1 %27, label %28, label %29
28: ; preds = %23
br label %48
29: ; preds = %23
%30 = load i32, i32* %13
%31 = load i8*, i8** %9
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 %30, i8* %31)
%33 = load i8*, i8** %9
store i8* %33, i8** %8
br label %34
34: ; preds = %43, %29
%35 = load i8*, i8** %8
%36 = call i8* @__strtok_r(i8* %35, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i8** %12)
store i8* %36, i8** %10
%37 = load i8*, i8** %10
%38 = icmp eq i8* %37, null
br i1 %38, label %39, label %40
39: ; preds = %34
br label %44
40: ; preds = %34
%41 = load i8*, i8** %10
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i8* %41)
br label %43
43: ; preds = %40
store i8* null, i8** %8
br label %34
44: ; preds = %39
br label %45
45: ; preds = %44
%46 = load i32, i32* %13
%47 = add nsw i32 %46, 1
store i32 %47, i32* %13
store i8* null, i8** %7
br label %23
48: ; preds = %28
%49 = load i32, i32* @EXIT_SUCCESS
store i32 %49, i32* %3
br label %50
50: ; preds = %48, %18
%51 = load i32, i32* %3
ret i32 %51
}

LLVM IR (-O2):
@stdin = global i32 0
@EXIT_FAILURE = global i32 0
@.str.1 = [3 x i8] c"|;\00"
@.str.2 = [8 x i8] c"%d: %s\0A\00"
@.str.3 = [2 x i8] c" \00"
@.str.4 = [9 x i8] c" --> %s\0A\00"
@EXIT_SUCCESS = global i32 0
@str = [37 x i8] c"Error while reading line from stdin.\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [101 x i8]
%4 = alloca i8*
%5 = alloca i8*
%6 = getelementptr inbounds [101 x i8], [101 x i8]* %3, i64 0, i64 0
%7 = load i32, i32* @stdin
%8 = call i32* @fgets(i8* %6, i32 100, i32 %7)
%9 = icmp eq i32* %8, null
br i1 %9, label %10, label %13
10: ; preds = %2
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str, i64 0, i64 0))
%12 = load i32, i32* @EXIT_FAILURE
br label %35
13: ; preds = %2
%14 = bitcast i8** %4 to i8*
%15 = bitcast i8** %5 to i8*
%16 = call i8* @__strtok_r(i8* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8** %4)
%17 = icmp eq i8* %16, null
br i1 %17, label %33, label %18
18: ; preds = %13, %29
%19 = phi i8* [ %31, %29 ], [ %16, %13 ]
%20 = phi i32 [ %30, %29 ], [ 1, %13 ]
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 %20, i8* %19)
%22 = call i8* @__strtok_r(i8* %19, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i8** %5)
%23 = icmp eq i8* %22, null
br i1 %23, label %29, label %24
24: ; preds = %18, %24
%25 = phi i8* [ %27, %24 ], [ %22, %18 ]
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i8* %25)
%27 = call i8* @__strtok_r(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i8** %5)
%28 = icmp eq i8* %27, null
br i1 %28, label %29, label %24
29: ; preds = %24, %18
%30 = add nuw nsw i32 %20, 1
%31 = call i8* @__strtok_r(i8* null, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8** %4)
%32 = icmp eq i8* %31, null
br i1 %32, label %33, label %18
33: ; preds = %29, %13
%34 = load i32, i32* @EXIT_SUCCESS
br label %35
35: ; preds = %33, %10
%36 = phi i32 [ %12, %10 ], [ %34, %33 ]
ret i32 %36
}