#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 EXIT_SUCCESS;
int /*<<< orphan*/ check_intInput(int *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ fill_D_array(int, int, char **, char *, int);
int /*<<< orphan*/ print_matrix(int, int, char **);
int /*<<< orphan*/ printf(char *);
int remove_new_line(char *);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ text_gravity(int, int, char **);
int main() {
  int row, col;
  printf("Enter col length: ");
  check_intInput(&col);
  char text[1000];
  fgets(text, 1000, stdin);
  int textLength = remove_new_line(text);
  double maxRow = textLength / (double)col;
  row = (int)maxRow + 1;
  char matrixText[row][col];
  fill_D_array(row, col, matrixText, text, textLength);
  print_matrix(row, col, matrixText);
  text_gravity(row, col, matrixText);
  printf("\n");
  print_matrix(row, col, matrixText);
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x440,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe77(%rip),%rdi
call   1040 <printf@plt>
lea    -0xc(%rbp),%rdi
call   1030 <check_intInput@plt>
mov    0x2e4a(%rip),%rax
mov    (%rax),%edx
lea    -0x400(%rbp),%rdi
mov    %rdi,-0x438(%rbp)
mov    $0x3e8,%esi
call   1050 <fgets@plt>
mov    -0x438(%rbp),%rdi
call   1090 <remove_new_line@plt>
mov    %eax,-0x404(%rbp)
cvtsi2sdl -0x404(%rbp),%xmm0
ff
cvtsi2sdl -0xc(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x410(%rbp)
ff
cvttsd2si -0x410(%rbp),%eax
ff
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
mov    %rsp,%rdx
mov    %rdx,-0x418(%rbp)
mov    %rcx,%rsi
imul   %rax,%rsi
add    $0xf,%rsi
and    $0xfffffffffffffff0,%rsi
mov    %rsp,%rdx
sub    %rsi,%rdx
mov    %rdx,-0x430(%rbp)
mov    %rdx,%rsp
mov    %rcx,-0x420(%rbp)
mov    %rax,-0x428(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
lea    -0x400(%rbp),%rcx
mov    -0x404(%rbp),%r8d
call   1070 <fill_D_array@plt>
mov    -0x430(%rbp),%rdx
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1080 <print_matrix@plt>
mov    -0x430(%rbp),%rdx
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1060 <text_gravity@plt>
lea    0xd9f(%rip),%rdi
call   1040 <printf@plt>
mov    -0x430(%rbp),%rdx
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1080 <print_matrix@plt>
mov    0x2d46(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x418(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x3f0,%rsp
lea    0xe67(%rip),%rdi
call   1050 <printf@plt>
lea    -0x24(%rbp),%rdi
call   1040 <check_intInput@plt>
mov    0x2e3a(%rip),%rax
mov    (%rax),%edx
lea    -0x410(%rbp),%r14
mov    %r14,%rdi
mov    $0x3e8,%esi
call   1060 <fgets@plt>
mov    %r14,%rdi
call   10a0 <remove_new_line@plt>
cvtsi2sd %eax,%xmm0
mov    -0x24(%rbp),%ecx
cvtsi2sd %ecx,%xmm1
mov    %rsp,%r12
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%r15d
add    $0x1,%r15d
imul   %r15,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rbx
sub    %rcx,%rbx
mov    %rbx,%rsp
mov    -0x24(%rbp),%esi
mov    %r15d,%edi
mov    %rbx,%rdx
mov    %r14,%rcx
mov    %eax,%r8d
call   1080 <fill_D_array@plt>
mov    -0x24(%rbp),%esi
mov    %r15d,%edi
mov    %rbx,%rdx
call   1090 <print_matrix@plt>
mov    -0x24(%rbp),%esi
mov    %r15d,%edi
mov    %rbx,%rdx
call   1070 <text_gravity@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0x24(%rbp),%esi
mov    %r15d,%edi
mov    %rbx,%rdx
call   1090 <print_matrix@plt>
mov    0x2d8d(%rip),%rax
mov    (%rax),%eax
mov    %r12,%rsp
lea    -0x20(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [19 x i8] c"Enter col length: \00"
@stdin = global i32 0
@.str.1 = [2 x i8] c"\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [1000 x i8]
%5 = alloca i32
%6 = alloca double
%7 = alloca i8*
%8 = alloca i64
%9 = alloca i64
store i32 0, i32* %1
%10 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @check_intInput(i32* %3)
%12 = getelementptr inbounds [1000 x i8], [1000 x i8]* %4, i64 0, i64 0
%13 = load i32, i32* @stdin
%14 = call i32 @fgets(i8* %12, i32 1000, i32 %13)
%15 = getelementptr inbounds [1000 x i8], [1000 x i8]* %4, i64 0, i64 0
%16 = call i32 @remove_new_line(i8* %15)
store i32 %16, i32* %5
%17 = load i32, i32* %5
%18 = sitofp i32 %17 to double
%19 = load i32, i32* %3
%20 = sitofp i32 %19 to double
%21 = fdiv double %18, %20
store double %21, double* %6
%22 = load double, double* %6
%23 = fptosi double %22 to i32
%24 = add nsw i32 %23, 1
store i32 %24, i32* %2
%25 = load i32, i32* %2
%26 = zext i32 %25 to i64
%27 = load i32, i32* %3
%28 = zext i32 %27 to i64
%29 = call i8* @llvm.stacksave()
store i8* %29, i8** %7
%30 = mul nuw i64 %26, %28
%31 = alloca i8, i64 %30
store i64 %26, i64* %8
store i64 %28, i64* %9
%32 = load i32, i32* %2
%33 = load i32, i32* %3
%34 = bitcast i8* %31 to i8**
%35 = getelementptr inbounds [1000 x i8], [1000 x i8]* %4, i64 0, i64 0
%36 = load i32, i32* %5
%37 = call i32 @fill_D_array(i32 %32, i32 %33, i8** %34, i8* %35, i32 %36)
%38 = load i32, i32* %2
%39 = load i32, i32* %3
%40 = bitcast i8* %31 to i8**
%41 = call i32 @print_matrix(i32 %38, i32 %39, i8** %40)
%42 = load i32, i32* %2
%43 = load i32, i32* %3
%44 = bitcast i8* %31 to i8**
%45 = call i32 @text_gravity(i32 %42, i32 %43, i8** %44)
%46 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%47 = load i32, i32* %2
%48 = load i32, i32* %3
%49 = bitcast i8* %31 to i8**
%50 = call i32 @print_matrix(i32 %47, i32 %48, i8** %49)
%51 = load i32, i32* @EXIT_SUCCESS
store i32 %51, i32* %1
%52 = load i8*, i8** %7
%53 = load i32, i32* %1
ret i32 %53
}

LLVM IR (-O2):
@.str = [19 x i8] c"Enter col length: \00"
@stdin = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca [1000 x i8]
%3 = bitcast i32* %1 to i8*
%4 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @check_intInput(i32* %1)
%6 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 0
%7 = load i32, i32* @stdin
%8 = call i32 @fgets(i8* %6, i32 1000, i32 %7)
%9 = call i32 @remove_new_line(i8* %6)
%10 = sitofp i32 %9 to double
%11 = load i32, i32* %1
%12 = sitofp i32 %11 to double
%13 = fdiv double %10, %12
%14 = fptosi double %13 to i32
%15 = add nsw i32 %14, 1
%16 = zext i32 %15 to i64
%17 = zext i32 %11 to i64
%18 = call i8* @llvm.stacksave()
%19 = mul nuw i64 %16, %17
%20 = alloca i8, i64 %19
%21 = load i32, i32* %1
%22 = bitcast i8* %20 to i8**
%23 = call i32 @fill_D_array(i32 %15, i32 %21, i8** %22, i8* %6, i32 %9)
%24 = load i32, i32* %1
%25 = call i32 @print_matrix(i32 %15, i32 %24, i8** %22)
%26 = load i32, i32* %1
%27 = call i32 @text_gravity(i32 %15, i32 %26, i8** %22)
%28 = call i32 @putchar(i32 10)
%29 = load i32, i32* %1
%30 = call i32 @print_matrix(i32 %15, i32 %29, i8** %22)
%31 = load i32, i32* @EXIT_SUCCESS
ret i32 %31
}