#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 */
scalar_t__ EOF;
int /*<<< orphan*/ insert(char *, int /*<<< orphan*/, int, int);
int /*<<< orphan*/ printf(char *, char);
scalar_t__ scanf(char *, int *, int *);
int main(int argc, const char *argv[]) {
  char a[100000];
  int i, len = 0, n, v;
  while (scanf("%d %c", &n, &v) != EOF) {
    insert(a, len++, n - 1, v);
  }
  for (i = 0; i < len; i++) {
    printf("%c", a[i]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x186c0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x186b8(%rbp)
lea    0xea6(%rip),%rdi
lea    -0x186bc(%rbp),%rsi
lea    -0x186c0(%rbp),%rdx
call   1040 <scanf@plt>
mov    0x2e74(%rip),%rcx
cmp    (%rcx),%rax
je     11ae <main+0x7e>
lea    -0x186b0(%rbp),%rdi
mov    -0x186b8(%rbp),%esi
mov    %esi,%eax
add    $0x1,%eax
mov    %eax,-0x186b8(%rbp)
mov    -0x186bc(%rbp),%edx
sub    $0x1,%edx
mov    -0x186c0(%rbp),%ecx
call   1050 <insert@plt>
jmp    1153 <main+0x23>
movl   $0x0,-0x186b4(%rbp)
mov    -0x186b4(%rbp),%eax
cmp    -0x186b8(%rbp),%eax
jge    11f9 <main+0xc9>
movslq -0x186b4(%rbp),%rax
lea    0xe2b(%rip),%rdi
movsbl -0x186b0(%rbp,%rax,1),%esi
ff
call   1030 <printf@plt>
mov    -0x186b4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x186b4(%rbp)
jmp    11b8 <main+0x88>
xor    %eax,%eax
add    $0x186c0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x186b8,%rsp
lea    0xeb8(%rip),%rdi
lea    0xc(%rsp),%rsi
lea    0x8(%rsp),%rdx
call   1040 <scanf@plt>
mov    0x2e8a(%rip),%rbp
cmp    0x0(%rbp),%rax
je     11d6 <main+0xa6>
xor    %ebx,%ebx
lea    0x10(%rsp),%r14
lea    0xe8e(%rip),%r15
lea    0xc(%rsp),%r12
lea    0x8(%rsp),%r13
nopl   0x0(%rax)
mov    0xc(%rsp),%edx
add    $0xffffffff,%edx
mov    0x8(%rsp),%ecx
mov    %r14,%rdi
mov    %ebx,%esi
call   1050 <insert@plt>
mov    %r15,%rdi
mov    %r12,%rsi
mov    %r13,%rdx
call   1040 <scanf@plt>
add    $0x1,%rbx
cmp    0x0(%rbp),%rax
jne    1180 <main+0x50>
lea    0xe4f(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsbl (%r14),%esi
mov    %r15,%rdi
call   1030 <printf@plt>
add    $0x1,%r14
add    $0xffffffffffffffff,%rbx
jne    11c0 <main+0x90>
xor    %eax,%eax
add    $0x186b8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%d %c\00"
@EOF = global i64 0
@.str.1 = [3 x i8] c"%c\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [100000 x i8]
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %8
br label %11
11: ; preds = %15, %2
%12 = call i64 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %9, i32* %10)
%13 = load i64, i64* @EOF
%14 = icmp ne i64 %12, %13
br i1 %14, label %15, label %23
15: ; preds = %11
%16 = getelementptr inbounds [100000 x i8], [100000 x i8]* %6, i64 0, i64 0
%17 = load i32, i32* %8
%18 = add nsw i32 %17, 1
store i32 %18, i32* %8
%19 = load i32, i32* %9
%20 = sub nsw i32 %19, 1
%21 = load i32, i32* %10
%22 = call i32 @insert(i8* %16, i32 %17, i32 %20, i32 %21)
br label %11
23: ; preds = %11
store i32 0, i32* %7
br label %24
24: ; preds = %34, %23
%25 = load i32, i32* %7
%26 = load i32, i32* %8
%27 = icmp slt i32 %25, %26
br i1 %27, label %28, label %37
28: ; preds = %24
%29 = load i32, i32* %7
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [100000 x i8], [100000 x i8]* %6, i64 0, i64 %30
%32 = load i8, i8* %31
%33 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8 signext %32)
br label %34
34: ; preds = %28
%35 = load i32, i32* %7
%36 = add nsw i32 %35, 1
store i32 %36, i32* %7
br label %24
37: ; preds = %24
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"%d %c\00"
@EOF = global i64 0
@.str.1 = [3 x i8] c"%c\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [100000 x i8]
%4 = alloca i32
%5 = alloca i32
%6 = getelementptr inbounds [100000 x i8], [100000 x i8]* %3, i64 0, i64 0
%7 = bitcast i32* %4 to i8*
%8 = bitcast i32* %5 to i8*
%9 = call i64 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %4, i32* %5)
%10 = load i64, i64* @EOF
%11 = icmp eq i64 %9, %10
br i1 %11, label %31, label %14
12: ; preds = %14
%13 = zext i32 %16 to i64
br label %24
14: ; preds = %2, %14
%15 = phi i32 [ %16, %14 ], [ 0, %2 ]
%16 = add nuw nsw i32 %15, 1
%17 = load i32, i32* %4
%18 = add nsw i32 %17, -1
%19 = load i32, i32* %5
%20 = call i32 @insert(i8* %6, i32 %15, i32 %18, i32 %19)
%21 = call i64 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %4, i32* %5)
%22 = load i64, i64* @EOF
%23 = icmp eq i64 %21, %22
br i1 %23, label %12, label %14
24: ; preds = %12, %24
%25 = phi i64 [ 0, %12 ], [ %29, %24 ]
%26 = getelementptr inbounds [100000 x i8], [100000 x i8]* %3, i64 0, i64 %25
%27 = load i8, i8* %26
%28 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8 signext %27)
%29 = add nuw nsw i64 %25, 1
%30 = icmp eq i64 %29, %13
br i1 %30, label %31, label %24
31: ; preds = %24, %2
ret i32 0
}