#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 */
char getchar();
int getline(char strng[]) {
  int i = 0, count = 0, emptyStr = 0;
  char c = 0;
  while (i < (81 - 1) && (strng[i++] = getchar()) != '\n')
    count++;
  strng[i] = '\0';
  if (strng[0] == ' ') {
    emptyStr = 1;
  }
  return (emptyStr);
}


x86 assembly (clang, -O0):
<getline>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movb   $0x0,-0x15(%rbp)
xor    %eax,%eax
cmpl   $0x50,-0xc(%rbp)
mov    %al,-0x16(%rbp)
jge    116c <getline+0x5c>
mov    $0x0,%al
call   1030 <getchar@plt>
mov    -0x8(%rbp),%rcx
mov    -0xc(%rbp),%edx
mov    %edx,%esi
add    $0x1,%esi
mov    %esi,-0xc(%rbp)
movslq %edx,%rdx
mov    %al,(%rcx,%rdx,1)
movsbl %al,%eax
cmp    $0xa,%eax
setne  %al
mov    %al,-0x16(%rbp)
mov    -0x16(%rbp),%al
test   $0x1,%al
jne    117c <getline+0x6c>
jmp    118a <getline+0x7a>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1135 <getline+0x25>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
jne    11ad <getline+0x9d>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getline>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
xor    %ebx,%ebx
nopl   0x0(%rax)
cmp    $0x50,%rbx
je     113b <getline+0x2b>
xor    %eax,%eax
call   1030 <getchar@plt>
mov    %al,(%r14,%rbx,1)
add    $0x1,%rbx
cmp    $0xa,%al
jne    1120 <getline+0x10>
jmp    1140 <getline+0x30>
mov    $0x50,%ebx
movslq %ebx,%rax
movb   $0x0,(%r14,%rax,1)
xor    %eax,%eax
cmpb   $0x20,(%r14)
sete   %al
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @getline(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8
store i8* %0, i8** %2
store i32 0, i32* %3
store i32 0, i32* %4
store i32 0, i32* %5
store i8 0, i8* %6
br label %7
7: ; preds = %21, %1
%8 = load i32, i32* %3
%9 = icmp slt i32 %8, 80
br i1 %9, label %10, label %19
10: ; preds = %7
%11 = call signext i8 (...) @getchar()
%12 = load i8*, i8** %2
%13 = load i32, i32* %3
%14 = add nsw i32 %13, 1
store i32 %14, i32* %3
%15 = sext i32 %13 to i64
%16 = getelementptr inbounds i8, i8* %12, i64 %15
store i8 %11, i8* %16
%17 = sext i8 %11 to i32
%18 = icmp ne i32 %17, 10
br label %19
19: ; preds = %10, %7
%20 = phi i1 [ false, %7 ], [ %18, %10 ]
br i1 %20, label %21, label %24
21: ; preds = %19
%22 = load i32, i32* %4
%23 = add nsw i32 %22, 1
store i32 %23, i32* %4
br label %7
24: ; preds = %19
%25 = load i8*, i8** %2
%26 = load i32, i32* %3
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i8, i8* %25, i64 %27
store i8 0, i8* %28
%29 = load i8*, i8** %2
%30 = getelementptr inbounds i8, i8* %29, i64 0
%31 = load i8, i8* %30
%32 = sext i8 %31 to i32
%33 = icmp eq i32 %32, 32
br i1 %33, label %34, label %35
34: ; preds = %24
store i32 1, i32* %5
br label %35
35: ; preds = %34, %24
%36 = load i32, i32* %5
ret i32 %36
}

LLVM IR (-O2):
define i32 @getline(i8* nocapture %0) {
br label %2
2: ; preds = %5, %1
%3 = phi i64 [ %7, %5 ], [ 0, %1 ]
%4 = icmp eq i64 %3, 80
br i1 %4, label %10, label %5
5: ; preds = %2
%6 = tail call signext i8 (...) @getchar()
%7 = add nuw nsw i64 %3, 1
%8 = getelementptr inbounds i8, i8* %0, i64 %3
store i8 %6, i8* %8
%9 = icmp eq i8 %6, 10
br i1 %9, label %10, label %2
10: ; preds = %2, %5
%11 = phi i64 [ %7, %5 ], [ 80, %2 ]
%12 = shl i64 %11, 32
%13 = ashr exact i64 %12, 32
%14 = getelementptr inbounds i8, i8* %0, i64 %13
store i8 0, i8* %14
%15 = load i8, i8* %0
%16 = icmp eq i8 %15, 32
%17 = zext i1 %16 to i32
ret i32 %17
}