#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 getLine(char *, int);
int /*<<< orphan*/ printJustifiedText(char *, int);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  int lengths[3];
  int i;
  char sentences[3][65];
  for (i = 0; i < 3; i++) {
    printf("Enter line #%d: ", i);
    lengths[i] = getLine(sentences[i], 65);
  }
  printf("\n---- The Justified text ----\n\n");
  for (i = 0; i < 3; i++) {
    printJustifiedText(sentences[i], lengths[i]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x3,-0x14(%rbp)
jge    1198 <main+0x68>
mov    -0x14(%rbp),%esi
lea    0xea3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movslq -0x14(%rbp),%rax
lea    -0xe0(%rbp),%rdi
imul   $0x41,%rax,%rax
add    %rax,%rdi
mov    $0x41,%esi
call   1050 <getLine@plt>
mov    %eax,%ecx
movslq -0x14(%rbp),%rax
mov    %ecx,-0x10(%rbp,%rax,4)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1149 <main+0x19>
lea    0xe72(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x3,-0x14(%rbp)
jge    11e4 <main+0xb4>
movslq -0x14(%rbp),%rax
lea    -0xe0(%rbp),%rdi
imul   $0x41,%rax,%rax
add    %rax,%rdi
movslq -0x14(%rbp),%rax
mov    -0x10(%rbp,%rax,4),%esi
call   1040 <printJustifiedText@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11ad <main+0x7d>
xor    %eax,%eax
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xc8,%rsp
lea    0xea8(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x41,%esi
call   1060 <getLine@plt>
mov    %eax,%r12d
mov    %rbx,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x41(%rsp),%r15
mov    %r15,%rdi
mov    $0x41,%esi
call   1060 <getLine@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x82(%rsp),%r13
mov    %r13,%rdi
mov    $0x41,%esi
call   1060 <getLine@plt>
mov    %eax,%ebx
lea    0xe4a(%rip),%rdi
call   1030 <puts@plt>
mov    %r14,%rdi
mov    %r12d,%esi
call   1050 <printJustifiedText@plt>
mov    %r15,%rdi
mov    %ebp,%esi
call   1050 <printJustifiedText@plt>
mov    %r13,%rdi
mov    %ebx,%esi
call   1050 <printJustifiedText@plt>
xor    %eax,%eax
add    $0xc8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [17 x i8] c"Enter line #%d: \00"
@str = [31 x i8] c"\0A---- The Justified text ----\0A\00"
define i32 @main() {
%1 = alloca [3 x [65 x i8]]
%2 = getelementptr inbounds [3 x [65 x i8]], [3 x [65 x i8]]* %1, i64 0, i64 0, i64 0
%3 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 0)
%4 = call i32 @getLine(i8* %2, i32 65)
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 1)
%6 = getelementptr inbounds [3 x [65 x i8]], [3 x [65 x i8]]* %1, i64 0, i64 1, i64 0
%7 = call i32 @getLine(i8* %6, i32 65)
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 2)
%9 = getelementptr inbounds [3 x [65 x i8]], [3 x [65 x i8]]* %1, i64 0, i64 2, i64 0
%10 = call i32 @getLine(i8* %9, i32 65)
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str, i64 0, i64 0))
%12 = call i32 @printJustifiedText(i8* %2, i32 %4)
%13 = call i32 @printJustifiedText(i8* %6, i32 %7)
%14 = call i32 @printJustifiedText(i8* %9, i32 %10)
ret i32 0
}