#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*/ printf(char *, char *);
int scanf(char *, char *);
int main() {
  char chars[1000000];
  int index = 0;
  while (scanf("%c", &chars[index]) != -1) {
    if (chars[index++] == '<')
      index -= 2;
  }
  chars[index] = 0x0;
  printf("%s\n", chars);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf4260,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xf4254(%rbp)
movslq -0xf4254(%rbp),%rax
lea    -0xf4250(%rbp),%rsi
add    %rax,%rsi
lea    0xeac(%rip),%rdi
call   1040 <scanf@plt>
cmp    $0xffffffff,%eax
je     119a <main+0x7a>
mov    -0xf4254(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0xf4254(%rbp)
cltq
movsbl -0xf4250(%rbp,%rax,1),%eax
ff
cmp    $0x3c,%eax
jne    1195 <main+0x75>
mov    -0xf4254(%rbp),%eax
sub    $0x2,%eax
mov    %eax,-0xf4254(%rbp)
jmp    113c <main+0x1c>
movslq -0xf4254(%rbp),%rax
movb   $0x0,-0xf4250(%rbp,%rax,1)
lea    -0xf4250(%rbp),%rsi
lea    0xe4c(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0xf4260,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0xf4240,%rsp
mov    %rsp,%r15
lea    0xeca(%rip),%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
cmp    $0xffffffff,%eax
je     1176 <main+0x56>
xor    %ebx,%ebx
mov    %rsp,%r15
lea    0xeb1(%rip),%r14
nop
xor    %eax,%eax
cmpb   $0x3c,(%r15)
setne  %al
lea    (%rbx,%rax,2),%ebx
add    $0xffffffff,%ebx
movslq %ebx,%rax
lea    (%rsp,%rax,1),%r15
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
cmp    $0xffffffff,%eax
jne    1150 <main+0x30>
movb   $0x0,(%r15)
lea    0xe82(%rip),%rdi
mov    %rsp,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0xf4240,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%c\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [1000000 x i8]
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
br label %4
4: ; preds = %21, %0
%5 = load i32, i32* %3
%6 = sext i32 %5 to i64
%7 = getelementptr inbounds [1000000 x i8], [1000000 x i8]* %2, i64 0, i64 %6
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %7)
%9 = icmp ne i32 %8, -1
br i1 %9, label %10, label %22
10: ; preds = %4
%11 = load i32, i32* %3
%12 = add nsw i32 %11, 1
store i32 %12, i32* %3
%13 = sext i32 %11 to i64
%14 = getelementptr inbounds [1000000 x i8], [1000000 x i8]* %2, i64 0, i64 %13
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = icmp eq i32 %16, 60
br i1 %17, label %18, label %21
18: ; preds = %10
%19 = load i32, i32* %3
%20 = sub nsw i32 %19, 2
store i32 %20, i32* %3
br label %21
21: ; preds = %18, %10
br label %4
22: ; preds = %4
%23 = load i32, i32* %3
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [1000000 x i8], [1000000 x i8]* %2, i64 0, i64 %24
store i8 0, i8* %25
%26 = getelementptr inbounds [1000000 x i8], [1000000 x i8]* %2, i64 0, i64 0
%27 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %26)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%c\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca [1000000 x i8]
%2 = getelementptr inbounds [1000000 x i8], [1000000 x i8]* %1, i64 0, i64 0
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = icmp eq i32 %3, -1
br i1 %4, label %16, label %5
5: ; preds = %0, %5
%6 = phi i8* [ %13, %5 ], [ %2, %0 ]
%7 = phi i32 [ %11, %5 ], [ 0, %0 ]
%8 = load i8, i8* %6
%9 = icmp eq i8 %8, 60
%10 = select i1 %9, i32 -1, i32 1
%11 = add nsw i32 %10, %7
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [1000000 x i8], [1000000 x i8]* %1, i64 0, i64 %12
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %13)
%15 = icmp eq i32 %14, -1
br i1 %15, label %16, label %5
16: ; preds = %5, %0
%17 = phi i8* [ %2, %0 ], [ %13, %5 ]
store i8 0, i8* %17
%18 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %2)
ret i32 0
}