#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*/ findFactors(int *, int);
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char *);
int strlen(char *);
int main() {
  char *s = (char *)malloc(10240 * sizeof(char));
  scanf("%s", s);
  int len = strlen(s);
  int arr[2];
  findFactors(arr, len);
  int i, j;
  for (i = 0; i < arr[1]; i++) {
    for (j = 0; j < arr[0]; j++) {
      printf("%c", s[arr[1] * j + i]);
    }
    printf(" ");
  }
  printf("\--/*+b");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x2800,%edi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xe88(%rip),%rdi
call   1060 <scanf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x14(%rbp)
lea    -0x1c(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1070 <findFactors@plt>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    1208 <main+0xb8>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    11ec <main+0x9c>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%ecx
imul   -0x24(%rbp),%ecx
add    -0x20(%rbp),%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%esi
lea    0xe2c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11af <main+0x5f>
lea    0xe13(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    119c <main+0x4c>
lea    0xdf9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    $0x2800,%edi
call   1060 <malloc@plt>
mov    %rax,%r14
lea    0xe84(%rip),%rdi
mov    %rax,%rsi
call   1070 <scanf@plt>
mov    %r14,%rdi
call   1040 <strlen@plt>
lea    0x8(%rsp),%rdi
mov    %eax,%esi
call   1080 <findFactors@plt>
cmpl   $0x0,0xc(%rsp)
jle    1210 <main+0xb0>
xor    %ebp,%ebp
jmp    11c3 <main+0x63>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0x1,%ebp
cmp    0xc(%rsp),%ebp
jge    1210 <main+0xb0>
cmpl   $0x0,0x8(%rsp)
jle    11b0 <main+0x50>
mov    %ebp,%eax
movsbl (%r14,%rax,1),%edi
call   1030 <putchar@plt>
cmpl   $0x2,0x8(%rsp)
jl     11b0 <main+0x50>
mov    $0x1,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    0xc(%rsp),%eax
imul   %ebx,%eax
add    %ebp,%eax
cltq
movsbl (%r14,%rax,1),%edi
call   1030 <putchar@plt>
add    $0x1,%ebx
cmp    0x8(%rsp),%ebx
jl     11f0 <main+0x90>
jmp    11b0 <main+0x50>
lea    0xdec(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.3 = [7 x i8] c"--/*+b\00"
define i32 @main() {
%1 = alloca [2 x i32]
%2 = tail call i64 @malloc(i32 10240)
%3 = inttoptr i64 %2 to i8*
%4 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = tail call i32 @strlen(i8* %3)
%6 = bitcast [2 x i32]* %1 to i8*
%7 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i64 0, i64 0
%8 = call i32 @findFactors(i32* %7, i32 %5)
%9 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i64 0, i64 1
%10 = load i32, i32* %9
%11 = icmp sgt i32 %10, 0
br i1 %11, label %12, label %42
12: ; preds = %0, %37
%13 = phi i32 [ %39, %37 ], [ 0, %0 ]
%14 = load i32, i32* %7
%15 = icmp sgt i32 %14, 0
br i1 %15, label %16, label %37
16: ; preds = %12
%17 = zext i32 %13 to i64
%18 = getelementptr inbounds i8, i8* %3, i64 %17
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = call i32 @putchar(i32 %20)
%22 = load i32, i32* %7
%23 = icmp sgt i32 %22, 1
br i1 %23, label %24, label %37
24: ; preds = %16, %24
%25 = phi i32 [ %34, %24 ], [ 1, %16 ]
%26 = load i32, i32* %9
%27 = mul nsw i32 %26, %25
%28 = add nsw i32 %27, %13
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i8, i8* %3, i64 %29
%31 = load i8, i8* %30
%32 = sext i8 %31 to i32
%33 = call i32 @putchar(i32 %32)
%34 = add nuw nsw i32 %25, 1
%35 = load i32, i32* %7
%36 = icmp slt i32 %34, %35
br i1 %36, label %24, label %37
37: ; preds = %24, %16, %12
%38 = call i32 @putchar(i32 32)
%39 = add nuw nsw i32 %13, 1
%40 = load i32, i32* %9
%41 = icmp slt i32 %39, %40
br i1 %41, label %12, label %42
42: ; preds = %37, %0
%43 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}