#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*/ getchar();
int /*<<< orphan*/ gets(char *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ strcat(char *, char *);
int strlen(char *);
int main() {
  char str[1000], str1[1000], str2[1000], str3[1000], str4[1000];
  int i, j, k, l, m, n, T, a, s, t, p, q, o, w;
  scanf("%d", &T);
  getchar();
  while (T--) {
    gets(str);
    i = strlen(str);
    m = i / 2;
    for (j = 0; j < m; j++)
      str1[j] = str[j];
    str1[j] = '\0';
    for (k = m, n = 0; k < i; k++, n++)
      str2[n] = str[k];
    str2[n] = '\0';
    s = strlen(str1);
    t = strlen(str2);
    o = 0;
    for (p = s - 1; p >= 0; p--) {
      str3[o] = str1[p];
      o++;
    }
    str3[o] = '\0';
    w = 0;
    for (q = t - 1; q >= 0; q--) {
      str4[w] = str2[q];
      w++;
    }
    str4[w] = '\0';
    strcat(str3, str4);
    printf("%s\n", str3);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x13f0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe87(%rip),%rdi
lea    -0x13cc(%rbp),%rsi
call   1070 <scanf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    -0x13cc(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x13cc(%rbp)
cmp    $0x0,%eax
je     13e0 <main+0x280>
lea    -0x3f0(%rbp),%rdi
call   1060 <gets@plt>
lea    -0x3f0(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x13b4(%rbp)
mov    -0x13b4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x13c4(%rbp)
movl   $0x0,-0x13b8(%rbp)
mov    -0x13b8(%rbp),%eax
cmp    -0x13c4(%rbp),%eax
jge    1224 <main+0xc4>
movslq -0x13b8(%rbp),%rax
mov    -0x3f0(%rbp,%rax,1),%cl
movslq -0x13b8(%rbp),%rax
mov    %cl,-0x7e0(%rbp,%rax,1)
mov    -0x13b8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x13b8(%rbp)
jmp    11e2 <main+0x82>
movslq -0x13b8(%rbp),%rax
movb   $0x0,-0x7e0(%rbp,%rax,1)
mov    -0x13c4(%rbp),%eax
mov    %eax,-0x13bc(%rbp)
movl   $0x0,-0x13c8(%rbp)
mov    -0x13bc(%rbp),%eax
cmp    -0x13b4(%rbp),%eax
jge    129a <main+0x13a>
movslq -0x13bc(%rbp),%rax
mov    -0x3f0(%rbp,%rax,1),%cl
movslq -0x13c8(%rbp),%rax
mov    %cl,-0xbd0(%rbp,%rax,1)
mov    -0x13bc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x13bc(%rbp)
mov    -0x13c8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x13c8(%rbp)
jmp    1249 <main+0xe9>
movslq -0x13c8(%rbp),%rax
movb   $0x0,-0xbd0(%rbp,%rax,1)
lea    -0x7e0(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x13d4(%rbp)
lea    -0xbd0(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x13d8(%rbp)
movl   $0x0,-0x13e4(%rbp)
mov    -0x13d4(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x13dc(%rbp)
cmpl   $0x0,-0x13dc(%rbp)
jl     1332 <main+0x1d2>
movslq -0x13dc(%rbp),%rax
mov    -0x7e0(%rbp,%rax,1),%cl
movslq -0x13e4(%rbp),%rax
mov    %cl,-0xfc0(%rbp,%rax,1)
mov    -0x13e4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x13e4(%rbp)
mov    -0x13dc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x13dc(%rbp)
jmp    12e6 <main+0x186>
movslq -0x13e4(%rbp),%rax
movb   $0x0,-0xfc0(%rbp,%rax,1)
movl   $0x0,-0x13e8(%rbp)
mov    -0x13d8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x13e0(%rbp)
cmpl   $0x0,-0x13e0(%rbp)
jl     13a6 <main+0x246>
movslq -0x13e0(%rbp),%rax
mov    -0xbd0(%rbp,%rax,1),%cl
movslq -0x13e8(%rbp),%rax
mov    %cl,-0x13b0(%rbp,%rax,1)
mov    -0x13e8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x13e8(%rbp)
mov    -0x13e0(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x13e0(%rbp)
jmp    135a <main+0x1fa>
movslq -0x13e8(%rbp),%rax
movb   $0x0,-0x13b0(%rbp,%rax,1)
lea    -0xfc0(%rbp),%rdi
lea    -0x13b0(%rbp),%rsi
call   1080 <strcat@plt>
lea    -0xfc0(%rbp),%rsi
lea    0xc2d(%rip),%rdi
call   1040 <printf@plt>
jmp    118c <main+0x2c>
mov    -0x4(%rbp),%eax
add    $0x13f0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x13b8,%rsp
lea    0xe78(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1080 <scanf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
subl   $0x1,0xc(%rsp)
jae    11b4 <main+0x44>
xor    %eax,%eax
add    $0x13b8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0xfffffffe,%r15d
lea    0xfd0(%rsp),%r14
lea    0xbe0(%rsp),%rbp
jmp    120f <main+0x9f>
nopl   0x0(%rax)
mov    %eax,%r8d
mov    %r12,%rbp
mov    %r8d,%eax
movb   $0x0,0x400(%rsp,%rax,1)
lea    0x7f0(%rsp),%rbx
mov    %rbx,%rdi
lea    0x400(%rsp),%rsi
call   1090 <strcat@plt>
lea    0xe03(%rip),%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
subl   $0x1,0xc(%rsp)
jb     11a0 <main+0x30>
mov    %rbp,%r12
mov    %r14,%rdi
call   1070 <gets@plt>
mov    %r14,%rdi
call   1030 <strlen@plt>
mov    %eax,%ebx
mov    %eax,%ebp
shr    $0x1f,%ebp
add    %eax,%ebp
sar    %ebp
cmp    $0x2,%eax
jl     1250 <main+0xe0>
lea    -0x1(%rbp),%r13d
add    $0x1,%r13
lea    0x10(%rsp),%rdi
mov    %r14,%rsi
mov    %r13,%rdx
call   1060 <memcpy@plt>
jmp    1253 <main+0xe3>
nopl   0x0(%rax)
xor    %r13d,%r13d
mov    %r13d,%eax
movb   $0x0,0x10(%rsp,%rax,1)
cmp    %ebx,%ebp
jge    1290 <main+0x120>
movslq %ebp,%rax
lea    (%rsp,%rax,1),%rsi
add    $0xfd0,%rsi
not    %ebp
add    %ebp,%ebx
add    $0x1,%rbx
mov    %r12,%rbp
mov    %r12,%rdi
mov    %rbx,%rdx
call   1060 <memcpy@plt>
jmp    1295 <main+0x125>
cs nopw 0x0(%rax,%rax,1)
nop
xor    %ebx,%ebx
mov    %r12,%rbp
mov    %ebx,%eax
movb   $0x0,0xbe0(%rsp,%rax,1)
lea    0x10(%rsp),%rdi
call   1030 <strlen@plt>
mov    %eax,%r13d
mov    %rbp,%rdi
call   1030 <strlen@plt>
xor    %r8d,%r8d
mov    $0x0,%ecx
test   %r13d,%r13d
jle    1371 <main+0x201>
mov    %r13d,%ecx
cmp    $0x8,%r13d
jae    1440 <main+0x2d0>
xor    %esi,%esi
mov    %rcx,%rdi
mov    %rsi,%rbp
not    %rbp
add    %rcx,%rbp
mov    %rcx,%rdx
and    $0x3,%rdx
je     130c <main+0x19c>
nopl   0x0(%rax)
add    $0xffffffffffffffff,%rdi
mov    %edi,%ebx
movzbl 0x10(%rsp,%rbx,1),%ebx
mov    %bl,0x7f0(%rsp,%rsi,1)
add    $0x1,%rsi
add    $0xffffffffffffffff,%rdx
jne    12f0 <main+0x180>
cmp    $0x3,%rbp
jb     136b <main+0x1fb>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    (%rdi,%r15,1),%rdx
lea    0x1(%rdx),%ebp
movzbl 0x10(%rsp,%rbp,1),%ebx
mov    %bl,0x7f0(%rsp,%rsi,1)
mov    %edx,%ebp
movzbl 0x10(%rsp,%rbp,1),%ebx
mov    %bl,0x7f1(%rsp,%rsi,1)
add    $0xffffffff,%edx
movzbl 0x10(%rsp,%rdx,1),%edx
mov    %dl,0x7f2(%rsp,%rsi,1)
add    $0xfffffffffffffffc,%rdi
mov    %edi,%edx
movzbl 0x10(%rsp,%rdx,1),%edx
mov    %dl,0x7f3(%rsp,%rsi,1)
add    $0x4,%rsi
cmp    %rsi,%rcx
jne    1320 <main+0x1b0>
mov    %r13d,%ecx
mov    %r12,%rbp
mov    %ecx,%ecx
movb   $0x0,0x7f0(%rsp,%rcx,1)
test   %eax,%eax
jle    11d6 <main+0x66>
mov    %eax,%r8d
cmp    $0x8,%eax
jae    1480 <main+0x310>
xor    %edx,%edx
mov    %r8,%rsi
mov    %rdx,%rdi
not    %rdi
add    %r8,%rdi
mov    %r8,%rcx
and    $0x3,%rcx
je     13cf <main+0x25f>
cs nopw 0x0(%rax,%rax,1)
add    $0xffffffffffffffff,%rsi
mov    %esi,%ebp
movzbl 0xbe0(%rsp,%rbp,1),%ebx
mov    %bl,0x400(%rsp,%rdx,1)
add    $0x1,%rdx
add    $0xffffffffffffffff,%rcx
jne    13b0 <main+0x240>
cmp    $0x3,%rdi
jb     11d0 <main+0x60>
mov    %r12,%rbp
nopl   0x0(%rax)
lea    (%rsi,%r15,1),%rcx
lea    0x1(%rcx),%edi
movzbl 0xbe0(%rsp,%rdi,1),%ebx
mov    %bl,0x400(%rsp,%rdx,1)
mov    %ecx,%edi
movzbl 0xbe0(%rsp,%rdi,1),%ebx
mov    %bl,0x401(%rsp,%rdx,1)
add    $0xffffffff,%ecx
movzbl 0xbe0(%rsp,%rcx,1),%ecx
mov    %cl,0x402(%rsp,%rdx,1)
add    $0xfffffffffffffffc,%rsi
mov    %esi,%ecx
movzbl 0xbe0(%rsp,%rcx,1),%ecx
mov    %cl,0x403(%rsp,%rdx,1)
add    $0x4,%rdx
cmp    %rdx,%r8
jne    13e0 <main+0x270>
mov    %eax,%r8d
jmp    11d6 <main+0x66>
nop
lea    -0x1(%rcx),%rbp
lea    -0x1(%r13),%edx
cmp    %ebp,%edx
jb     12d2 <main+0x162>
mov    %rbp,%rdx
shr    $0x20,%rdx
mov    $0x0,%esi
mov    %rcx,%rdi
pxor   %xmm3,%xmm3
jne    12d7 <main+0x167>
cmp    $0x20,%r13d
jae    14b8 <main+0x348>
xor    %esi,%esi
jmp    155f <main+0x3ef>
cs nopw 0x0(%rax,%rax,1)
lea    -0x1(%r8),%rdi
lea    -0x1(%rax),%ecx
cmp    %edi,%ecx
jb     138f <main+0x21f>
mov    %rdi,%rcx
shr    $0x20,%rcx
mov    $0x0,%edx
mov    %r8,%rsi
pxor   %xmm3,%xmm3
jne    1394 <main+0x224>
cmp    $0x20,%eax
jae    15c3 <main+0x453>
xor    %edx,%edx
jmp    1672 <main+0x502>
mov    %ecx,%esi
and    $0xffffffe0,%esi
xor    %edi,%edi
nop
mov    %ebp,%edx
movdqu -0xf(%rsp,%rdx,1),%xmm0
movdqu 0x1(%rsp,%rdx,1),%xmm1
movdqa %xmm1,%xmm2
punpcklbw %xmm3,%xmm2
pshufd $0x4e,%xmm2,%xmm2
pshuflw $0x1b,%xmm2,%xmm2
pshufhw $0x1b,%xmm2,%xmm2
punpckhbw %xmm3,%xmm1
pshufd $0x4e,%xmm1,%xmm1
pshuflw $0x1b,%xmm1,%xmm1
pshufhw $0x1b,%xmm1,%xmm1
packuswb %xmm2,%xmm1
movdqa %xmm0,%xmm2
punpcklbw %xmm3,%xmm2
pshufd $0x4e,%xmm2,%xmm2
pshuflw $0x1b,%xmm2,%xmm2
pshufhw $0x1b,%xmm2,%xmm2
punpckhbw %xmm3,%xmm0
pshufd $0x4e,%xmm0,%xmm0
pshuflw $0x1b,%xmm0,%xmm0
pshufhw $0x1b,%xmm0,%xmm0
packuswb %xmm2,%xmm0
movdqa %xmm1,0x7f0(%rsp,%rdi,1)
movdqa %xmm0,0x800(%rsp,%rdi,1)
add    $0x20,%rdi
add    $0xffffffffffffffe0,%rbp
cmp    %rdi,%rsi
jne    14c0 <main+0x350>
cmp    %rcx,%rsi
je     136b <main+0x1fb>
test   $0x18,%cl
je     16d9 <main+0x569>
mov    %rsi,%rbx
mov    %ecx,%esi
and    $0xfffffff8,%esi
mov    %ecx,%edi
and    $0x7,%edi
mov    %rbx,%rbp
not    %rbp
add    %rcx,%rbp
cs nopw 0x0(%rax,%rax,1)
nop
mov    %ebp,%edx
movq   0x9(%rsp,%rdx,1),%xmm0
punpcklbw %xmm3,%xmm0
pshufd $0x4e,%xmm0,%xmm0
pshuflw $0x1b,%xmm0,%xmm0
pshufhw $0x1b,%xmm0,%xmm0
packuswb %xmm0,%xmm0
movq   %xmm0,0x7f0(%rsp,%rbx,1)
add    $0x8,%rbx
add    $0xfffffffffffffff8,%rbp
cmp    %rbx,%rsi
jne    1580 <main+0x410>
cmp    %rcx,%rsi
jne    12d7 <main+0x167>
jmp    136b <main+0x1fb>
mov    %r8d,%edx
and    $0xffffffe0,%edx
xor    %esi,%esi
nopl   0x0(%rax,%rax,1)
mov    %edi,%ecx
movdqu 0xbc1(%rsp,%rcx,1),%xmm0
movdqu 0xbd1(%rsp,%rcx,1),%xmm1
movdqa %xmm1,%xmm2
punpcklbw %xmm3,%xmm2
pshufd $0x4e,%xmm2,%xmm2
pshuflw $0x1b,%xmm2,%xmm2
pshufhw $0x1b,%xmm2,%xmm2
punpckhbw %xmm3,%xmm1
pshufd $0x4e,%xmm1,%xmm1
pshuflw $0x1b,%xmm1,%xmm1
pshufhw $0x1b,%xmm1,%xmm1
packuswb %xmm2,%xmm1
movdqa %xmm0,%xmm2
punpcklbw %xmm3,%xmm2
pshufd $0x4e,%xmm2,%xmm2
pshuflw $0x1b,%xmm2,%xmm2
pshufhw $0x1b,%xmm2,%xmm2
punpckhbw %xmm3,%xmm0
pshufd $0x4e,%xmm0,%xmm0
pshuflw $0x1b,%xmm0,%xmm0
pshufhw $0x1b,%xmm0,%xmm0
packuswb %xmm2,%xmm0
movdqa %xmm1,0x400(%rsp,%rsi,1)
movdqa %xmm0,0x410(%rsp,%rsi,1)
add    $0x20,%rsi
add    $0xffffffffffffffe0,%rdi
cmp    %rsi,%rdx
jne    15d0 <main+0x460>
cmp    %r8,%rdx
je     1437 <main+0x2c7>
test   $0x18,%r8b
je     16e3 <main+0x573>
mov    %rdx,%rbp
mov    %r8d,%edx
and    $0xfffffff8,%edx
mov    %r8d,%esi
and    $0x7,%esi
mov    %rbp,%rdi
not    %rdi
add    %r8,%rdi
nopw   0x0(%rax,%rax,1)
mov    %edi,%ecx
movq   0xbd9(%rsp,%rcx,1),%xmm0
punpcklbw %xmm3,%xmm0
pshufd $0x4e,%xmm0,%xmm0
pshuflw $0x1b,%xmm0,%xmm0
pshufhw $0x1b,%xmm0,%xmm0
packuswb %xmm0,%xmm0
movq   %xmm0,0x400(%rsp,%rbp,1)
add    $0x8,%rbp
add    $0xfffffffffffffff8,%rdi
cmp    %rbp,%rdx
jne    1690 <main+0x520>
cmp    %r8,%rdx
jne    1394 <main+0x224>
mov    %r12,%rbp
jmp    1437 <main+0x2c7>
mov    %ecx,%edi
and    $0x1f,%edi
jmp    12d7 <main+0x167>
mov    %r8d,%esi
and    $0x1f,%esi
jmp    1394 <main+0x224>

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca [1000 x i8]
%2 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 0
%3 = alloca [1000 x i8]
%4 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 0
%5 = alloca [1000 x i8]
%6 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, i64 0, i64 0
%7 = alloca [1000 x i8]
%8 = alloca [1000 x i8]
%9 = alloca i32
%10 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 0
%11 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 0
%12 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, i64 0, i64 0
%13 = getelementptr inbounds [1000 x i8], [1000 x i8]* %7, i64 0, i64 0
%14 = getelementptr inbounds [1000 x i8], [1000 x i8]* %8, i64 0, i64 0
%15 = bitcast i32* %9 to i8*
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %9)
%17 = call i32 (...) @getchar()
%18 = load i32, i32* %9
%19 = add nsw i32 %18, -1
store i32 %19, i32* %9
%20 = icmp eq i32 %18, 0
br i1 %20, label %285, label %21
21: ; preds = %0, %276
%22 = call i32 @gets(i8* %10)
%23 = call i32 @strlen(i8* %10)
%24 = sdiv i32 %23, 2
%25 = icmp sgt i32 %23, 1
br i1 %25, label %26, label %30
26: ; preds = %21
%27 = add nsw i32 %24, -1
%28 = zext i32 %27 to i64
%29 = add nuw nsw i64 %28, 1
br label %30
30: ; preds = %26, %21
%31 = phi i64 [ 0, %21 ], [ %29, %26 ]
%32 = and i64 %31, 4294967295
%33 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 %32
store i8 0, i8* %33
%34 = icmp slt i32 %24, %23
br i1 %34, label %35, label %42
35: ; preds = %30
%36 = sext i32 %24 to i64
%37 = getelementptr [1000 x i8], [1000 x i8]* %1, i64 0, i64 %36
%38 = xor i32 %24, -1
%39 = add i32 %23, %38
%40 = zext i32 %39 to i64
%41 = add nuw nsw i64 %40, 1
br label %42
42: ; preds = %35, %30
%43 = phi i64 [ 0, %30 ], [ %41, %35 ]
%44 = and i64 %43, 4294967295
%45 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, i64 0, i64 %44
store i8 0, i8* %45
%46 = call i32 @strlen(i8* %11)
%47 = call i32 @strlen(i8* %12)
%48 = icmp sgt i32 %46, 0
br i1 %48, label %49, label %160
49: ; preds = %42
%50 = zext i32 %46 to i64
%51 = icmp ult i32 %46, 8
br i1 %51, label %109, label %52
52: ; preds = %49
%53 = add nsw i64 %50, -1
%54 = add i32 %46, -1
%55 = trunc i64 %53 to i32
%56 = icmp ult i32 %54, %55
%57 = icmp ugt i64 %53, 4294967295
%58 = or i1 %56, %57
br i1 %58, label %109, label %59
59: ; preds = %52
%60 = icmp ult i32 %46, 32
br i1 %60, label %89, label %61
61: ; preds = %59
%62 = and i64 %50, 4294967264
br label %63
63: ; preds = %63, %61
%64 = phi i64 [ 0, %61 ], [ %81, %63 ]
%65 = xor i64 %64, -1
%66 = add i64 %65, %50
%67 = and i64 %66, 4294967295
%68 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 %67
%69 = getelementptr inbounds i8, i8* %68, i64 -15
%70 = bitcast i8* %69 to <16 x i8>*
%71 = load <16 x i8>, <16 x i8>* %70
%72 = shufflevector <16 x i8> %71, <16 x i8> poison, <16 x i32> <i32 15, i32 14, i32 13, i32 12, i32 11, i32 10, i32 9, i32 8, i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
%73 = getelementptr inbounds i8, i8* %68, i64 -31
%74 = bitcast i8* %73 to <16 x i8>*
%75 = load <16 x i8>, <16 x i8>* %74
%76 = shufflevector <16 x i8> %75, <16 x i8> poison, <16 x i32> <i32 15, i32 14, i32 13, i32 12, i32 11, i32 10, i32 9, i32 8, i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
%77 = getelementptr inbounds [1000 x i8], [1000 x i8]* %7, i64 0, i64 %64
%78 = bitcast i8* %77 to <16 x i8>*
store <16 x i8> %72, <16 x i8>* %78
%79 = getelementptr inbounds i8, i8* %77, i64 16
%80 = bitcast i8* %79 to <16 x i8>*
store <16 x i8> %76, <16 x i8>* %80
%81 = add nuw i64 %64, 32
%82 = icmp eq i64 %81, %62
br i1 %82, label %83, label %63
83: ; preds = %63
%84 = icmp eq i64 %62, %50
br i1 %84, label %160, label %85
85: ; preds = %83
%86 = and i64 %50, 31
%87 = and i64 %50, 24
%88 = icmp eq i64 %87, 0
br i1 %88, label %109, label %89
89: ; preds = %59, %85
%90 = phi i64 [ %62, %85 ], [ 0, %59 ]
%91 = and i64 %50, 4294967288
%92 = and i64 %50, 7
br label %93
93: ; preds = %93, %89
%94 = phi i64 [ %90, %89 ], [ %105, %93 ]
%95 = xor i64 %94, -1
%96 = add i64 %95, %50
%97 = and i64 %96, 4294967295
%98 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 %97
%99 = getelementptr inbounds i8, i8* %98, i64 -7
%100 = bitcast i8* %99 to <8 x i8>*
%101 = load <8 x i8>, <8 x i8>* %100
%102 = shufflevector <8 x i8> %101, <8 x i8> poison, <8 x i32> <i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
%103 = getelementptr inbounds [1000 x i8], [1000 x i8]* %7, i64 0, i64 %94
%104 = bitcast i8* %103 to <8 x i8>*
store <8 x i8> %102, <8 x i8>* %104
%105 = add nuw i64 %94, 8
%106 = icmp eq i64 %105, %91
br i1 %106, label %107, label %93
107: ; preds = %93
%108 = icmp eq i64 %91, %50
br i1 %108, label %160, label %109
109: ; preds = %52, %49, %85, %107
%110 = phi i64 [ 0, %49 ], [ 0, %52 ], [ %62, %85 ], [ %91, %107 ]
%111 = phi i64 [ %50, %49 ], [ %50, %52 ], [ %86, %85 ], [ %92, %107 ]
%112 = xor i64 %110, -1
%113 = add nsw i64 %112, %50
%114 = and i64 %50, 3
%115 = icmp eq i64 %114, 0
br i1 %115, label %128, label %116
116: ; preds = %109, %116
%117 = phi i64 [ %125, %116 ], [ %110, %109 ]
%118 = phi i64 [ %120, %116 ], [ %111, %109 ]
%119 = phi i64 [ %126, %116 ], [ 0, %109 ]
%120 = add nsw i64 %118, -1
%121 = and i64 %120, 4294967295
%122 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 %121
%123 = load i8, i8* %122
%124 = getelementptr inbounds [1000 x i8], [1000 x i8]* %7, i64 0, i64 %117
store i8 %123, i8* %124
%125 = add nuw nsw i64 %117, 1
%126 = add i64 %119, 1
%127 = icmp eq i64 %126, %114
br i1 %127, label %128, label %116
128: ; preds = %116, %109
%129 = phi i64 [ %110, %109 ], [ %125, %116 ]
%130 = phi i64 [ %111, %109 ], [ %120, %116 ]
%131 = icmp ult i64 %113, 3
br i1 %131, label %160, label %132
132: ; preds = %128, %132
%133 = phi i64 [ %158, %132 ], [ %129, %128 ]
%134 = phi i64 [ %153, %132 ], [ %130, %128 ]
%135 = add i64 %134, 4294967295
%136 = and i64 %135, 4294967295
%137 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 %136
%138 = load i8, i8* %137
%139 = getelementptr inbounds [1000 x i8], [1000 x i8]* %7, i64 0, i64 %133
store i8 %138, i8* %139
%140 = add nuw nsw i64 %133, 1
%141 = add i64 %134, 4294967294
%142 = and i64 %141, 4294967295
%143 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 %142
%144 = load i8, i8* %143
%145 = getelementptr inbounds [1000 x i8], [1000 x i8]* %7, i64 0, i64 %140
store i8 %144, i8* %145
%146 = add nuw nsw i64 %133, 2
%147 = add i64 %134, 4294967293
%148 = and i64 %147, 4294967295
%149 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 %148
%150 = load i8, i8* %149
%151 = getelementptr inbounds [1000 x i8], [1000 x i8]* %7, i64 0, i64 %146
store i8 %150, i8* %151
%152 = add nuw nsw i64 %133, 3
%153 = add nsw i64 %134, -4
%154 = and i64 %153, 4294967295
%155 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 %154
%156 = load i8, i8* %155
%157 = getelementptr inbounds [1000 x i8], [1000 x i8]* %7, i64 0, i64 %152
store i8 %156, i8* %157
%158 = add nuw nsw i64 %133, 4
%159 = icmp eq i64 %158, %50
br i1 %159, label %160, label %132
160: ; preds = %128, %132, %83, %107, %42
%161 = phi i32 [ 0, %42 ], [ %46, %107 ], [ %46, %83 ], [ %46, %132 ], [ %46, %128 ]
%162 = zext i32 %161 to i64
%163 = getelementptr inbounds [1000 x i8], [1000 x i8]* %7, i64 0, i64 %162
store i8 0, i8* %163
%164 = icmp sgt i32 %47, 0
br i1 %164, label %165, label %276
165: ; preds = %160
%166 = zext i32 %47 to i64
%167 = icmp ult i32 %47, 8
br i1 %167, label %225, label %168
168: ; preds = %165
%169 = add nsw i64 %166, -1
%170 = add i32 %47, -1
%171 = trunc i64 %169 to i32
%172 = icmp ult i32 %170, %171
%173 = icmp ugt i64 %169, 4294967295
%174 = or i1 %172, %173
br i1 %174, label %225, label %175
175: ; preds = %168
%176 = icmp ult i32 %47, 32
br i1 %176, label %205, label %177
177: ; preds = %175
%178 = and i64 %166, 4294967264
br label %179
179: ; preds = %179, %177
%180 = phi i64 [ 0, %177 ], [ %197, %179 ]
%181 = xor i64 %180, -1
%182 = add i64 %181, %166
%183 = and i64 %182, 4294967295
%184 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, i64 0, i64 %183
%185 = getelementptr inbounds i8, i8* %184, i64 -15
%186 = bitcast i8* %185 to <16 x i8>*
%187 = load <16 x i8>, <16 x i8>* %186
%188 = shufflevector <16 x i8> %187, <16 x i8> poison, <16 x i32> <i32 15, i32 14, i32 13, i32 12, i32 11, i32 10, i32 9, i32 8, i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
%189 = getelementptr inbounds i8, i8* %184, i64 -31
%190 = bitcast i8* %189 to <16 x i8>*
%191 = load <16 x i8>, <16 x i8>* %190
%192 = shufflevector <16 x i8> %191, <16 x i8> poison, <16 x i32> <i32 15, i32 14, i32 13, i32 12, i32 11, i32 10, i32 9, i32 8, i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
%193 = getelementptr inbounds [1000 x i8], [1000 x i8]* %8, i64 0, i64 %180
%194 = bitcast i8* %193 to <16 x i8>*
store <16 x i8> %188, <16 x i8>* %194
%195 = getelementptr inbounds i8, i8* %193, i64 16
%196 = bitcast i8* %195 to <16 x i8>*
store <16 x i8> %192, <16 x i8>* %196
%197 = add nuw i64 %180, 32
%198 = icmp eq i64 %197, %178
br i1 %198, label %199, label %179
199: ; preds = %179
%200 = icmp eq i64 %178, %166
br i1 %200, label %276, label %201
201: ; preds = %199
%202 = and i64 %166, 31
%203 = and i64 %166, 24
%204 = icmp eq i64 %203, 0
br i1 %204, label %225, label %205
205: ; preds = %175, %201
%206 = phi i64 [ %178, %201 ], [ 0, %175 ]
%207 = and i64 %166, 4294967288
%208 = and i64 %166, 7
br label %209
209: ; preds = %209, %205
%210 = phi i64 [ %206, %205 ], [ %221, %209 ]
%211 = xor i64 %210, -1
%212 = add i64 %211, %166
%213 = and i64 %212, 4294967295
%214 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, i64 0, i64 %213
%215 = getelementptr inbounds i8, i8* %214, i64 -7
%216 = bitcast i8* %215 to <8 x i8>*
%217 = load <8 x i8>, <8 x i8>* %216
%218 = shufflevector <8 x i8> %217, <8 x i8> poison, <8 x i32> <i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
%219 = getelementptr inbounds [1000 x i8], [1000 x i8]* %8, i64 0, i64 %210
%220 = bitcast i8* %219 to <8 x i8>*
store <8 x i8> %218, <8 x i8>* %220
%221 = add nuw i64 %210, 8
%222 = icmp eq i64 %221, %207
br i1 %222, label %223, label %209
223: ; preds = %209
%224 = icmp eq i64 %207, %166
br i1 %224, label %276, label %225
225: ; preds = %168, %165, %201, %223
%226 = phi i64 [ 0, %165 ], [ 0, %168 ], [ %178, %201 ], [ %207, %223 ]
%227 = phi i64 [ %166, %165 ], [ %166, %168 ], [ %202, %201 ], [ %208, %223 ]
%228 = xor i64 %226, -1
%229 = add nsw i64 %228, %166
%230 = and i64 %166, 3
%231 = icmp eq i64 %230, 0
br i1 %231, label %244, label %232
232: ; preds = %225, %232
%233 = phi i64 [ %241, %232 ], [ %226, %225 ]
%234 = phi i64 [ %236, %232 ], [ %227, %225 ]
%235 = phi i64 [ %242, %232 ], [ 0, %225 ]
%236 = add nsw i64 %234, -1
%237 = and i64 %236, 4294967295
%238 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, i64 0, i64 %237
%239 = load i8, i8* %238
%240 = getelementptr inbounds [1000 x i8], [1000 x i8]* %8, i64 0, i64 %233
store i8 %239, i8* %240
%241 = add nuw nsw i64 %233, 1
%242 = add i64 %235, 1
%243 = icmp eq i64 %242, %230
br i1 %243, label %244, label %232
244: ; preds = %232, %225
%245 = phi i64 [ %226, %225 ], [ %241, %232 ]
%246 = phi i64 [ %227, %225 ], [ %236, %232 ]
%247 = icmp ult i64 %229, 3
br i1 %247, label %276, label %248
248: ; preds = %244, %248
%249 = phi i64 [ %274, %248 ], [ %245, %244 ]
%250 = phi i64 [ %269, %248 ], [ %246, %244 ]
%251 = add i64 %250, 4294967295
%252 = and i64 %251, 4294967295
%253 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, i64 0, i64 %252
%254 = load i8, i8* %253
%255 = getelementptr inbounds [1000 x i8], [1000 x i8]* %8, i64 0, i64 %249
store i8 %254, i8* %255
%256 = add nuw nsw i64 %249, 1
%257 = add i64 %250, 4294967294
%258 = and i64 %257, 4294967295
%259 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, i64 0, i64 %258
%260 = load i8, i8* %259
%261 = getelementptr inbounds [1000 x i8], [1000 x i8]* %8, i64 0, i64 %256
store i8 %260, i8* %261
%262 = add nuw nsw i64 %249, 2
%263 = add i64 %250, 4294967293
%264 = and i64 %263, 4294967295
%265 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, i64 0, i64 %264
%266 = load i8, i8* %265
%267 = getelementptr inbounds [1000 x i8], [1000 x i8]* %8, i64 0, i64 %262
store i8 %266, i8* %267
%268 = add nuw nsw i64 %249, 3
%269 = add nsw i64 %250, -4
%270 = and i64 %269, 4294967295
%271 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, i64 0, i64 %270
%272 = load i8, i8* %271
%273 = getelementptr inbounds [1000 x i8], [1000 x i8]* %8, i64 0, i64 %268
store i8 %272, i8* %273
%274 = add nuw nsw i64 %249, 4
%275 = icmp eq i64 %274, %166
br i1 %275, label %276, label %248
276: ; preds = %244, %248, %199, %223, %160
%277 = phi i32 [ 0, %160 ], [ %47, %223 ], [ %47, %199 ], [ %47, %248 ], [ %47, %244 ]
%278 = zext i32 %277 to i64
%279 = getelementptr inbounds [1000 x i8], [1000 x i8]* %8, i64 0, i64 %278
store i8 0, i8* %279
%280 = call i32 @strcat(i8* %13, i8* %14)
%281 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %13)
%282 = load i32, i32* %9
%283 = add nsw i32 %282, -1
store i32 %283, i32* %9
%284 = icmp eq i32 %282, 0
br i1 %284, label %285, label %21
285: ; preds = %276, %0
ret i32 0
}