#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*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
scalar_t__ get_line(char *, int /*<<< orphan*/);
scalar_t__ piece(char *, char, char *, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdin;
scalar_t__ strcmp(char *, char *);
int main(int argc, char **argv) {
  char buffer[65536];
  char pair[65536];
  char attribute_data[65536];
  int pair_piece;
  int attribute_data_piece;
  int first_time = 1;
  if (argc != 2) {
    fprintf(stderr, "Usage; %s attribute|data\n", argv[0]);
    exit(1);
  }
  if (strcmp(argv[1], "attribute") == 0)
    attribute_data_piece = 0;
  else
    attribute_data_piece = 1;
  if (get_line(buffer, stdin)) {
    for (pair_piece = 0; piece(pair, '&', buffer, pair_piece); pair_piece++) {
      if (first_time) {
        first_time = 0;
      } else {
        printf("|");
      }
      if (piece(attribute_data, '=', pair, attribute_data_piece)) {
        printf("%s", attribute_data);
      }
    }
  }
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30020,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x3001c(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     11b3 <main+0x53>
mov    0x2e44(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe5c(%rip),%rsi
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe58(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    11e0 <main+0x80>
movl   $0x0,-0x30018(%rbp)
jmp    11ea <main+0x8a>
movl   $0x1,-0x30018(%rbp)
lea    -0x10010(%rbp),%rdi
mov    0x2df0(%rip),%rax
mov    (%rax),%esi
call   1030 <get_line@plt>
cmp    $0x0,%rax
je     12c0 <main+0x160>
movl   $0x0,-0x30014(%rbp)
lea    -0x20010(%rbp),%rdi
lea    -0x10010(%rbp),%rdx
mov    -0x30014(%rbp),%ecx
mov    $0x26,%esi
call   1080 <piece@plt>
cmp    $0x0,%rax
je     12bb <main+0x15b>
cmpl   $0x0,-0x3001c(%rbp)
je     1257 <main+0xf7>
movl   $0x0,-0x3001c(%rbp)
jmp    1265 <main+0x105>
lea    0xdc6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x30010(%rbp),%rdi
lea    -0x20010(%rbp),%rdx
mov    -0x30018(%rbp),%ecx
mov    $0x3d,%esi
call   1080 <piece@plt>
cmp    $0x0,%rax
je     12a2 <main+0x142>
lea    -0x30010(%rbp),%rsi
lea    0xd8b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    12a7 <main+0x147>
mov    -0x30014(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30014(%rbp)
jmp    1213 <main+0xb3>
jmp    12c0 <main+0x160>
lea    0xd51(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30020,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x30008,%rsp
cmp    $0x2,%edi
jne    12c9 <main+0x159>
mov    0x8(%rsi),%rdi
lea    0xe85(%rip),%rsi
call   1060 <strcmp@plt>
xor    %r14d,%r14d
test   %rax,%rax
setne  %bl
mov    0x2e3e(%rip),%rax
mov    (%rax),%esi
lea    0x10000(%rsp),%rdi
call   1040 <get_line@plt>
test   %rax,%rax
je     12ab <main+0x13b>
mov    %rsp,%rdi
lea    0x10000(%rsp),%rdx
mov    $0x26,%esi
xor    %ecx,%ecx
call   1090 <piece@plt>
test   %rax,%rax
je     12ab <main+0x13b>
mov    %bl,%r14b
lea    0x20000(%rsp),%rdi
mov    %rsp,%rdx
mov    $0x3d,%esi
mov    %r14d,%ecx
call   1090 <piece@plt>
test   %rax,%rax
je     1218 <main+0xa8>
lea    0xe1b(%rip),%rdi
lea    0x20000(%rsp),%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rsp,%rdi
lea    0x10000(%rsp),%rdx
mov    $0x26,%esi
mov    $0x1,%ecx
call   1090 <piece@plt>
test   %rax,%rax
je     12ab <main+0x13b>
mov    $0x2,%ebp
lea    0x20000(%rsp),%r15
mov    %rsp,%rbx
lea    0x10000(%rsp),%r12
lea    0xdce(%rip),%r13
jmp    127a <main+0x10a>
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    $0x26,%esi
mov    %r12,%rdx
mov    %ebp,%ecx
call   1090 <piece@plt>
add    $0x1,%ebp
test   %rax,%rax
je     12ab <main+0x13b>
mov    $0x7c,%edi
call   1030 <putchar@plt>
mov    %r15,%rdi
mov    $0x3d,%esi
mov    %rbx,%rdx
mov    %r14d,%ecx
call   1090 <piece@plt>
test   %rax,%rax
je     1260 <main+0xf0>
mov    %r13,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    1260 <main+0xf0>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x30008,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2d08(%rip),%rax
mov    (%rax),%edi
mov    (%rsi),%rdx
lea    0xd24(%rip),%rsi
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [26 x i8] c"Usage; %s attribute|data\0A\00"
@.str.1 = [10 x i8] c"attribute\00"
@stdin = global i32 0
@.str.2 = [2 x i8] c"|\00"
@.str.3 = [3 x i8] c"%s\00"
@.str.4 = [2 x i8] c"\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [65536 x i8]
%7 = alloca [65536 x i8]
%8 = alloca [65536 x i8]
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1, i32* %11
%12 = load i32, i32* %4
%13 = icmp ne i32 %12, 2
br i1 %13, label %14, label %21
14: ; preds = %2
%15 = load i32, i32* @stderr
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 0
%18 = load i8*, i8** %17
%19 = call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %18)
%20 = call i32 @exit(i32 1)
unreachable
21: ; preds = %2
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 1
%24 = load i8*, i8** %23
%25 = call i64 @strcmp(i8* %24, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%26 = icmp eq i64 %25, 0
br i1 %26, label %27, label %28
27: ; preds = %21
store i32 0, i32* %10
br label %29
28: ; preds = %21
store i32 1, i32* %10
br label %29
29: ; preds = %28, %27
%30 = getelementptr inbounds [65536 x i8], [65536 x i8]* %6, i64 0, i64 0
%31 = load i32, i32* @stdin
%32 = call i64 @get_line(i8* %30, i32 %31)
%33 = icmp ne i64 %32, 0
br i1 %33, label %34, label %61
34: ; preds = %29
store i32 0, i32* %9
br label %35
35: ; preds = %57, %34
%36 = getelementptr inbounds [65536 x i8], [65536 x i8]* %7, i64 0, i64 0
%37 = getelementptr inbounds [65536 x i8], [65536 x i8]* %6, i64 0, i64 0
%38 = load i32, i32* %9
%39 = call i64 @piece(i8* %36, i8 signext 38, i8* %37, i32 %38)
%40 = icmp ne i64 %39, 0
br i1 %40, label %41, label %60
41: ; preds = %35
%42 = load i32, i32* %11
%43 = icmp ne i32 %42, 0
br i1 %43, label %44, label %45
44: ; preds = %41
store i32 0, i32* %11
br label %47
45: ; preds = %41
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %47
47: ; preds = %45, %44
%48 = getelementptr inbounds [65536 x i8], [65536 x i8]* %8, i64 0, i64 0
%49 = getelementptr inbounds [65536 x i8], [65536 x i8]* %7, i64 0, i64 0
%50 = load i32, i32* %10
%51 = call i64 @piece(i8* %48, i8 signext 61, i8* %49, i32 %50)
%52 = icmp ne i64 %51, 0
br i1 %52, label %53, label %56
53: ; preds = %47
%54 = getelementptr inbounds [65536 x i8], [65536 x i8]* %8, i64 0, i64 0
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %54)
br label %56
56: ; preds = %53, %47
br label %57
57: ; preds = %56
%58 = load i32, i32* %9
%59 = add nsw i32 %58, 1
store i32 %59, i32* %9
br label %35
60: ; preds = %35
br label %61
61: ; preds = %60, %29
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [26 x i8] c"Usage; %s attribute|data\0A\00"
@.str.1 = [10 x i8] c"attribute\00"
@stdin = global i32 0
@.str.3 = [3 x i8] c"%s\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [65536 x i8]
%4 = alloca [65536 x i8]
%5 = alloca [65536 x i8]
%6 = getelementptr inbounds [65536 x i8], [65536 x i8]* %3, i64 0, i64 0
%7 = getelementptr inbounds [65536 x i8], [65536 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, 2
br i1 %9, label %15, label %10
10: ; preds = %2
%11 = load i32, i32* @stderr
%12 = load i8*, i8** %1
%13 = tail call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([26 x i8], [26 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 = tail call i64 @strcmp(i8* %17, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%19 = icmp ne i64 %18, 0
%20 = zext i1 %19 to i32
%21 = load i32, i32* @stdin
%22 = call i64 @get_line(i8* %6, i32 %21)
%23 = icmp eq i64 %22, 0
br i1 %23, label %46, label %24
24: ; preds = %15
%25 = call i64 @piece(i8* %7, i8 signext 38, i8* %6, i32 0)
%26 = icmp eq i64 %25, 0
br i1 %26, label %46, label %27
27: ; preds = %24
%28 = call i64 @piece(i8* %8, i8 signext 61, i8* %7, i32 %20)
%29 = icmp eq i64 %28, 0
br i1 %29, label %32, label %30
30: ; preds = %27
%31 = 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 %32
32: ; preds = %30, %27
%33 = call i64 @piece(i8* %7, i8 signext 38, i8* %6, i32 1)
%34 = icmp eq i64 %33, 0
br i1 %34, label %46, label %35
35: ; preds = %32, %42
%36 = phi i32 [ %43, %42 ], [ 1, %32 ]
%37 = call i32 @putchar(i32 124)
%38 = call i64 @piece(i8* %8, i8 signext 61, i8* %7, i32 %20)
%39 = icmp eq i64 %38, 0
br i1 %39, label %42, label %40
40: ; preds = %35
%41 = 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 %42
42: ; preds = %35, %40
%43 = add nuw nsw i32 %36, 1
%44 = call i64 @piece(i8* %7, i8 signext 38, i8* %6, i32 %43)
%45 = icmp eq i64 %44, 0
br i1 %45, label %46, label %35
46: ; preds = %42, %32, %24, %15
%47 = call i32 @putchar(i32 10)
ret i32 0
}