#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*/ fprintf(int /*<<< orphan*/, char *, ...);
scalar_t__ get_line(char *, int /*<<< orphan*/);
int /*<<< orphan*/ output_unuseds(char *, int, int);
int /*<<< orphan*/ piece(char *, char, char *, int);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ sprintf(char *, char *, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdin;
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int main(int argc, char **argv) {
  char input_buffer[1024];
  char output_buffer[1024] = {0};
  char *output_buffer_ptr = output_buffer;
  char old_record_type[128] = {0};
  char record_type[128];
  char datatype[128];
  char position_string[128];
  char *station;
  int line = 0;
  int position;
  int current_position = 0;
  if (argc != 2) {
    fprintf(stderr, "Usage: %s station\n", argv[0]);
    exit(1);
  }
  station = argv[1];
  while (get_line(input_buffer, stdin)) {
    line++;
    piece(record_type, '|', input_buffer, 0);
    if (!piece(datatype, '|', input_buffer, 1)) {
      fprintf(stderr, "Warning: cannot parse line %d = (%s)\n", line,
              input_buffer);
      continue;
    }
    if (!piece(position_string, '|', input_buffer, 2)) {
      fprintf(stderr, "Warning: cannot parse line %d = (%s)\n", line,
              input_buffer);
      continue;
    }
    position = atoi(position_string);
    if (position < 1) {
      fprintf(stderr, "Warning: bad position entry at line %d in (%s)\n", line,
              input_buffer);
      continue;
    }
    if (strcmp(record_type, old_record_type) != 0) {
      strcpy(old_record_type, record_type);
      current_position = 1;
      if (*output_buffer)
        printf("%s\n", output_buffer);
      output_buffer_ptr = output_buffer;
      output_buffer_ptr += sprintf(output_buffer_ptr, "%s|", record_type);
      if (position != current_position) {
        output_buffer_ptr +=
            output_unuseds(output_buffer_ptr, position - current_position, 1);
        current_position = position + 1;
        output_buffer_ptr += sprintf(output_buffer_ptr, ",%s", datatype);
      } else {
        current_position++;
        output_buffer_ptr += sprintf(output_buffer_ptr, "%s", datatype);
      }
    } else {
      if (position != current_position) {
        output_buffer_ptr +=
            output_unuseds(output_buffer_ptr, position - current_position, 0);
        current_position = position;
      }
      current_position++;
      output_buffer_ptr += sprintf(output_buffer_ptr, ",%s", datatype);
    }
  }
  printf("%s\n", output_buffer);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x810(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1060 <memset@plt>
lea    -0x810(%rbp),%rax
mov    %rax,-0x818(%rbp)
lea    -0x8a0(%rbp),%rdi
xor    %esi,%esi
mov    $0x80,%edx
call   1060 <memset@plt>
movl   $0x0,-0xa2c(%rbp)
movl   $0x0,-0xa34(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     1243 <main+0x93>
mov    0x2db6(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xdce(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0xa28(%rbp)
lea    -0x410(%rbp),%rdi
mov    0x2d88(%rip),%rax
mov    (%rax),%esi
call   1040 <get_line@plt>
cmp    $0x0,%rax
je     1577 <main+0x3c7>
mov    -0xa2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xa2c(%rbp)
lea    -0x920(%rbp),%rdi
lea    -0x410(%rbp),%rdx
mov    $0x7c,%esi
xor    %ecx,%ecx
call   10d0 <piece@plt>
lea    -0x9a0(%rbp),%rdi
lea    -0x410(%rbp),%rdx
mov    $0x7c,%esi
mov    $0x1,%ecx
call   10d0 <piece@plt>
cmp    $0x0,%eax
jne    12e9 <main+0x139>
mov    0x2d11(%rip),%rax
mov    (%rax),%edi
mov    -0xa2c(%rbp),%edx
lea    -0x410(%rbp),%rcx
lea    0xd36(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
jmp    1252 <main+0xa2>
lea    -0xa20(%rbp),%rdi
lea    -0x410(%rbp),%rdx
mov    $0x7c,%esi
mov    $0x2,%ecx
call   10d0 <piece@plt>
cmp    $0x0,%eax
jne    1338 <main+0x188>
mov    0x2cc2(%rip),%rax
mov    (%rax),%edi
mov    -0xa2c(%rbp),%edx
lea    -0x410(%rbp),%rcx
lea    0xce7(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
jmp    1252 <main+0xa2>
lea    -0xa20(%rbp),%rdi
call   10a0 <atoi@plt>
mov    %eax,-0xa30(%rbp)
cmpl   $0x1,-0xa30(%rbp)
jge    1380 <main+0x1d0>
mov    0x2c7a(%rip),%rax
mov    (%rax),%edi
mov    -0xa2c(%rbp),%edx
lea    -0x410(%rbp),%rcx
lea    0xcc5(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
jmp    1252 <main+0xa2>
lea    -0x920(%rbp),%rdi
lea    -0x8a0(%rbp),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
je     14e5 <main+0x335>
lea    -0x8a0(%rbp),%rdi
lea    -0x920(%rbp),%rsi
call   1030 <strcpy@plt>
movl   $0x1,-0xa34(%rbp)
cmpb   $0x0,-0x810(%rbp)
je     13da <main+0x22a>
lea    -0x810(%rbp),%rsi
lea    0xc94(%rip),%rdi
call   1050 <printf@plt>
lea    -0x810(%rbp),%rax
mov    %rax,-0x818(%rbp)
mov    -0x818(%rbp),%rdi
lea    -0x920(%rbp),%rdx
lea    0xc70(%rip),%rsi
call   10b0 <sprintf@plt>
mov    %eax,%ecx
mov    -0x818(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x818(%rbp)
mov    -0xa30(%rbp),%eax
cmp    -0xa34(%rbp),%eax
je     14a1 <main+0x2f1>
mov    -0x818(%rbp),%rdi
mov    -0xa30(%rbp),%esi
sub    -0xa34(%rbp),%esi
mov    $0x1,%edx
call   1090 <output_unuseds@plt>
mov    %eax,%ecx
mov    -0x818(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x818(%rbp)
mov    -0xa30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xa34(%rbp)
mov    -0x818(%rbp),%rdi
lea    -0x9a0(%rbp),%rdx
lea    0xbf0(%rip),%rsi
call   10b0 <sprintf@plt>
mov    %eax,%ecx
mov    -0x818(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x818(%rbp)
jmp    14e0 <main+0x330>
mov    -0xa34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xa34(%rbp)
mov    -0x818(%rbp),%rdi
lea    -0x9a0(%rbp),%rdx
lea    0xbad(%rip),%rsi
call   10b0 <sprintf@plt>
mov    %eax,%ecx
mov    -0x818(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x818(%rbp)
jmp    1572 <main+0x3c2>
mov    -0xa30(%rbp),%eax
cmp    -0xa34(%rbp),%eax
je     1533 <main+0x383>
mov    -0x818(%rbp),%rdi
mov    -0xa30(%rbp),%esi
sub    -0xa34(%rbp),%esi
xor    %edx,%edx
call   1090 <output_unuseds@plt>
mov    %eax,%ecx
mov    -0x818(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x818(%rbp)
mov    -0xa30(%rbp),%eax
mov    %eax,-0xa34(%rbp)
mov    -0xa34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xa34(%rbp)
mov    -0x818(%rbp),%rdi
lea    -0x9a0(%rbp),%rdx
lea    0xb1a(%rip),%rsi
call   10b0 <sprintf@plt>
mov    %eax,%ecx
mov    -0x818(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x818(%rbp)
jmp    1252 <main+0xa2>
lea    -0x810(%rbp),%rsi
lea    0xae4(%rip),%rdi
call   1050 <printf@plt>
xor    %edi,%edi
call   10c0 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xa18,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0x210(%rsp),%rdi
mov    $0x400,%edx
xor    %esi,%esi
call   1070 <memset@plt>
xorps  %xmm0,%xmm0
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
cmp    $0x2,%ebp
jne    1253 <main+0x93>
mov    0x2dc4(%rip),%rax
mov    (%rax),%esi
lea    0x610(%rsp),%rdi
call   1040 <get_line@plt>
test   %rax,%rax
jne    1277 <main+0xb7>
lea    0xe2a(%rip),%rdi
lea    0x210(%rsp),%rsi
call   1060 <printf@plt>
xor    %edi,%edi
call   10d0 <exit@plt>
mov    0x2d7e(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xd9a(%rip),%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
lea    0x190(%rsp),%r15
lea    0x610(%rsp),%rbx
lea    0xd85(%rip),%r12
lea    0x110(%rsp),%r13
movl   $0x0,0xc(%rsp)
lea    0x210(%rsp),%rax
mov    %rax,(%rsp)
xor    %r14d,%r14d
add    $0x1,%r14d
jmp    12f4 <main+0x134>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    0x2d11(%rip),%rax
mov    (%rax),%edi
mov    %r14d,%edx
mov    %rbx,%rcx
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    0x2d0b(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
call   1040 <get_line@plt>
add    $0x1,%r14d
test   %rax,%rax
je     1238 <main+0x78>
mov    %r15,%rdi
mov    $0x7c,%esi
mov    %rbx,%rdx
xor    %ecx,%ecx
call   10e0 <piece@plt>
lea    0x90(%rsp),%rdi
mov    $0x7c,%esi
mov    %rbx,%rdx
mov    $0x1,%ecx
call   10e0 <piece@plt>
mov    %r12,%rsi
test   %eax,%eax
je     12c0 <main+0x100>
mov    %r13,%rdi
mov    $0x7c,%esi
mov    %rbx,%rdx
mov    $0x2,%ecx
call   10e0 <piece@plt>
mov    %r12,%rsi
test   %eax,%eax
je     12c0 <main+0x100>
mov    %r13,%rdi
call   10b0 <atoi@plt>
lea    0xce3(%rip),%rsi
test   %eax,%eax
jle    12c0 <main+0x100>
mov    %eax,%ebp
mov    %r15,%rdi
lea    0x10(%rsp),%rsi
call   1080 <strcmp@plt>
test   %rax,%rax
je     13fb <main+0x23b>
lea    0x10(%rsp),%rdi
mov    %r15,%rsi
call   1030 <strcpy@plt>
cmpb   $0x0,0x210(%rsp)
lea    0x210(%rsp),%rdi
je     13b1 <main+0x1f1>
lea    0xccd(%rip),%rdi
lea    0x210(%rsp),%rsi
call   1060 <printf@plt>
lea    0x210(%rsp),%rdi
lea    0xcb5(%rip),%rsi
mov    %r15,%rdx
call   10c0 <sprintf@plt>
cltq
add    %rsp,%rax
add    $0x210,%rax
cmp    $0x1,%ebp
jne    140b <main+0x24b>
mov    %rax,%rbp
mov    %rax,%rdi
lea    0x90(%rsp),%rsi
call   1050 <stpcpy@plt>
sub    %ebp,%eax
cltq
add    %rbp,%rax
mov    %rax,(%rsp)
movl   $0x2,0xc(%rsp)
jmp    1490 <main+0x2d0>
mov    %ebp,%esi
mov    0xc(%rsp),%eax
sub    %eax,%esi
jne    1453 <main+0x293>
mov    (%rsp),%rdi
jmp    1469 <main+0x2a9>
lea    -0x1(%rbp),%esi
mov    %rax,%rdi
mov    %rax,(%rsp)
mov    $0x1,%edx
call   10a0 <output_unuseds@plt>
movslq %eax,%rdi
add    (%rsp),%rdi
mov    %rdi,(%rsp)
add    $0x1,%ebp
lea    0xc3d(%rip),%rsi
lea    0x90(%rsp),%rdx
call   10c0 <sprintf@plt>
cltq
add    (%rsp),%rax
mov    %rax,(%rsp)
mov    %ebp,%eax
mov    %ebp,0xc(%rsp)
jmp    1490 <main+0x2d0>
mov    (%rsp),%rdi
xor    %edx,%edx
call   10a0 <output_unuseds@plt>
mov    (%rsp),%rdi
cltq
add    %rax,%rdi
mov    %ebp,%eax
add    $0x1,%eax
mov    %eax,0xc(%rsp)
mov    %rdi,%rbp
lea    0xbf7(%rip),%rsi
lea    0x90(%rsp),%rdx
call   10c0 <sprintf@plt>
cltq
add    %rax,%rbp
mov    %rbp,(%rsp)
mov    0x2b51(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
call   1040 <get_line@plt>
test   %rax,%rax
je     1238 <main+0x78>
add    $0x1,%r14d
jmp    12f4 <main+0x134>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [19 x i8] c"Usage: %s station\0A\00"
@stdin = global i32 0
@.str.1 = [38 x i8] c"Warning: cannot parse line %d = (%s)\0A\00"
@.str.2 = [48 x i8] c"Warning: bad position entry at line %d in (%s)\0A\00"
@.str.3 = [4 x i8] c"%s\0A\00"
@.str.4 = [4 x i8] c"%s|\00"
@.str.5 = [4 x i8] c",%s\00"
@.str.6 = [3 x i8] c"%s\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [1024 x i8]
%7 = alloca [1024 x i8]
%8 = alloca i8*
%9 = alloca [128 x i8]
%10 = alloca [128 x i8]
%11 = alloca [128 x i8]
%12 = alloca [128 x i8]
%13 = alloca i8*
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%17 = bitcast [1024 x i8]* %7 to i8*
%18 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
store i8* %18, i8** %8
%19 = bitcast [128 x i8]* %9 to i8*
store i32 0, i32* %14
store i32 0, i32* %16
%20 = load i32, i32* %4
%21 = icmp ne i32 %20, 2
br i1 %21, label %22, label %29
22: ; preds = %2
%23 = load i32, i32* @stderr
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 0
%26 = load i8*, i8** %25
%27 = call i32 (i32, i8*, ...) @fprintf(i32 %23, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %26)
%28 = call i32 @exit(i32 1)
unreachable
29: ; preds = %2
%30 = load i8**, i8*** %5
%31 = getelementptr inbounds i8*, i8** %30, i64 1
%32 = load i8*, i8** %31
store i8* %32, i8** %13
br label %33
33: ; preds = %149, %68, %58, %48, %29
%34 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%35 = load i32, i32* @stdin
%36 = call i64 @get_line(i8* %34, i32 %35)
%37 = icmp ne i64 %36, 0
br i1 %37, label %38, label %150
38: ; preds = %33
%39 = load i32, i32* %14
%40 = add nsw i32 %39, 1
store i32 %40, i32* %14
%41 = getelementptr inbounds [128 x i8], [128 x i8]* %10, i64 0, i64 0
%42 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%43 = call i32 @piece(i8* %41, i8 signext 124, i8* %42, i32 0)
%44 = getelementptr inbounds [128 x i8], [128 x i8]* %11, i64 0, i64 0
%45 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%46 = call i32 @piece(i8* %44, i8 signext 124, i8* %45, i32 1)
%47 = icmp ne i32 %46, 0
br i1 %47, label %53, label %48
48: ; preds = %38
%49 = load i32, i32* @stderr
%50 = load i32, i32* %14
%51 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%52 = call i32 (i32, i8*, ...) @fprintf(i32 %49, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i32 %50, i8* %51)
br label %33
53: ; preds = %38
%54 = getelementptr inbounds [128 x i8], [128 x i8]* %12, i64 0, i64 0
%55 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%56 = call i32 @piece(i8* %54, i8 signext 124, i8* %55, i32 2)
%57 = icmp ne i32 %56, 0
br i1 %57, label %63, label %58
58: ; preds = %53
%59 = load i32, i32* @stderr
%60 = load i32, i32* %14
%61 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%62 = call i32 (i32, i8*, ...) @fprintf(i32 %59, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i32 %60, i8* %61)
br label %33
63: ; preds = %53
%64 = getelementptr inbounds [128 x i8], [128 x i8]* %12, i64 0, i64 0
%65 = call i32 @atoi(i8* %64)
store i32 %65, i32* %15
%66 = load i32, i32* %15
%67 = icmp slt i32 %66, 1
br i1 %67, label %68, label %73
68: ; preds = %63
%69 = load i32, i32* @stderr
%70 = load i32, i32* %14
%71 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%72 = call i32 (i32, i8*, ...) @fprintf(i32 %69, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.2, i64 0, i64 0), i32 %70, i8* %71)
br label %33
73: ; preds = %63
%74 = getelementptr inbounds [128 x i8], [128 x i8]* %10, i64 0, i64 0
%75 = getelementptr inbounds [128 x i8], [128 x i8]* %9, i64 0, i64 0
%76 = call i64 @strcmp(i8* %74, i8* %75)
%77 = icmp ne i64 %76, 0
br i1 %77, label %78, label %126
78: ; preds = %73
%79 = getelementptr inbounds [128 x i8], [128 x i8]* %9, i64 0, i64 0
%80 = getelementptr inbounds [128 x i8], [128 x i8]* %10, i64 0, i64 0
%81 = call i32 @strcpy(i8* %79, i8* %80)
store i32 1, i32* %16
%82 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%83 = load i8, i8* %82
%84 = icmp ne i8 %83, 0
br i1 %84, label %85, label %88
85: ; preds = %78
%86 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%87 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %86)
br label %88
88: ; preds = %85, %78
%89 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
store i8* %89, i8** %8
%90 = load i8*, i8** %8
%91 = getelementptr inbounds [128 x i8], [128 x i8]* %10, i64 0, i64 0
%92 = call i32 @sprintf(i8* %90, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* %91)
%93 = load i8*, i8** %8
%94 = sext i32 %92 to i64
%95 = getelementptr inbounds i8, i8* %93, i64 %94
store i8* %95, i8** %8
%96 = load i32, i32* %15
%97 = load i32, i32* %16
%98 = icmp ne i32 %96, %97
br i1 %98, label %99, label %116
99: ; preds = %88
%100 = load i8*, i8** %8
%101 = load i32, i32* %15
%102 = load i32, i32* %16
%103 = sub nsw i32 %101, %102
%104 = call i32 @output_unuseds(i8* %100, i32 %103, i32 1)
%105 = load i8*, i8** %8
%106 = sext i32 %104 to i64
%107 = getelementptr inbounds i8, i8* %105, i64 %106
store i8* %107, i8** %8
%108 = load i32, i32* %15
%109 = add nsw i32 %108, 1
store i32 %109, i32* %16
%110 = load i8*, i8** %8
%111 = getelementptr inbounds [128 x i8], [128 x i8]* %11, i64 0, i64 0
%112 = call i32 @sprintf(i8* %110, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* %111)
%113 = load i8*, i8** %8
%114 = sext i32 %112 to i64
%115 = getelementptr inbounds i8, i8* %113, i64 %114
store i8* %115, i8** %8
br label %125
116: ; preds = %88
%117 = load i32, i32* %16
%118 = add nsw i32 %117, 1
store i32 %118, i32* %16
%119 = load i8*, i8** %8
%120 = getelementptr inbounds [128 x i8], [128 x i8]* %11, i64 0, i64 0
%121 = call i32 @sprintf(i8* %119, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8* %120)
%122 = load i8*, i8** %8
%123 = sext i32 %121 to i64
%124 = getelementptr inbounds i8, i8* %122, i64 %123
store i8* %124, i8** %8
br label %125
125: ; preds = %116, %99
br label %149
126: ; preds = %73
%127 = load i32, i32* %15
%128 = load i32, i32* %16
%129 = icmp ne i32 %127, %128
br i1 %129, label %130, label %140
130: ; preds = %126
%131 = load i8*, i8** %8
%132 = load i32, i32* %15
%133 = load i32, i32* %16
%134 = sub nsw i32 %132, %133
%135 = call i32 @output_unuseds(i8* %131, i32 %134, i32 0)
%136 = load i8*, i8** %8
%137 = sext i32 %135 to i64
%138 = getelementptr inbounds i8, i8* %136, i64 %137
store i8* %138, i8** %8
%139 = load i32, i32* %15
store i32 %139, i32* %16
br label %140
140: ; preds = %130, %126
%141 = load i32, i32* %16
%142 = add nsw i32 %141, 1
store i32 %142, i32* %16
%143 = load i8*, i8** %8
%144 = getelementptr inbounds [128 x i8], [128 x i8]* %11, i64 0, i64 0
%145 = call i32 @sprintf(i8* %143, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* %144)
%146 = load i8*, i8** %8
%147 = sext i32 %145 to i64
%148 = getelementptr inbounds i8, i8* %146, i64 %147
store i8* %148, i8** %8
br label %149
149: ; preds = %140, %125
br label %33
150: ; preds = %33
%151 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%152 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %151)
%153 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [19 x i8] c"Usage: %s station\0A\00"
@stdin = global i32 0
@.str.1 = [38 x i8] c"Warning: cannot parse line %d = (%s)\0A\00"
@.str.2 = [48 x i8] c"Warning: bad position entry at line %d in (%s)\0A\00"
@.str.3 = [4 x i8] c"%s\0A\00"
@.str.4 = [4 x i8] c"%s|\00"
@.str.5 = [4 x i8] c",%s\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [1024 x i8]
%4 = alloca [1024 x i8]
%5 = alloca [128 x i8]
%6 = alloca [128 x i8]
%7 = alloca [128 x i8]
%8 = alloca [128 x i8]
%9 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%10 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%11 = getelementptr inbounds [128 x i8], [128 x i8]* %5, i64 0, i64 0
%12 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%13 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
%14 = getelementptr inbounds [128 x i8], [128 x i8]* %8, i64 0, i64 0
%15 = icmp eq i32 %0, 2
br i1 %15, label %16, label %20
16: ; preds = %2
%17 = load i32, i32* @stdin
%18 = call i64 @get_line(i8* %9, i32 %17)
%19 = icmp eq i64 %18, 0
br i1 %19, label %99, label %95
20: ; preds = %2
%21 = load i32, i32* @stderr
%22 = load i8*, i8** %1
%23 = tail call i32 (i32, i8*, ...) @fprintf(i32 %21, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %22)
%24 = tail call i32 @exit(i32 1)
unreachable
25: ; preds = %95, %31
%26 = phi i32 [ %98, %95 ], [ %27, %31 ]
%27 = add nsw i32 %26, 1
%28 = call i32 @piece(i8* %12, i8 signext 124, i8* %9, i32 0)
%29 = call i32 @piece(i8* %13, i8 signext 124, i8* %9, i32 1)
%30 = icmp eq i32 %29, 0
br i1 %30, label %31, label %38
31: ; preds = %25, %41, %38
%32 = phi i8* [ getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), %38 ], [ getelementptr inbounds ([48 x i8], [48 x i8]* @.str.2, i64 0, i64 0), %41 ], [ getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), %25 ]
%33 = load i32, i32* @stderr
%34 = call i32 (i32, i8*, ...) @fprintf(i32 %33, i8* %32, i32 %27, i8* %9)
%35 = load i32, i32* @stdin
%36 = call i64 @get_line(i8* %9, i32 %35)
%37 = icmp eq i64 %36, 0
br i1 %37, label %99, label %25
38: ; preds = %25
%39 = call i32 @piece(i8* %14, i8 signext 124, i8* %9, i32 2)
%40 = icmp eq i32 %39, 0
br i1 %40, label %31, label %41
41: ; preds = %38
%42 = call i32 @atoi(i8* %14)
%43 = icmp slt i32 %42, 1
br i1 %43, label %31, label %44
44: ; preds = %41
%45 = call i64 @strcmp(i8* %12, i8* %11)
%46 = icmp eq i64 %45, 0
br i1 %46, label %75, label %47
47: ; preds = %44
%48 = call i32 @strcpy(i8* %11, i8* %12)
%49 = load i8, i8* %10
%50 = icmp eq i8 %49, 0
br i1 %50, label %53, label %51
51: ; preds = %47
%52 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %10)
br label %53
53: ; preds = %51, %47
%54 = call i32 @sprintf(i8* %10, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* %12)
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 %55
%57 = icmp eq i32 %42, 1
br i1 %57, label %67, label %58
58: ; preds = %53
%59 = add nsw i32 %42, -1
%60 = call i32 @output_unuseds(i8* %56, i32 %59, i32 1)
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds i8, i8* %56, i64 %61
%63 = add nuw nsw i32 %42, 1
%64 = call i32 @sprintf(i8* %62, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* %13)
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds i8, i8* %62, i64 %65
br label %89
67: ; preds = %53
%68 = call i8* @stpcpy(i8* %56, i8* %13)
%69 = ptrtoint i8* %68 to i64
%70 = ptrtoint i8* %56 to i64
%71 = sub i64 %69, %70
%72 = shl i64 %71, 32
%73 = ashr exact i64 %72, 32
%74 = getelementptr inbounds i8, i8* %56, i64 %73
br label %89
75: ; preds = %44
%76 = icmp eq i32 %42, %96
br i1 %76, label %82, label %77
77: ; preds = %75
%78 = sub nsw i32 %42, %96
%79 = call i32 @output_unuseds(i8* %97, i32 %78, i32 0)
%80 = sext i32 %79 to i64
%81 = getelementptr inbounds i8, i8* %97, i64 %80
br label %82
82: ; preds = %77, %75
%83 = phi i8* [ %81, %77 ], [ %97, %75 ]
%84 = phi i32 [ %42, %77 ], [ %96, %75 ]
%85 = add nsw i32 %84, 1
%86 = call i32 @sprintf(i8* dereferenceable(1) %83, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* %13)
%87 = sext i32 %86 to i64
%88 = getelementptr inbounds i8, i8* %83, i64 %87
br label %89
89: ; preds = %58, %67, %82
%90 = phi i8* [ %66, %58 ], [ %74, %67 ], [ %88, %82 ]
%91 = phi i32 [ %63, %58 ], [ 2, %67 ], [ %85, %82 ]
%92 = load i32, i32* @stdin
%93 = call i64 @get_line(i8* %9, i32 %92)
%94 = icmp eq i64 %93, 0
br i1 %94, label %99, label %95
95: ; preds = %16, %89
%96 = phi i32 [ %91, %89 ], [ 0, %16 ]
%97 = phi i8* [ %90, %89 ], [ %10, %16 ]
%98 = phi i32 [ %27, %89 ], [ 0, %16 ]
br label %25
99: ; preds = %89, %31, %16
%100 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %10)
%101 = call i32 @exit(i32 0)
unreachable
}