#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__ printf(char *, char, int);
scalar_t__ scanf(char *, ...);
int main() {
  char character[100];
  int len;
  scanf("%d", &len);
  int i = 0;
  while (i < len && scanf("%c", &character[i++]))
    ;
  i = 0;
  while (i < len && printf("%c %d", character[i++], i))
    ;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xecd(%rip),%rdi
lea    -0x74(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movl   $0x0,-0x78(%rbp)
mov    -0x78(%rbp),%ecx
xor    %eax,%eax
cmp    -0x74(%rbp),%ecx
mov    %al,-0x79(%rbp)
jge    1188 <main+0x68>
mov    -0x78(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x78(%rbp)
cltq
lea    -0x70(%rbp),%rsi
add    %rax,%rsi
lea    0xe89(%rip),%rdi
mov    $0x0,%al
call   1040 <scanf@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x79(%rbp)
mov    -0x79(%rbp),%al
test   $0x1,%al
jne    1198 <main+0x78>
jmp    119d <main+0x7d>
jmp    114b <main+0x2b>
movl   $0x0,-0x78(%rbp)
mov    -0x78(%rbp),%ecx
xor    %eax,%eax
cmp    -0x74(%rbp),%ecx
mov    %al,-0x7a(%rbp)
jge    11e2 <main+0xc2>
mov    -0x78(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x78(%rbp)
cltq
mov    -0x70(%rbp,%rax,1),%al
mov    -0x78(%rbp),%edx
lea    0xe33(%rip),%rdi
movsbl %al,%esi
call   1030 <printf@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x7a(%rbp)
mov    -0x7a(%rbp),%al
test   $0x1,%al
jne    11f2 <main+0xd2>
jmp    11f7 <main+0xd7>
jmp    11a4 <main+0x84>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x78,%rsp
lea    0xed8(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
lea    0xebf(%rip),%r14
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movslq 0xc(%rsp),%rax
cmp    %rax,%rbx
jge    1175 <main+0x55>
lea    (%rsp,%rbx,1),%rsi
add    $0x10,%rsi
add    $0x1,%rbx
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <scanf@plt>
test   %rax,%rax
jne    1150 <main+0x30>
xor    %ebx,%ebx
lea    0xe85(%rip),%r14
xchg   %ax,%ax
movslq 0xc(%rsp),%rax
cmp    %rax,%rbx
jge    11a2 <main+0x82>
movsbl 0x10(%rsp,%rbx,1),%esi
add    $0x1,%rbx
mov    %r14,%rdi
mov    %ebx,%edx
call   1030 <printf@plt>
test   %rax,%rax
jne    1180 <main+0x60>
xor    %eax,%eax
add    $0x78,%rsp
pop    %rbx
pop    %r14
ret

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

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