#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*/ buildIubComplement();
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ isalpha(char);
scalar_t__ malloc(int);
int /*<<< orphan*/ memcpy(char *, char *, int);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ process(char *, int);
scalar_t__ realloc(char *, int);
int /*<<< orphan*/ stdin;
int strlen(char *);
int main(int argc, char *argv[]) {
  static char buffer[1024];
  char *inp = (char *)malloc(129);
  int mlen = 128;
  int slen = 0;
  buildIubComplement();
  while (NULL != fgets(buffer, 1023, stdin)) {
    if (buffer[0] == '>') {
      if (slen > 0) {
        process(inp, slen);
        slen = 0;
      }
      printf("%s", buffer);
    } else {
      int l = strlen(buffer);
      while (l > 0 && !isalpha(buffer[l - 1]))
        l--;
      while (slen + l > mlen) {
        mlen += mlen;
        inp = (char *)realloc(inp, mlen + 1);
      }
      memcpy(inp + slen, buffer, l);
      slen += l;
    }
  }
  if (slen > 0)
    process(inp, slen);
  free(inp);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x81,%edi
call   10a0 <malloc@plt>
mov    %rax,-0x18(%rbp)
movl   $0x80,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    $0x0,%al
call   1040 <buildIubComplement@plt>
mov    0x2e08(%rip),%rax
mov    (%rax),%edx
lea    0x2e97(%rip),%rdi
mov    $0x3ff,%esi
call   1080 <fgets@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
je     1303 <main+0x163>
movsbl 0x2e78(%rip),%eax
cmp    $0x3e,%eax
jne    1246 <main+0xa6>
cmpl   $0x0,-0x20(%rbp)
jle    122e <main+0x8e>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%esi
call   1070 <process@plt>
movl   $0x0,-0x20(%rbp)
lea    0xdcb(%rip),%rdi
lea    0x2e44(%rip),%rsi
call   1060 <printf@plt>
jmp    12fe <main+0x15e>
lea    0x2e33(%rip),%rdi
call   1050 <strlen@plt>
mov    %eax,-0x24(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x24(%rbp)
mov    %al,-0x25(%rbp)
jle    1288 <main+0xe8>
mov    -0x24(%rbp),%eax
sub    $0x1,%eax
movslq %eax,%rcx
lea    0x2e0c(%rip),%rax
movsbl (%rax,%rcx,1),%edi
call   10c0 <isalpha@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0x25(%rbp)
mov    -0x25(%rbp),%al
test   $0x1,%al
jne    1298 <main+0xf8>
jmp    12a6 <main+0x106>
mov    -0x24(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x24(%rbp)
jmp    1255 <main+0xb5>
jmp    12ab <main+0x10b>
mov    -0x20(%rbp),%eax
add    -0x24(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jle    12db <main+0x13b>
mov    -0x1c(%rbp),%eax
add    -0x1c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
add    $0x1,%esi
call   10b0 <realloc@plt>
mov    %rax,-0x18(%rbp)
jmp    12ab <main+0x10b>
mov    -0x18(%rbp),%rdi
movslq -0x20(%rbp),%rax
add    %rax,%rdi
mov    -0x24(%rbp),%edx
lea    0x2d90(%rip),%rsi
call   1090 <memcpy@plt>
mov    -0x24(%rbp),%eax
add    -0x20(%rbp),%eax
mov    %eax,-0x20(%rbp)
jmp    11d9 <main+0x39>
cmpl   $0x0,-0x20(%rbp)
jle    1319 <main+0x179>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%esi
call   1070 <process@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    $0x81,%edi
call   10a0 <malloc@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1040 <buildIubComplement@plt>
mov    0x2e22(%rip),%rbp
mov    0x0(%rbp),%edx
lea    0x2eb0(%rip),%r14
mov    %r14,%rdi
mov    $0x3ff,%esi
call   1080 <fgets@plt>
test   %rax,%rax
je     12f1 <main+0x151>
mov    $0x80,%r15d
xor    %r12d,%r12d
jmp    1234 <main+0x94>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movslq %r12d,%rdi
add    %rbx,%rdi
mov    %r14,%rsi
mov    %r13d,%edx
call   1090 <memcpy@plt>
mov    %ebp,%r12d
mov    0x2dcd(%rip),%rbp
mov    0x0(%rbp),%edx
mov    %r14,%rdi
mov    $0x3ff,%esi
call   1080 <fgets@plt>
test   %rax,%rax
je     12e1 <main+0x141>
cmpb   $0x3e,0x2e45(%rip)
jne    1270 <main+0xd0>
test   %r12d,%r12d
jle    1250 <main+0xb0>
mov    %rbx,%rdi
mov    %r12d,%esi
call   1070 <process@plt>
xor    %r12d,%r12d
lea    0xda9(%rip),%rdi
mov    %r14,%rsi
call   1060 <printf@plt>
jmp    121b <main+0x7b>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1050 <strlen@plt>
mov    %eax,%r13d
mov    %eax,%ebp
test   %eax,%eax
mov    $0x0,%eax
cmovns %eax,%r13d
nopl   0x0(%rax,%rax,1)
test   %ebp,%ebp
jle    12ad <main+0x10d>
movsbl -0x1(%rbp,%r14,1),%edi
add    $0xffffffffffffffff,%rbp
call   10c0 <isalpha@plt>
test   %eax,%eax
je     1290 <main+0xf0>
add    $0x1,%ebp
mov    %ebp,%r13d
lea    (%r12,%r13,1),%ebp
cmp    %r15d,%ebp
jle    1200 <main+0x60>
nopw   0x0(%rax,%rax,1)
mov    %r15d,%eax
add    %r15d,%r15d
lea    (%rax,%rax,1),%esi
add    $0x1,%esi
mov    %rbx,%rdi
call   10b0 <realloc@plt>
mov    %rax,%rbx
cmp    %r15d,%ebp
jg     12c0 <main+0x120>
jmp    1200 <main+0x60>
test   %r12d,%r12d
jle    12f1 <main+0x151>
mov    %rbx,%rdi
mov    %r12d,%esi
call   1070 <process@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@main.buffer = internal global [1024 x i8] zeroinitializer
@stdin = global i32 0
@.str = [3 x i8] c"%s\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = call i64 @malloc(i32 129)
%11 = inttoptr i64 %10 to i8*
store i8* %11, i8** %6
store i32 128, i32* %7
store i32 0, i32* %8
%12 = call i32 (...) @buildIubComplement()
br label %13
13: ; preds = %75, %2
%14 = load i32, i32* @stdin
%15 = call i32* @fgets(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @main.buffer, i64 0, i64 0), i32 1023, i32 %14)
%16 = icmp ne i32* null, %15
br i1 %16, label %17, label %76
17: ; preds = %13
%18 = load i8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @main.buffer, i64 0, i64 0)
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %19, 62
br i1 %20, label %21, label %30
21: ; preds = %17
%22 = load i32, i32* %8
%23 = icmp sgt i32 %22, 0
br i1 %23, label %24, label %28
24: ; preds = %21
%25 = load i8*, i8** %6
%26 = load i32, i32* %8
%27 = call i32 @process(i8* %25, i32 %26)
store i32 0, i32* %8
br label %28
28: ; preds = %24, %21
%29 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @main.buffer, i64 0, i64 0))
br label %75
30: ; preds = %17
%31 = call i32 @strlen(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @main.buffer, i64 0, i64 0))
store i32 %31, i32* %9
br label %32
32: ; preds = %46, %30
%33 = load i32, i32* %9
%34 = icmp sgt i32 %33, 0
br i1 %34, label %35, label %44
35: ; preds = %32
%36 = load i32, i32* %9
%37 = sub nsw i32 %36, 1
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [1024 x i8], [1024 x i8]* @main.buffer, i64 0, i64 %38
%40 = load i8, i8* %39
%41 = call i32 @isalpha(i8 signext %40)
%42 = icmp ne i32 %41, 0
%43 = xor i1 %42, true
br label %44
44: ; preds = %35, %32
%45 = phi i1 [ false, %32 ], [ %43, %35 ]
br i1 %45, label %46, label %49
46: ; preds = %44
%47 = load i32, i32* %9
%48 = add nsw i32 %47, -1
store i32 %48, i32* %9
br label %32
49: ; preds = %44
br label %50
50: ; preds = %56, %49
%51 = load i32, i32* %8
%52 = load i32, i32* %9
%53 = add nsw i32 %51, %52
%54 = load i32, i32* %7
%55 = icmp sgt i32 %53, %54
br i1 %55, label %56, label %65
56: ; preds = %50
%57 = load i32, i32* %7
%58 = load i32, i32* %7
%59 = add nsw i32 %58, %57
store i32 %59, i32* %7
%60 = load i8*, i8** %6
%61 = load i32, i32* %7
%62 = add nsw i32 %61, 1
%63 = call i64 @realloc(i8* %60, i32 %62)
%64 = inttoptr i64 %63 to i8*
store i8* %64, i8** %6
br label %50
65: ; preds = %50
%66 = load i8*, i8** %6
%67 = load i32, i32* %8
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds i8, i8* %66, i64 %68
%70 = load i32, i32* %9
%71 = call i32 @memcpy(i8* %69, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @main.buffer, i64 0, i64 0), i32 %70)
%72 = load i32, i32* %9
%73 = load i32, i32* %8
%74 = add nsw i32 %73, %72
store i32 %74, i32* %8
br label %75
75: ; preds = %65, %28
br label %13
76: ; preds = %13
%77 = load i32, i32* %8
%78 = icmp sgt i32 %77, 0
br i1 %78, label %79, label %83
79: ; preds = %76
%80 = load i8*, i8** %6
%81 = load i32, i32* %8
%82 = call i32 @process(i8* %80, i32 %81)
br label %83
83: ; preds = %79, %76
%84 = load i8*, i8** %6
%85 = call i32 @free(i8* %84)
ret i32 0
}

LLVM IR (-O2):
@main.buffer = internal global [1024 x i8] zeroinitializer
@stdin = global i32 0
@.str = [3 x i8] c"%s\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i64 @malloc(i32 129)
%4 = inttoptr i64 %3 to i8*
%5 = tail call i32 (...) @buildIubComplement()
%6 = load i32, i32* @stdin
%7 = tail call i32* @fgets(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @main.buffer, i64 0, i64 0), i32 1023, i32 %6)
%8 = icmp eq i32* %7, null
br i1 %8, label %69, label %9
9: ; preds = %2, %58
%10 = phi i32 [ %61, %58 ], [ 0, %2 ]
%11 = phi i32 [ %60, %58 ], [ 128, %2 ]
%12 = phi i8* [ %59, %58 ], [ %4, %2 ]
%13 = load i8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @main.buffer, i64 0, i64 0)
%14 = icmp eq i8 %13, 62
br i1 %14, label %15, label %22
15: ; preds = %9
%16 = icmp sgt i32 %10, 0
br i1 %16, label %17, label %19
17: ; preds = %15
%18 = tail call i32 @process(i8* %12, i32 %10)
br label %19
19: ; preds = %17, %15
%20 = phi i32 [ 0, %17 ], [ %10, %15 ]
%21 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @main.buffer, i64 0, i64 0))
br label %58
22: ; preds = %9
%23 = tail call i32 @strlen(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @main.buffer, i64 0, i64 0))
%24 = zext i32 %23 to i64
%25 = call i32 @llvm.smin.i32(i32 %23, i32 0)
br label %26
26: ; preds = %30, %22
%27 = phi i64 [ %31, %30 ], [ %24, %22 ]
%28 = trunc i64 %27 to i32
%29 = icmp sgt i32 %28, 0
br i1 %29, label %30, label %38
30: ; preds = %26
%31 = add nsw i64 %27, -1
%32 = getelementptr inbounds [1024 x i8], [1024 x i8]* @main.buffer, i64 0, i64 %31
%33 = load i8, i8* %32
%34 = tail call i32 @isalpha(i8 signext %33)
%35 = icmp eq i32 %34, 0
br i1 %35, label %26, label %36
36: ; preds = %30
%37 = trunc i64 %27 to i32
br label %38
38: ; preds = %26, %36
%39 = phi i32 [ %37, %36 ], [ %25, %26 ]
%40 = add nsw i32 %39, %10
%41 = icmp sgt i32 %40, %11
br i1 %41, label %42, label %52
42: ; preds = %38, %42
%43 = phi i32 [ %45, %42 ], [ %11, %38 ]
%44 = phi i8* [ %48, %42 ], [ %12, %38 ]
%45 = shl nsw i32 %43, 1
%46 = or i32 %45, 1
%47 = tail call i64 @realloc(i8* %44, i32 %46)
%48 = inttoptr i64 %47 to i8*
%49 = icmp sgt i32 %40, %45
br i1 %49, label %42, label %50
50: ; preds = %42
%51 = inttoptr i64 %47 to i8*
br label %52
52: ; preds = %50, %38
%53 = phi i8* [ %12, %38 ], [ %51, %50 ]
%54 = phi i32 [ %11, %38 ], [ %45, %50 ]
%55 = sext i32 %10 to i64
%56 = getelementptr inbounds i8, i8* %53, i64 %55
%57 = tail call i32 @memcpy(i8* %56, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @main.buffer, i64 0, i64 0), i32 %39)
br label %58
58: ; preds = %52, %19
%59 = phi i8* [ %12, %19 ], [ %53, %52 ]
%60 = phi i32 [ %11, %19 ], [ %54, %52 ]
%61 = phi i32 [ %20, %19 ], [ %40, %52 ]
%62 = load i32, i32* @stdin
%63 = tail call i32* @fgets(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @main.buffer, i64 0, i64 0), i32 1023, i32 %62)
%64 = icmp eq i32* %63, null
br i1 %64, label %65, label %9
65: ; preds = %58
%66 = icmp sgt i32 %61, 0
br i1 %66, label %67, label %69
67: ; preds = %65
%68 = tail call i32 @process(i8* %59, i32 %61)
br label %69
69: ; preds = %2, %67, %65
%70 = phi i8* [ %59, %67 ], [ %59, %65 ], [ %4, %2 ]
%71 = tail call i32 @free(i8* %70)
ret i32 0
}