#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__ malloc(int);
int /*<<< orphan*/ print_string(char *, char *, int /*<<< orphan*/, int, int);
int /*<<< orphan*/ scanf(char *, ...);
int main() {
  int n, i, j, m;
  char *c, new[20];
  scanf("%d", &n);
  c = (char *)malloc(n * sizeof(char));
  for (i = 0; i < n; i++) {
    scanf("%c", &c[i]);
    scanf("%c", &c[i]);
  }
  scanf("%d", &m);
  print_string(c, new, 0, n, m);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
movslq -0x8(%rbp),%rax
shl    $0x0,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,-0x20(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11b7 <main+0x87>
mov    -0x20(%rbp),%rsi
movslq -0xc(%rbp),%rax
add    %rax,%rsi
lea    0xe7a(%rip),%rdi
mov    $0x0,%al
call   1050 <scanf@plt>
mov    -0x20(%rbp),%rsi
movslq -0xc(%rbp),%rax
add    %rax,%rsi
lea    0xe61(%rip),%rdi
mov    $0x0,%al
call   1050 <scanf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    116b <main+0x3b>
lea    0xe42(%rip),%rdi
lea    -0x14(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
mov    -0x20(%rbp),%rdi
lea    -0x40(%rbp),%rsi
mov    -0x8(%rbp),%ecx
mov    -0x14(%rbp),%r8d
xor    %edx,%edx
call   1030 <print_string@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x28,%rsp
lea    0xebe(%rip),%rdi
lea    0x8(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x8(%rsp),%edi
call   1040 <malloc@plt>
mov    %rax,%r14
cmpl   $0x0,0x8(%rsp)
jle    119c <main+0x6c>
lea    0xe9b(%rip),%r15
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
lea    (%r14,%rbx,1),%r12
mov    %r15,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
add    $0x1,%rbx
movslq 0x8(%rsp),%rax
cmp    %rax,%rbx
jl     1170 <main+0x40>
lea    0xe5d(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x8(%rsp),%ecx
mov    0xc(%rsp),%r8d
lea    0x10(%rsp),%rsi
mov    %r14,%rdi
xor    %edx,%edx
call   1030 <print_string@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

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