#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*/ inicializar(char *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ scanf(char *, ...);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
int main(void) {
  char mJogo[300][101];
  char vCarta[101];
  int numCarta = 0;
  register int i = 0, cont = 0, pos = 0;
  for (i = 0; i < 300; i++)
    for (cont = 0; cont < 101; cont++) {
      mJogo[i][cont] = '\0';
      vCarta[cont] = '\0';
    }
  scanf("%d", &numCarta);
  if (numCarta >= 2 && numCarta <= 300) {
    pos = 0;
    cont = 0;
    for (i = 0; i <= numCarta; i++) {
      inicializar(vCarta);
      scanf("%s", vCarta);
      if (i == 0)
        pos = pos + strlen(vCarta) - 1;
      else
        pos = pos + strlen(vCarta);
      while (cont <= pos) {
        if (mJogo[cont][0] != '\0') {
          pos++;
        }
        if (cont == pos) {
          strcpy(mJogo[pos], vCarta);
        }
        cont++;
        if (cont == numCarta) {
          pos = pos - cont;
          cont = 0;
        }
      }
    }
    for (i = 0; i < numCarta; i++)
      printf("%s\n", mJogo[i]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x76f0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x76d4(%rbp)
movl   $0x0,-0x76d8(%rbp)
movl   $0x0,-0x76dc(%rbp)
movl   $0x0,-0x76e0(%rbp)
movl   $0x0,-0x76d8(%rbp)
cmpl   $0x12c,-0x76d8(%rbp)
jge    1217 <main+0xc7>
movl   $0x0,-0x76dc(%rbp)
cmpl   $0x65,-0x76dc(%rbp)
jge    11fe <main+0xae>
movslq -0x76d8(%rbp),%rcx
lea    -0x7660(%rbp),%rax
imul   $0x65,%rcx,%rcx
add    %rcx,%rax
movslq -0x76dc(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
movslq -0x76dc(%rbp),%rax
movb   $0x0,-0x76d0(%rbp,%rax,1)
mov    -0x76dc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x76dc(%rbp)
jmp    11ae <main+0x5e>
jmp    1203 <main+0xb3>
mov    -0x76d8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x76d8(%rbp)
jmp    1194 <main+0x44>
lea    0xde2(%rip),%rdi
lea    -0x76d4(%rbp),%rsi
mov    $0x0,%al
call   1070 <scanf@plt>
cmpl   $0x2,-0x76d4(%rbp)
jl     142a <main+0x2da>
cmpl   $0x12c,-0x76d4(%rbp)
jg     142a <main+0x2da>
movl   $0x0,-0x76e0(%rbp)
movl   $0x0,-0x76dc(%rbp)
movl   $0x0,-0x76d8(%rbp)
mov    -0x76d8(%rbp),%eax
cmp    -0x76d4(%rbp),%eax
jg     13d4 <main+0x284>
lea    -0x76d0(%rbp),%rdi
call   1060 <inicializar@plt>
lea    -0x76d0(%rbp),%rsi
lea    0xd70(%rip),%rdi
mov    $0x0,%al
call   1070 <scanf@plt>
cmpl   $0x0,-0x76d8(%rbp)
jne    12d7 <main+0x187>
mov    -0x76e0(%rbp),%eax
mov    %eax,-0x76e4(%rbp)
lea    -0x76d0(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x76e4(%rbp),%eax
add    %ecx,%eax
sub    $0x1,%eax
mov    %eax,-0x76e0(%rbp)
jmp    12ff <main+0x1af>
mov    -0x76e0(%rbp),%eax
mov    %eax,-0x76e8(%rbp)
lea    -0x76d0(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x76e8(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x76e0(%rbp)
jmp    1304 <main+0x1b4>
mov    -0x76dc(%rbp),%eax
cmp    -0x76e0(%rbp),%eax
jg     13bb <main+0x26b>
movslq -0x76dc(%rbp),%rcx
lea    -0x7660(%rbp),%rax
imul   $0x65,%rcx,%rcx
add    %rcx,%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1346 <main+0x1f6>
mov    -0x76e0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x76e0(%rbp)
mov    -0x76dc(%rbp),%eax
cmp    -0x76e0(%rbp),%eax
jne    1379 <main+0x229>
movslq -0x76e0(%rbp),%rax
lea    -0x7660(%rbp),%rdi
imul   $0x65,%rax,%rax
add    %rax,%rdi
lea    -0x76d0(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x76dc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x76dc(%rbp)
mov    -0x76dc(%rbp),%eax
cmp    -0x76d4(%rbp),%eax
jne    13b6 <main+0x266>
mov    -0x76e0(%rbp),%eax
sub    -0x76dc(%rbp),%eax
mov    %eax,-0x76e0(%rbp)
movl   $0x0,-0x76dc(%rbp)
jmp    1304 <main+0x1b4>
jmp    13c0 <main+0x270>
mov    -0x76d8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x76d8(%rbp)
jmp    1267 <main+0x117>
movl   $0x0,-0x76d8(%rbp)
mov    -0x76d8(%rbp),%eax
cmp    -0x76d4(%rbp),%eax
jge    1425 <main+0x2d5>
movslq -0x76d8(%rbp),%rax
lea    -0x7660(%rbp),%rsi
imul   $0x65,%rax,%rax
add    %rax,%rsi
lea    0xbfa(%rip),%rdi
call   1050 <printf@plt>
mov    -0x76d8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x76d8(%rbp)
jmp    13de <main+0x28e>
jmp    142a <main+0x2da>
xor    %eax,%eax
add    $0x76f0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x76e8,%rsp
movl   $0x0,0xc(%rsp)
lea    0x80(%rsp),%rdi
mov    $0x765c,%edx
xor    %esi,%esi
call   1060 <memset@plt>
mov    $0x12c,%eax
xorps  %xmm0,%xmm0
cs nopw 0x0(%rax,%rax,1)
nop
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,0x50(%rsp)
movq   $0x0,0x6d(%rsp)
movaps %xmm0,0x60(%rsp)
movq   $0x0,0x6d(%rsp)
movaps %xmm0,0x60(%rsp)
movq   $0x0,0x6d(%rsp)
movaps %xmm0,0x60(%rsp)
movq   $0x0,0x6d(%rsp)
movaps %xmm0,0x60(%rsp)
movq   $0x0,0x6d(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movq   $0x0,0x6d(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movq   $0x0,0x6d(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movq   $0x0,0x6d(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movq   $0x0,0x6d(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movq   $0x0,0x6d(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movq   $0x0,0x6d(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movq   $0x0,0x6d(%rsp)
add    $0xfffffffffffffff4,%rax
jne    11a0 <main+0x40>
lea    0xce9(%rip),%rdi
xor    %ebp,%ebp
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1080 <scanf@plt>
mov    0xc(%rsp),%eax
add    $0xfffffffe,%eax
cmp    $0x12a,%eax
ja     142d <main+0x2cd>
lea    0x10(%rsp),%r12
xor    %ebx,%ebx
xor    %r14d,%r14d
xor    %r13d,%r13d
jmp    1364 <main+0x204>
cs nopw 0x0(%rax,%rax,1)
mov    0xc(%rsp),%eax
lea    0x1(%r13),%ecx
cmp    %eax,%r13d
mov    %ecx,%r13d
jge    13ec <main+0x28c>
mov    %r12,%rdi
call   1070 <inicializar@plt>
lea    0xc90(%rip),%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1080 <scanf@plt>
mov    %r12,%rdi
call   1040 <strlen@plt>
cmp    $0x1,%r13d
sbb    $0x0,%ebx
add    %eax,%ebx
cmp    %ebx,%r14d
jg     1350 <main+0x1f0>
mov    %r14d,%r15d
jmp    13c1 <main+0x261>
nopl   0x0(%rax,%rax,1)
add    $0x1,%r15d
mov    0xc(%rsp),%eax
cmp    %eax,%r15d
mov    %r15d,%r14d
cmove  %ebp,%r14d
cmovne %ebp,%r15d
sub    %r15d,%ebx
mov    %r14d,%r15d
cmp    %ebx,%r14d
jg     1354 <main+0x1f4>
movslq %r15d,%rcx
imul   $0x65,%rcx,%rax
cmpb   $0x1,0x80(%rsp,%rax,1)
01
sbb    $0xffffffff,%ebx
cmp    %ebx,%ecx
jne    13a0 <main+0x240>
lea    (%rsp,%rax,1),%rdi
add    $0x80,%rdi
mov    %r12,%rsi
call   1030 <strcpy@plt>
jmp    13a0 <main+0x240>
test   %eax,%eax
lea    0x80(%rsp),%rbx
jle    142d <main+0x2cd>
xor    %ebp,%ebp
lea    0xc05(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <printf@plt>
add    $0x1,%rbp
movslq 0xc(%rsp),%rax
add    $0x65,%rbx
cmp    %rax,%rbp
jl     1410 <main+0x2b0>
xor    %eax,%eax
add    $0x76e8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [300 x [101 x i8]]
%3 = alloca [101 x i8]
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %4
store i32 0, i32* %5
store i32 0, i32* %6
store i32 0, i32* %7
store i32 0, i32* %5
br label %8
8: ; preds = %29, %0
%9 = load i32, i32* %5
%10 = icmp slt i32 %9, 300
br i1 %10, label %11, label %32
11: ; preds = %8
store i32 0, i32* %6
br label %12
12: ; preds = %25, %11
%13 = load i32, i32* %6
%14 = icmp slt i32 %13, 101
br i1 %14, label %15, label %28
15: ; preds = %12
%16 = load i32, i32* %5
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [300 x [101 x i8]], [300 x [101 x i8]]* %2, i64 0, i64 %17
%19 = load i32, i32* %6
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [101 x i8], [101 x i8]* %18, i64 0, i64 %20
store i8 0, i8* %21
%22 = load i32, i32* %6
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [101 x i8], [101 x i8]* %3, i64 0, i64 %23
store i8 0, i8* %24
br label %25
25: ; preds = %15
%26 = load i32, i32* %6
%27 = add nsw i32 %26, 1
store i32 %27, i32* %6
br label %12
28: ; preds = %12
br label %29
29: ; preds = %28
%30 = load i32, i32* %5
%31 = add nsw i32 %30, 1
store i32 %31, i32* %5
br label %8
32: ; preds = %8
%33 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
%34 = load i32, i32* %4
%35 = icmp sge i32 %34, 2
br i1 %35, label %36, label %119
36: ; preds = %32
%37 = load i32, i32* %4
%38 = icmp sle i32 %37, 300
br i1 %38, label %39, label %119
39: ; preds = %36
store i32 0, i32* %7
store i32 0, i32* %6
store i32 0, i32* %5
br label %40
40: ; preds = %101, %39
%41 = load i32, i32* %5
%42 = load i32, i32* %4
%43 = icmp sle i32 %41, %42
br i1 %43, label %44, label %104
44: ; preds = %40
%45 = getelementptr inbounds [101 x i8], [101 x i8]* %3, i64 0, i64 0
%46 = call i32 @inicializar(i8* %45)
%47 = getelementptr inbounds [101 x i8], [101 x i8]* %3, i64 0, i64 0
%48 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %47)
%49 = load i32, i32* %5
%50 = icmp eq i32 %49, 0
br i1 %50, label %51, label %57
51: ; preds = %44
%52 = load i32, i32* %7
%53 = getelementptr inbounds [101 x i8], [101 x i8]* %3, i64 0, i64 0
%54 = call i32 @strlen(i8* %53)
%55 = add nsw i32 %52, %54
%56 = sub nsw i32 %55, 1
store i32 %56, i32* %7
br label %62
57: ; preds = %44
%58 = load i32, i32* %7
%59 = getelementptr inbounds [101 x i8], [101 x i8]* %3, i64 0, i64 0
%60 = call i32 @strlen(i8* %59)
%61 = add nsw i32 %58, %60
store i32 %61, i32* %7
br label %62
62: ; preds = %57, %51
br label %63
63: ; preds = %99, %62
%64 = load i32, i32* %6
%65 = load i32, i32* %7
%66 = icmp sle i32 %64, %65
br i1 %66, label %67, label %100
67: ; preds = %63
%68 = load i32, i32* %6
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds [300 x [101 x i8]], [300 x [101 x i8]]* %2, i64 0, i64 %69
%71 = getelementptr inbounds [101 x i8], [101 x i8]* %70, i64 0, i64 0
%72 = load i8, i8* %71
%73 = sext i8 %72 to i32
%74 = icmp ne i32 %73, 0
br i1 %74, label %75, label %78
75: ; preds = %67
%76 = load i32, i32* %7
%77 = add nsw i32 %76, 1
store i32 %77, i32* %7
br label %78
78: ; preds = %75, %67
%79 = load i32, i32* %6
%80 = load i32, i32* %7
%81 = icmp eq i32 %79, %80
br i1 %81, label %82, label %89
82: ; preds = %78
%83 = load i32, i32* %7
%84 = sext i32 %83 to i64
%85 = getelementptr inbounds [300 x [101 x i8]], [300 x [101 x i8]]* %2, i64 0, i64 %84
%86 = getelementptr inbounds [101 x i8], [101 x i8]* %85, i64 0, i64 0
%87 = getelementptr inbounds [101 x i8], [101 x i8]* %3, i64 0, i64 0
%88 = call i32 @strcpy(i8* %86, i8* %87)
br label %89
89: ; preds = %82, %78
%90 = load i32, i32* %6
%91 = add nsw i32 %90, 1
store i32 %91, i32* %6
%92 = load i32, i32* %6
%93 = load i32, i32* %4
%94 = icmp eq i32 %92, %93
br i1 %94, label %95, label %99
95: ; preds = %89
%96 = load i32, i32* %7
%97 = load i32, i32* %6
%98 = sub nsw i32 %96, %97
store i32 %98, i32* %7
store i32 0, i32* %6
br label %99
99: ; preds = %95, %89
br label %63
100: ; preds = %63
br label %101
101: ; preds = %100
%102 = load i32, i32* %5
%103 = add nsw i32 %102, 1
store i32 %103, i32* %5
br label %40
104: ; preds = %40
store i32 0, i32* %5
br label %105
105: ; preds = %115, %104
%106 = load i32, i32* %5
%107 = load i32, i32* %4
%108 = icmp slt i32 %106, %107
br i1 %108, label %109, label %118
109: ; preds = %105
%110 = load i32, i32* %5
%111 = sext i32 %110 to i64
%112 = getelementptr inbounds [300 x [101 x i8]], [300 x [101 x i8]]* %2, i64 0, i64 %111
%113 = getelementptr inbounds [101 x i8], [101 x i8]* %112, i64 0, i64 0
%114 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %113)
br label %115
115: ; preds = %109
%116 = load i32, i32* %5
%117 = add nsw i32 %116, 1
store i32 %117, i32* %5
br label %105
118: ; preds = %105
br label %119
119: ; preds = %118, %36, %32
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca [300 x [101 x i8]]
%2 = getelementptr inbounds [300 x [101 x i8]], [300 x [101 x i8]]* %1, i64 0, i64 0, i64 0
%3 = alloca [101 x i8]
%4 = getelementptr inbounds [101 x i8], [101 x i8]* %3, i64 0, i64 0
%5 = alloca i32
%6 = getelementptr inbounds [300 x [101 x i8]], [300 x [101 x i8]]* %1, i64 0, i64 0, i64 0
%7 = getelementptr inbounds [101 x i8], [101 x i8]* %3, i64 0, i64 0
%8 = bitcast i32* %5 to i8*
store i32 0, i32* %5
br label %9
9: ; preds = %9, %0
%10 = phi i64 [ 0, %0 ], [ %11, %9 ]
%11 = add nuw nsw i64 %10, 12
%12 = icmp eq i64 %11, 300
br i1 %12, label %13, label %9
13: ; preds = %9
%14 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %5)
%15 = load i32, i32* %5
%16 = add i32 %15, -2
%17 = icmp ult i32 %16, 299
br i1 %17, label %20, label %68
18: ; preds = %54
%19 = icmp sgt i32 %55, 0
br i1 %19, label %60, label %68
20: ; preds = %13, %54
%21 = phi i32 [ %57, %54 ], [ 0, %13 ]
%22 = phi i32 [ %56, %54 ], [ 0, %13 ]
%23 = phi i32 [ %58, %54 ], [ 0, %13 ]
%24 = call i32 @inicializar(i8* %7)
%25 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %7)
%26 = icmp eq i32 %23, 0
%27 = call i32 @strlen(i8* %7)
%28 = sext i1 %26 to i32
%29 = add i32 %21, %28
%30 = add i32 %27, %29
%31 = icmp sgt i32 %22, %30
br i1 %31, label %32, label %34
32: ; preds = %20
%33 = load i32, i32* %5
br label %54
34: ; preds = %20, %46
%35 = phi i32 [ %52, %46 ], [ %30, %20 ]
%36 = phi i32 [ %50, %46 ], [ %22, %20 ]
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds [300 x [101 x i8]], [300 x [101 x i8]]* %1, i64 0, i64 %37, i64 0
%39 = load i8, i8* %38
%40 = icmp ne i8 %39, 0
%41 = zext i1 %40 to i32
%42 = add nsw i32 %35, %41
%43 = icmp eq i32 %36, %42
br i1 %43, label %44, label %46
44: ; preds = %34
%45 = call i32 @strcpy(i8* %38, i8* %7)
br label %46
46: ; preds = %44, %34
%47 = add nsw i32 %36, 1
%48 = load i32, i32* %5
%49 = icmp eq i32 %47, %48
%50 = select i1 %49, i32 0, i32 %47
%51 = select i1 %49, i32 %47, i32 0
%52 = sub nsw i32 %42, %51
%53 = icmp sgt i32 %50, %52
br i1 %53, label %54, label %34
54: ; preds = %46, %32
%55 = phi i32 [ %33, %32 ], [ %48, %46 ]
%56 = phi i32 [ %22, %32 ], [ %50, %46 ]
%57 = phi i32 [ %30, %32 ], [ %52, %46 ]
%58 = add nuw nsw i32 %23, 1
%59 = icmp slt i32 %23, %55
br i1 %59, label %20, label %18
60: ; preds = %18, %60
%61 = phi i64 [ %64, %60 ], [ 0, %18 ]
%62 = getelementptr inbounds [300 x [101 x i8]], [300 x [101 x i8]]* %1, i64 0, i64 %61, i64 0
%63 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %62)
%64 = add nuw nsw i64 %61, 1
%65 = load i32, i32* %5
%66 = sext i32 %65 to i64
%67 = icmp slt i64 %64, %66
br i1 %67, label %60, label %68
68: ; preds = %60, %18, %13
ret i32 0
}