#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 *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, ...);
scalar_t__ piece(char *, char, char *, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ stdout;
scalar_t__ timlib_get_line(char *, int /*<<< orphan*/, int);
int main(int argc, char **argv) {
  char buffer[65536];
  char offset_str[128];
  char component[65536];
  char delimiter;
  int offset, i;
  int line_number = 0;
  if (argc != 3) {
    fprintf(stderr, "Usage: %s delimiter offset_1[,...,offset_n]\n", argv[0]);
    exit(1);
  }
  delimiter = *argv[1];
  while (timlib_get_line(buffer, stdin, 65536)) {
    line_number++;
    for (i = 0; piece(offset_str, ',', argv[2], i); i++) {
      offset = atoi(offset_str);
      if (offset < 0) {
        fprintf(stderr, "ERROR in :%s: Offset (%d) is less than zero\n",
                argv[0], offset);
        exit(1);
      }
      if (!piece(component, delimiter, buffer, offset)) {
        fprintf(stderr,
                "Warning %s for line=%d: There are less than %d delimiters "
                "(%c) in: (%s)\n",
                argv[0], line_number, offset, delimiter, buffer);
        continue;
      } else {
        if (i == 0)
          printf("%s", component);
        else
          printf("%c%s", delimiter, component);
      }
    }
    printf("\n");
    fflush(stdout);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x200b0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x200a0(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     11c5 <main+0x55>
mov    0x2e34(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe4c(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    (%rax),%al
mov    %al,-0x20091(%rbp)
lea    -0x10010(%rbp),%rdi
mov    0x2e05(%rip),%rax
mov    (%rax),%esi
mov    $0x10000,%edx
call   1090 <timlib_get_line@plt>
cmp    $0x0,%rax
je     1379 <main+0x209>
mov    -0x200a0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x200a0(%rbp)
movl   $0x0,-0x2009c(%rbp)
lea    -0x10090(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdx
mov    -0x2009c(%rbp),%ecx
mov    $0x2c,%esi
call   1080 <piece@plt>
cmp    $0x0,%rax
je     1358 <main+0x1e8>
lea    -0x10090(%rbp),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x20098(%rbp)
cmpl   $0x0,-0x20098(%rbp)
jge    1288 <main+0x118>
mov    0x2d77(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
mov    -0x20098(%rbp),%ecx
lea    0xdb6(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
lea    -0x20090(%rbp),%rdi
mov    -0x20091(%rbp),%al
lea    -0x10010(%rbp),%rdx
mov    -0x20098(%rbp),%ecx
movsbl %al,%esi
call   1080 <piece@plt>
cmp    $0x0,%rax
jne    12f7 <main+0x187>
mov    0x2d1d(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
mov    -0x200a0(%rbp),%ecx
mov    -0x20098(%rbp),%r8d
movsbl -0x20091(%rbp),%r9d
ff
lea    -0x10010(%rbp),%rax
lea    0xd73(%rip),%rsi
mov    %rax,(%rsp)
mov    $0x0,%al
call   1040 <fprintf@plt>
jmp    1344 <main+0x1d4>
cmpl   $0x0,-0x2009c(%rbp)
jne    131e <main+0x1ae>
lea    -0x20090(%rbp),%rsi
lea    0xd93(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    133a <main+0x1ca>
movsbl -0x20091(%rbp),%esi
lea    -0x20090(%rbp),%rdx
lea    0xd70(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    133f <main+0x1cf>
jmp    1344 <main+0x1d4>
mov    -0x2009c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2009c(%rbp)
jmp    1212 <main+0xa2>
lea    0xd42(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2c63(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
jmp    11d5 <main+0x65>
xor    %eax,%eax
add    $0x200b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x200a8,%rsp
mov    %rsi,%rbp
cmp    $0x3,%edi
jne    13d5 <main+0x255>
mov    0x8(%rbp),%rax
movsbl (%rax),%r15d
mov    0x2e3c(%rip),%rax
mov    (%rax),%esi
lea    0xa0(%rsp),%rdi
mov    $0x10000,%edx
call   10a0 <timlib_get_line@plt>
test   %rax,%rax
je     1395 <main+0x215>
lea    0x20(%rsp),%rbx
movl   $0x0,0x14(%rsp)
mov    %rbp,0x18(%rsp)
jmp    121c <main+0x9c>
nopl   (%rax)
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x2ddf(%rip),%rax
mov    (%rax),%edi
call   1060 <fflush@plt>
mov    0x2de9(%rip),%rax
mov    (%rax),%esi
lea    0xa0(%rsp),%rdi
mov    $0x10000,%edx
call   10a0 <timlib_get_line@plt>
test   %rax,%rax
je     1395 <main+0x215>
addl   $0x1,0x14(%rsp)
mov    0x10(%rbp),%rdx
mov    %rbx,%rdi
mov    $0x2c,%esi
xor    %ecx,%ecx
call   1090 <piece@plt>
test   %rax,%rax
je     11e0 <main+0x60>
mov    %rbx,%r12
mov    %rbx,%rdi
call   1070 <atoi@plt>
mov    %eax,%r13d
test   %eax,%eax
js     13a9 <main+0x229>
lea    0x100a0(%rsp),%rbp
mov    %rbp,%rdi
mov    %r15d,%esi
lea    0xa0(%rsp),%rbx
mov    %rbx,%rdx
mov    %r13d,%ecx
call   1090 <piece@plt>
test   %rax,%rax
je     1290 <main+0x110>
lea    0xe29(%rip),%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x18(%rsp),%rbp
jmp    12be <main+0x13e>
nopl   (%rax)
mov    0x2d41(%rip),%rax
mov    (%rax),%edi
mov    0x18(%rsp),%rbp
mov    0x0(%rbp),%rdx
mov    %rbx,(%rsp)
lea    0xdad(%rip),%rsi
mov    0x14(%rsp),%ecx
mov    %r13d,%r8d
mov    %r15d,%r9d
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    0x10(%rbp),%rdx
mov    %r12,%rbx
mov    %r12,%rdi
mov    $0x2c,%esi
mov    $0x1,%ecx
call   1090 <piece@plt>
test   %rax,%rax
je     11e0 <main+0x60>
mov    $0x2,%r14d
jmp    132d <main+0x1ad>
nopl   0x0(%rax,%rax,1)
lea    0xdac(%rip),%rdi
mov    %r15d,%esi
mov    %rbp,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x18(%rsp),%rbp
mov    0x10(%rbp),%rdx
mov    %r12,%rbx
mov    %r12,%rdi
mov    $0x2c,%esi
mov    %r14d,%ecx
call   1090 <piece@plt>
add    $0x1,%r14d
test   %rax,%rax
je     11e0 <main+0x60>
mov    %rbx,%rdi
call   1070 <atoi@plt>
mov    %eax,%r13d
test   %eax,%eax
js     13a9 <main+0x229>
lea    0x100a0(%rsp),%rbp
mov    %rbp,%rdi
mov    %r15d,%esi
lea    0xa0(%rsp),%rbx
mov    %rbx,%rdx
mov    %r13d,%ecx
call   1090 <piece@plt>
test   %rax,%rax
jne    12f0 <main+0x170>
mov    0x2c6f(%rip),%rax
mov    (%rax),%edi
mov    0x18(%rsp),%rbp
mov    0x0(%rbp),%rdx
mov    %rbx,(%rsp)
lea    0xcdb(%rip),%rsi
mov    0x14(%rsp),%ecx
mov    %r13d,%r8d
mov    %r15d,%r9d
xor    %eax,%eax
call   1050 <fprintf@plt>
jmp    1309 <main+0x189>
xor    %eax,%eax
add    $0x200a8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2c28(%rip),%rax
mov    (%rax),%edi
mov    0x18(%rsp),%rax
mov    (%rax),%rdx
lea    0xc6c(%rip),%rsi
mov    %r13d,%ecx
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
mov    0x2bfc(%rip),%rax
mov    (%rax),%edi
mov    0x0(%rbp),%rdx
lea    0xc17(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [45 x i8] c"Usage: %s delimiter offset_1[,...,offset_n]\0A\00"
@stdin = global i32 0
@.str.1 = [45 x i8] c"ERROR in :%s: Offset (%d) is less than zero\0A\00"
@.str.2 = [73 x i8] c"Warning %s for line=%d: There are less than %d delimiters (%c) in: (%s)\0A\00"
@.str.3 = [3 x i8] c"%s\00"
@.str.4 = [5 x i8] c"%c%s\00"
@.str.5 = [2 x i8] c"\0A\00"
@stdout = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [65536 x i8]
%7 = alloca [128 x i8]
%8 = alloca [65536 x i8]
%9 = alloca i8
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %12
%13 = load i32, i32* %4
%14 = icmp ne i32 %13, 3
br i1 %14, label %15, label %22
15: ; preds = %2
%16 = load i32, i32* @stderr
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 0
%19 = load i8*, i8** %18
%20 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %16, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i8* %19)
%21 = call i32 @exit(i32 1)
unreachable
22: ; preds = %2
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 1
%25 = load i8*, i8** %24
%26 = load i8, i8* %25
store i8 %26, i8* %9
br label %27
27: ; preds = %90, %22
%28 = getelementptr inbounds [65536 x i8], [65536 x i8]* %6, i64 0, i64 0
%29 = load i32, i32* @stdin
%30 = call i64 @timlib_get_line(i8* %28, i32 %29, i32 65536)
%31 = icmp ne i64 %30, 0
br i1 %31, label %32, label %94
32: ; preds = %27
%33 = load i32, i32* %12
%34 = add nsw i32 %33, 1
store i32 %34, i32* %12
store i32 0, i32* %11
br label %35
35: ; preds = %87, %32
%36 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
%37 = load i8**, i8*** %5
%38 = getelementptr inbounds i8*, i8** %37, i64 2
%39 = load i8*, i8** %38
%40 = load i32, i32* %11
%41 = call i64 @piece(i8* %36, i8 signext 44, i8* %39, i32 %40)
%42 = icmp ne i64 %41, 0
br i1 %42, label %43, label %90
43: ; preds = %35
%44 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
%45 = call i32 @atoi(i8* %44)
store i32 %45, i32* %10
%46 = load i32, i32* %10
%47 = icmp slt i32 %46, 0
br i1 %47, label %48, label %56
48: ; preds = %43
%49 = load i32, i32* @stderr
%50 = load i8**, i8*** %5
%51 = getelementptr inbounds i8*, i8** %50, i64 0
%52 = load i8*, i8** %51
%53 = load i32, i32* %10
%54 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %49, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0), i8* %52, i32 %53)
%55 = call i32 @exit(i32 1)
unreachable
56: ; preds = %43
%57 = getelementptr inbounds [65536 x i8], [65536 x i8]* %8, i64 0, i64 0
%58 = load i8, i8* %9
%59 = getelementptr inbounds [65536 x i8], [65536 x i8]* %6, i64 0, i64 0
%60 = load i32, i32* %10
%61 = call i64 @piece(i8* %57, i8 signext %58, i8* %59, i32 %60)
%62 = icmp ne i64 %61, 0
br i1 %62, label %74, label %63
63: ; preds = %56
%64 = load i32, i32* @stderr
%65 = load i8**, i8*** %5
%66 = getelementptr inbounds i8*, i8** %65, i64 0
%67 = load i8*, i8** %66
%68 = load i32, i32* %12
%69 = load i32, i32* %10
%70 = load i8, i8* %9
%71 = sext i8 %70 to i32
%72 = getelementptr inbounds [65536 x i8], [65536 x i8]* %6, i64 0, i64 0
%73 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %64, i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str.2, i64 0, i64 0), i8* %67, i32 %68, i32 %69, i32 %71, i8* %72)
br label %87
74: ; preds = %56
%75 = load i32, i32* %11
%76 = icmp eq i32 %75, 0
br i1 %76, label %77, label %80
77: ; preds = %74
%78 = getelementptr inbounds [65536 x i8], [65536 x i8]* %8, i64 0, i64 0
%79 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %78)
br label %85
80: ; preds = %74
%81 = load i8, i8* %9
%82 = sext i8 %81 to i32
%83 = getelementptr inbounds [65536 x i8], [65536 x i8]* %8, i64 0, i64 0
%84 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32 %82, i8* %83)
br label %85
85: ; preds = %80, %77
br label %86
86: ; preds = %85
br label %87
87: ; preds = %86, %63
%88 = load i32, i32* %11
%89 = add nsw i32 %88, 1
store i32 %89, i32* %11
br label %35
90: ; preds = %35
%91 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%92 = load i32, i32* @stdout
%93 = call i32 @fflush(i32 %92)
br label %27
94: ; preds = %27
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [45 x i8] c"Usage: %s delimiter offset_1[,...,offset_n]\0A\00"
@stdin = global i32 0
@.str.1 = [45 x i8] c"ERROR in :%s: Offset (%d) is less than zero\0A\00"
@.str.2 = [73 x i8] c"Warning %s for line=%d: There are less than %d delimiters (%c) in: (%s)\0A\00"
@.str.3 = [3 x i8] c"%s\00"
@.str.4 = [5 x i8] c"%c%s\00"
@stdout = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [65536 x i8]
%4 = alloca [128 x i8]
%5 = alloca [65536 x i8]
%6 = getelementptr inbounds [65536 x i8], [65536 x i8]* %3, i64 0, i64 0
%7 = getelementptr inbounds [128 x i8], [128 x i8]* %4, i64 0, i64 0
%8 = getelementptr inbounds [65536 x i8], [65536 x i8]* %5, i64 0, i64 0
%9 = icmp eq i32 %0, 3
br i1 %9, label %15, label %10
10: ; preds = %2
%11 = load i32, i32* @stderr
%12 = load i8*, i8** %1
%13 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %11, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i8* %12)
%14 = tail call i32 @exit(i32 1)
unreachable
15: ; preds = %2
%16 = getelementptr inbounds i8*, i8** %1, i64 1
%17 = load i8*, i8** %16
%18 = load i8, i8* %17
%19 = load i32, i32* @stdin
%20 = call i64 @timlib_get_line(i8* %6, i32 %19, i32 65536)
%21 = icmp eq i64 %20, 0
br i1 %21, label %78, label %22
22: ; preds = %15
%23 = getelementptr inbounds i8*, i8** %1, i64 2
%24 = sext i8 %18 to i32
br label %25
25: ; preds = %22, %71
%26 = phi i32 [ 0, %22 ], [ %27, %71 ]
%27 = add nuw nsw i32 %26, 1
%28 = load i8*, i8** %23
%29 = call i64 @piece(i8* %7, i8 signext 44, i8* %28, i32 0)
%30 = icmp eq i64 %29, 0
br i1 %30, label %71, label %31
31: ; preds = %25
%32 = call i32 @atoi(i8* %7)
%33 = icmp slt i32 %32, 0
br i1 %33, label %51, label %34
34: ; preds = %31
%35 = call i64 @piece(i8* %8, i8 signext %18, i8* %6, i32 %32)
%36 = icmp eq i64 %35, 0
br i1 %36, label %39, label %37
37: ; preds = %34
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %8)
br label %43
39: ; preds = %34
%40 = load i32, i32* @stderr
%41 = load i8*, i8** %1
%42 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %40, i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str.2, i64 0, i64 0), i8* %41, i32 %27, i32 %32, i32 %24, i8* %6)
br label %43
43: ; preds = %39, %37
%44 = load i8*, i8** %23
%45 = call i64 @piece(i8* %7, i8 signext 44, i8* %44, i32 1)
%46 = icmp eq i64 %45, 0
br i1 %46, label %71, label %47
47: ; preds = %43, %66
%48 = phi i32 [ %67, %66 ], [ 1, %43 ]
%49 = call i32 @atoi(i8* %7)
%50 = icmp slt i32 %49, 0
br i1 %50, label %51, label %57
51: ; preds = %31, %47
%52 = phi i32 [ %49, %47 ], [ %32, %31 ]
%53 = load i32, i32* @stderr
%54 = load i8*, i8** %1
%55 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %53, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0), i8* %54, i32 %52)
%56 = call i32 @exit(i32 1)
unreachable
57: ; preds = %47
%58 = call i64 @piece(i8* %8, i8 signext %18, i8* %6, i32 %49)
%59 = icmp eq i64 %58, 0
br i1 %59, label %60, label %64
60: ; preds = %57
%61 = load i32, i32* @stderr
%62 = load i8*, i8** %1
%63 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %61, i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str.2, i64 0, i64 0), i8* %62, i32 %27, i32 %49, i32 %24, i8* %6)
br label %66
64: ; preds = %57
%65 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32 %24, i8* %8)
br label %66
66: ; preds = %64, %60
%67 = add nuw nsw i32 %48, 1
%68 = load i8*, i8** %23
%69 = call i64 @piece(i8* %7, i8 signext 44, i8* %68, i32 %67)
%70 = icmp eq i64 %69, 0
br i1 %70, label %71, label %47
71: ; preds = %66, %43, %25
%72 = call i32 @putchar(i32 10)
%73 = load i32, i32* @stdout
%74 = call i32 @fflush(i32 %73)
%75 = load i32, i32* @stdin
%76 = call i64 @timlib_get_line(i8* %6, i32 %75, i32 65536)
%77 = icmp eq i64 %76, 0
br i1 %77, label %78, label %25
78: ; preds = %71, %15
ret i32 0
}