#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 EOF;
int detab(char *, int);
int getchar();
int /*<<< orphan*/ printf(char *);
int getLine(char line[]) {
  int size, c;
  printf("Please enter a phrase or return to end this\n");
  for (size = 0; size < 100 - 4 && (c = getchar()) != EOF && c != '\n';
       size++) {
    if (c == '\t') {
      size = detab(line, size);
    } else {
      line[size] = c;
    }
  }
  line[size] = '\0';
  return size;
}


x86 assembly (clang, -O0):
<getLine>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xebd(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0xc(%rbp)
xor    %eax,%eax
cmpl   $0x60,-0xc(%rbp)
mov    %al,-0x11(%rbp)
jge    1188 <getLine+0x58>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,%ecx
mov    %ecx,-0x10(%rbp)
xor    %eax,%eax
mov    0x2e75(%rip),%rdx
cmp    (%rdx),%ecx
mov    %al,-0x11(%rbp)
je     1188 <getLine+0x58>
cmpl   $0xa,-0x10(%rbp)
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1198 <getLine+0x68>
jmp    11d9 <getLine+0xa9>
cmpl   $0x9,-0x10(%rbp)
jne    11b6 <getLine+0x86>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <detab@plt>
mov    %eax,-0xc(%rbp)
jmp    11c6 <getLine+0x96>
mov    -0x10(%rbp),%eax
mov    %al,%dl
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
jmp    11cb <getLine+0x9b>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    114f <getLine+0x1f>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0xc(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getLine>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
lea    0xec1(%rip),%rdi
call   1030 <puts@plt>
mov    0x2e9d(%rip),%r15
xor    %ebx,%ebx
jmp    1161 <getLine+0x31>
nop
movslq %ebx,%rcx
mov    %al,(%r14,%rcx,1)
lea    0x1(%rbx),%eax
cmp    $0x5f,%ebx
mov    %eax,%ebx
jge    1187 <getLine+0x57>
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    $0xa,%eax
je     1185 <getLine+0x55>
cmp    (%r15),%eax
je     1185 <getLine+0x55>
cmp    $0x9,%eax
jne    1150 <getLine+0x20>
mov    %r14,%rdi
mov    %ebx,%esi
call   1040 <detab@plt>
mov    %eax,%ebx
jmp    1157 <getLine+0x27>
mov    %ebx,%eax
cltq
movb   $0x0,(%r14,%rax,1)
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [45 x i8] c"Please enter a phrase or return to end this\0A\00"
@EOF = global i32 0
define i32 @getLine(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
store i8* %0, i8** %2
%5 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %6
6: ; preds = %33, %1
%7 = load i32, i32* %3
%8 = icmp slt i32 %7, 96
br i1 %8, label %9, label %16
9: ; preds = %6
%10 = call i32 (...) @getchar()
store i32 %10, i32* %4
%11 = load i32, i32* @EOF
%12 = icmp ne i32 %10, %11
br i1 %12, label %13, label %16
13: ; preds = %9
%14 = load i32, i32* %4
%15 = icmp ne i32 %14, 10
br label %16
16: ; preds = %13, %9, %6
%17 = phi i1 [ false, %9 ], [ false, %6 ], [ %15, %13 ]
br i1 %17, label %18, label %36
18: ; preds = %16
%19 = load i32, i32* %4
%20 = icmp eq i32 %19, 9
br i1 %20, label %21, label %25
21: ; preds = %18
%22 = load i8*, i8** %2
%23 = load i32, i32* %3
%24 = call i32 @detab(i8* %22, i32 %23)
store i32 %24, i32* %3
br label %32
25: ; preds = %18
%26 = load i32, i32* %4
%27 = trunc i32 %26 to i8
%28 = load i8*, i8** %2
%29 = load i32, i32* %3
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i8, i8* %28, i64 %30
store i8 %27, i8* %31
br label %32
32: ; preds = %25, %21
br label %33
33: ; preds = %32
%34 = load i32, i32* %3
%35 = add nsw i32 %34, 1
store i32 %35, i32* %3
br label %6
36: ; preds = %16
%37 = load i8*, i8** %2
%38 = load i32, i32* %3
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds i8, i8* %37, i64 %39
store i8 0, i8* %40
%41 = load i32, i32* %3
ret i32 %41
}

LLVM IR (-O2):
@EOF = global i32 0
@str = [44 x i8] c"Please enter a phrase or return to end this\00"
define i32 @getLine(i8* %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str, i64 0, i64 0))
br label %3
3: ; preds = %1, %18
%4 = phi i32 [ 0, %1 ], [ %20, %18 ]
%5 = tail call i32 (...) @getchar()
%6 = load i32, i32* @EOF
%7 = icmp ne i32 %5, %6
%8 = icmp ne i32 %5, 10
%9 = and i1 %8, %7
br i1 %9, label %10, label %22
10: ; preds = %3
%11 = icmp eq i32 %5, 9
br i1 %11, label %12, label %14
12: ; preds = %10
%13 = tail call i32 @detab(i8* %0, i32 %4)
br label %18
14: ; preds = %10
%15 = trunc i32 %5 to i8
%16 = sext i32 %4 to i64
%17 = getelementptr inbounds i8, i8* %0, i64 %16
store i8 %15, i8* %17
br label %18
18: ; preds = %12, %14
%19 = phi i32 [ %13, %12 ], [ %4, %14 ]
%20 = add nsw i32 %19, 1
%21 = icmp slt i32 %19, 95
br i1 %21, label %3, label %22
22: ; preds = %18, %3
%23 = phi i32 [ %20, %18 ], [ %4, %3 ]
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8, i8* %0, i64 %24
store i8 0, i8* %25
ret i32 %23
}