#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 /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
void *malloc(int);
int /*<<< orphan*/ printf(char *, char *);
int split(char *, char **, char *);
int /*<<< orphan*/ stdin;
int strlen(char *);
int main() {
  char **result;
  int i, substringCount;
  result = malloc(10 * sizeof(char *));
  for (i = 0; i < 10; i++)
    result[i] = malloc(16 * sizeof(char));
  char inputString[32];
  char delimiter[8];
  fgets(inputString, 32 * sizeof(char), stdin);
  inputString[strlen(inputString) - 1] = 0;
  fgets(delimiter, 8 * sizeof(char), stdin);
  delimiter[strlen(delimiter) - 1] = 0;
  substringCount = split(inputString, result, delimiter);
  for (i = 0; i < substringCount; i++)
    printf("%s\n", result[i]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x50,%edi
call   1070 <malloc@plt>
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0xa,-0x14(%rbp)
jge    11a5 <main+0x55>
mov    $0x10,%edi
call   1070 <malloc@plt>
mov    %rax,%rdx
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1174 <main+0x24>
lea    -0x40(%rbp),%rdi
mov    0x2e38(%rip),%rax
mov    (%rax),%edx
mov    $0x20,%esi
call   1060 <fgets@plt>
lea    -0x40(%rbp),%rdi
call   1030 <strlen@plt>
sub    $0x1,%eax
cltq
movb   $0x0,-0x40(%rbp,%rax,1)
lea    -0x48(%rbp),%rdi
mov    0x2e0e(%rip),%rax
mov    (%rax),%edx
mov    $0x8,%esi
call   1060 <fgets@plt>
lea    -0x48(%rbp),%rdi
call   1030 <strlen@plt>
sub    $0x1,%eax
cltq
movb   $0x0,-0x48(%rbp,%rax,1)
lea    -0x40(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0x48(%rbp),%rdx
call   1050 <split@plt>
mov    %eax,-0x18(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    1246 <main+0xf6>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xdcd(%rip),%rdi
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1214 <main+0xc4>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    $0x50,%edi
call   1070 <malloc@plt>
mov    %rax,%r15
mov    $0x10,%edi
call   1070 <malloc@plt>
mov    %rax,(%r15)
mov    $0x10,%edi
call   1070 <malloc@plt>
mov    %rax,0x8(%r15)
mov    $0x10,%edi
call   1070 <malloc@plt>
mov    %rax,0x10(%r15)
mov    $0x10,%edi
call   1070 <malloc@plt>
mov    %rax,0x18(%r15)
mov    $0x10,%edi
call   1070 <malloc@plt>
mov    %rax,0x20(%r15)
mov    $0x10,%edi
call   1070 <malloc@plt>
mov    %rax,0x28(%r15)
mov    $0x10,%edi
call   1070 <malloc@plt>
mov    %rax,0x30(%r15)
mov    $0x10,%edi
call   1070 <malloc@plt>
mov    %rax,0x38(%r15)
mov    $0x10,%edi
call   1070 <malloc@plt>
mov    %rax,0x40(%r15)
mov    $0x10,%edi
call   1070 <malloc@plt>
mov    %rax,0x48(%r15)
mov    0x2dee(%rip),%rbx
mov    (%rbx),%edx
lea    0x10(%rsp),%r14
mov    %r14,%rdi
mov    $0x20,%esi
call   1060 <fgets@plt>
mov    %r14,%rdi
call   1030 <strlen@plt>
cltq
movb   $0x0,-0x1(%rax,%r14,1)
mov    (%rbx),%edx
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x8,%esi
call   1060 <fgets@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
cltq
movb   $0x0,-0x1(%rax,%rbx,1)
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1050 <split@plt>
test   %eax,%eax
jle    1275 <main+0x125>
mov    %eax,%r12d
xor    %ebx,%ebx
lea    0xda1(%rip),%r14
nop
mov    (%r15,%rbx,8),%rsi
mov    %r14,%rdi
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1260 <main+0x110>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@stdin = global i32 0
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8**
%3 = alloca i32
%4 = alloca i32
%5 = alloca [32 x i8]
%6 = alloca [8 x i8]
store i32 0, i32* %1
%7 = call i8* @malloc(i32 80)
%8 = bitcast i8* %7 to i8**
store i8** %8, i8*** %2
store i32 0, i32* %3
br label %9
9: ; preds = %18, %0
%10 = load i32, i32* %3
%11 = icmp slt i32 %10, 10
br i1 %11, label %12, label %21
12: ; preds = %9
%13 = call i8* @malloc(i32 16)
%14 = load i8**, i8*** %2
%15 = load i32, i32* %3
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8*, i8** %14, i64 %16
store i8* %13, i8** %17
br label %18
18: ; preds = %12
%19 = load i32, i32* %3
%20 = add nsw i32 %19, 1
store i32 %20, i32* %3
br label %9
21: ; preds = %9
%22 = getelementptr inbounds [32 x i8], [32 x i8]* %5, i64 0, i64 0
%23 = load i32, i32* @stdin
%24 = call i32 @fgets(i8* %22, i32 32, i32 %23)
%25 = getelementptr inbounds [32 x i8], [32 x i8]* %5, i64 0, i64 0
%26 = call i32 @strlen(i8* %25)
%27 = sub nsw i32 %26, 1
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [32 x i8], [32 x i8]* %5, i64 0, i64 %28
store i8 0, i8* %29
%30 = getelementptr inbounds [8 x i8], [8 x i8]* %6, i64 0, i64 0
%31 = load i32, i32* @stdin
%32 = call i32 @fgets(i8* %30, i32 8, i32 %31)
%33 = getelementptr inbounds [8 x i8], [8 x i8]* %6, i64 0, i64 0
%34 = call i32 @strlen(i8* %33)
%35 = sub nsw i32 %34, 1
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds [8 x i8], [8 x i8]* %6, i64 0, i64 %36
store i8 0, i8* %37
%38 = getelementptr inbounds [32 x i8], [32 x i8]* %5, i64 0, i64 0
%39 = load i8**, i8*** %2
%40 = getelementptr inbounds [8 x i8], [8 x i8]* %6, i64 0, i64 0
%41 = call i32 @split(i8* %38, i8** %39, i8* %40)
store i32 %41, i32* %4
store i32 0, i32* %3
br label %42
42: ; preds = %53, %21
%43 = load i32, i32* %3
%44 = load i32, i32* %4
%45 = icmp slt i32 %43, %44
br i1 %45, label %46, label %56
46: ; preds = %42
%47 = load i8**, i8*** %2
%48 = load i32, i32* %3
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds i8*, i8** %47, i64 %49
%51 = load i8*, i8** %50
%52 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %51)
br label %53
53: ; preds = %46
%54 = load i32, i32* %3
%55 = add nsw i32 %54, 1
store i32 %55, i32* %3
br label %42
56: ; preds = %42
ret i32 0
}

LLVM IR (-O2):
@stdin = global i32 0
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca [32 x i8]
%2 = alloca [8 x i8]
%3 = tail call dereferenceable_or_null(80) i8* @malloc(i32 80)
%4 = bitcast i8* %3 to i8**
%5 = tail call dereferenceable_or_null(16) i8* @malloc(i32 16)
store i8* %5, i8** %4
%6 = tail call dereferenceable_or_null(16) i8* @malloc(i32 16)
%7 = getelementptr inbounds i8*, i8** %4, i64 1
store i8* %6, i8** %7
%8 = tail call dereferenceable_or_null(16) i8* @malloc(i32 16)
%9 = getelementptr inbounds i8*, i8** %4, i64 2
store i8* %8, i8** %9
%10 = tail call dereferenceable_or_null(16) i8* @malloc(i32 16)
%11 = getelementptr inbounds i8*, i8** %4, i64 3
store i8* %10, i8** %11
%12 = tail call dereferenceable_or_null(16) i8* @malloc(i32 16)
%13 = getelementptr inbounds i8*, i8** %4, i64 4
store i8* %12, i8** %13
%14 = tail call dereferenceable_or_null(16) i8* @malloc(i32 16)
%15 = getelementptr inbounds i8*, i8** %4, i64 5
store i8* %14, i8** %15
%16 = tail call dereferenceable_or_null(16) i8* @malloc(i32 16)
%17 = getelementptr inbounds i8*, i8** %4, i64 6
store i8* %16, i8** %17
%18 = tail call dereferenceable_or_null(16) i8* @malloc(i32 16)
%19 = getelementptr inbounds i8*, i8** %4, i64 7
store i8* %18, i8** %19
%20 = tail call dereferenceable_or_null(16) i8* @malloc(i32 16)
%21 = getelementptr inbounds i8*, i8** %4, i64 8
store i8* %20, i8** %21
%22 = tail call dereferenceable_or_null(16) i8* @malloc(i32 16)
%23 = getelementptr inbounds i8*, i8** %4, i64 9
store i8* %22, i8** %23
%24 = getelementptr inbounds [32 x i8], [32 x i8]* %1, i64 0, i64 0
%25 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 0
%26 = load i32, i32* @stdin
%27 = call i32 @fgets(i8* %24, i32 32, i32 %26)
%28 = call i32 @strlen(i8* %24)
%29 = add nsw i32 %28, -1
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [32 x i8], [32 x i8]* %1, i64 0, i64 %30
store i8 0, i8* %31
%32 = load i32, i32* @stdin
%33 = call i32 @fgets(i8* %25, i32 8, i32 %32)
%34 = call i32 @strlen(i8* %25)
%35 = add nsw i32 %34, -1
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 %36
store i8 0, i8* %37
%38 = call i32 @split(i8* %24, i8** %4, i8* %25)
%39 = icmp sgt i32 %38, 0
br i1 %39, label %40, label %49
40: ; preds = %0
%41 = zext i32 %38 to i64
br label %42
42: ; preds = %40, %42
%43 = phi i64 [ 0, %40 ], [ %47, %42 ]
%44 = getelementptr inbounds i8*, i8** %4, i64 %43
%45 = load i8*, i8** %44
%46 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %45)
%47 = add nuw nsw i64 %43, 1
%48 = icmp eq i64 %47, %41
br i1 %48, label %49, label %42
49: ; preds = %42, %0
ret i32 0
}