#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ BUFSIZ;
int /*<<< orphan*/ check_io(int /*<<< orphan*/ *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *, ...);
scalar_t__ get_line(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stdout;
scalar_t__ strcmp(char *, char *);
void output_till_dot(FILE *output, char *oname, char *leader) {
  char buf[BUFSIZ + 1];
  int count;
  int done = 0;
  printf("\nTo end input, enter a line with a single period.\n");
  count = 0;
  while (!done) {
    printf("%s\t", (count > 0) ? "" : leader);
    fflush(stdout);
    if (get_line(buf, BUFSIZ, 79 - 9) <= 0) {
      printf("\nline too long, please re-enter:\n\t");
      continue;
    }
    if (strcmp(buf, ".\n") == 0) {
      done = 1;
    }
    if (!done) {
      fprintf(output, "%s\t%s", (count++ > 0) ? "" : leader, buf);
      check_io(output, oname, 0);
    }
  }
  if (count <= 0) {
    fprintf(output, "%s\t.\n", leader);
    check_io(output, oname, 0);
  }
  return;
}


x86 assembly (clang, -O0):
<output_till_dot>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    0x2e65(%rip),%rax
mov    (%rax),%eax
add    $0x1,%eax
mov    %rsp,%rcx
mov    %rcx,-0x20(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x38(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x30(%rbp)
lea    0xe4f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x2c(%rbp)
cmpl   $0x0,-0x30(%rbp)
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    11d5 <output_till_dot+0x75>
jmp    12d8 <output_till_dot+0x178>
cmpl   $0x0,-0x2c(%rbp)
jle    11ef <output_till_dot+0x8f>
lea    0xe73(%rip),%rax
mov    %rax,-0x40(%rbp)
jmp    11f7 <output_till_dot+0x97>
mov    -0x18(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rsi
lea    0xe31(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2dc8(%rip),%rax
mov    (%rax),%edi
call   1080 <fflush@plt>
mov    -0x38(%rbp),%rdi
mov    0x2dbe(%rip),%rax
mov    (%rax),%esi
mov    $0x46,%edx
call   1030 <get_line@plt>
cmp    $0x0,%rax
jg     124b <output_till_dot+0xeb>
lea    0xdf8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11bf <output_till_dot+0x5f>
mov    -0x38(%rbp),%rdi
lea    0xe0d(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    126c <output_till_dot+0x10c>
movl   $0x1,-0x30(%rbp)
cmpl   $0x0,-0x30(%rbp)
jne    12d3 <output_till_dot+0x173>
mov    -0x8(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x2c(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x2c(%rbp)
cmp    $0x0,%eax
jle    12a2 <output_till_dot+0x142>
lea    0xdc0(%rip),%rax
mov    %rax,-0x50(%rbp)
jmp    12aa <output_till_dot+0x14a>
mov    -0x18(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x38(%rbp),%rcx
mov    -0x48(%rbp),%rdi
mov    -0x50(%rbp),%rdx
lea    0xd9d(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
xor    %edx,%edx
call   1070 <check_io@plt>
jmp    11bf <output_till_dot+0x5f>
cmpl   $0x0,-0x2c(%rbp)
jg     1307 <output_till_dot+0x1a7>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xd6f(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
xor    %edx,%edx
call   1070 <check_io@plt>
mov    -0x20(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<output_till_dot>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rdx,-0x48(%rbp)
mov    %rsi,-0x40(%rbp)
mov    %rdi,-0x38(%rbp)
mov    0x2e4c(%rip),%rax
mov    (%rax),%eax
add    $0x1,%eax
mov    %rsp,%r13
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r13
mov    %r13,%rsp
lea    0xe82(%rip),%rdi
call   1030 <puts@plt>
lea    0xe43(%rip),%r12
mov    0x2e14(%rip),%rbx
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
mov    %eax,-0x2c(%rbp)
test   %eax,%eax
lea    0xe4a(%rip),%r15
cmove  -0x48(%rbp),%r15
mov    %r12,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    (%rbx),%edi
call   1090 <fflush@plt>
mov    0x2de4(%rip),%rax
mov    (%rax),%esi
mov    %r13,%rdi
mov    $0x46,%edx
call   1040 <get_line@plt>
test   %rax,%rax
lea    0xdef(%rip),%r14
jg     1259 <output_till_dot+0xe9>
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    (%rbx),%edi
call   1090 <fflush@plt>
mov    0x2d9b(%rip),%rax
mov    (%rax),%esi
mov    %r13,%rdi
mov    $0x46,%edx
call   1040 <get_line@plt>
test   %rax,%rax
jle    1220 <output_till_dot+0xb0>
mov    %r13,%rdi
lea    0xdcd(%rip),%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     12a9 <output_till_dot+0x139>
addl   $0x1,-0x2c(%rbp)
mov    -0x38(%rbp),%r14
mov    %r14,%rdi
lea    0xda8(%rip),%rsi
mov    %r15,%rdx
mov    %r13,%rcx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    %r14,%rdi
mov    0x2d42(%rip),%rbx
mov    -0x40(%rbp),%rsi
xor    %edx,%edx
call   1080 <check_io@plt>
mov    -0x2c(%rbp),%eax
jmp    11d0 <output_till_dot+0x60>
cmpl   $0x0,-0x2c(%rbp)
jne    12d6 <output_till_dot+0x166>
lea    0xd77(%rip),%rsi
mov    -0x38(%rbp),%rbx
mov    %rbx,%rdi
mov    -0x48(%rbp),%rdx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    %rbx,%rdi
mov    -0x40(%rbp),%rsi
xor    %edx,%edx
call   1080 <check_io@plt>
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@BUFSIZ = global i32 0
@.str = [51 x i8] c"\0ATo end input, enter a line with a single period.\0A\00"
@.str.1 = [4 x i8] c"%s\09\00"
@.str.2 = [1 x i8] zeroinitializer
@stdout = global i32 0
@.str.3 = [35 x i8] c"\0Aline too long, please re-enter:\0A\09\00"
@.str.4 = [3 x i8] c".\0A\00"
@.str.5 = [6 x i8] c"%s\09%s\00"
@.str.6 = [6 x i8] c"%s\09.\0A\00"
define void @output_till_dot(i32* %0, i8* %1, i8* %2) {
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i64
%9 = alloca i32
%10 = alloca i32
store i32* %0, i32** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%11 = load i32, i32* @BUFSIZ
%12 = add nsw i32 %11, 1
%13 = zext i32 %12 to i64
%14 = call i8* @llvm.stacksave()
store i8* %14, i8** %7
%15 = alloca i8, i64 %13
store i64 %13, i64* %8
store i32 0, i32* %10
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %9
br label %17
17: ; preds = %58, %35, %3
%18 = load i32, i32* %10
%19 = icmp ne i32 %18, 0
%20 = xor i1 %19, true
br i1 %20, label %21, label %59
21: ; preds = %17
%22 = load i32, i32* %9
%23 = icmp sgt i32 %22, 0
br i1 %23, label %24, label %25
24: ; preds = %21
br label %27
25: ; preds = %21
%26 = load i8*, i8** %6
br label %27
27: ; preds = %25, %24
%28 = phi i8* [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), %24 ], [ %26, %25 ]
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %28)
%30 = load i32, i32* @stdout
%31 = call i32 @fflush(i32 %30)
%32 = load i32, i32* @BUFSIZ
%33 = call i64 @get_line(i8* %15, i32 %32, i32 70)
%34 = icmp sle i64 %33, 0
br i1 %34, label %35, label %37
35: ; preds = %27
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0))
br label %17
37: ; preds = %27
%38 = call i64 @strcmp(i8* %15, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%39 = icmp eq i64 %38, 0
br i1 %39, label %40, label %41
40: ; preds = %37
store i32 1, i32* %10
br label %41
41: ; preds = %40, %37
%42 = load i32, i32* %10
%43 = icmp ne i32 %42, 0
br i1 %43, label %58, label %44
44: ; preds = %41
%45 = load i32*, i32** %4
%46 = load i32, i32* %9
%47 = add nsw i32 %46, 1
store i32 %47, i32* %9
%48 = icmp sgt i32 %46, 0
br i1 %48, label %49, label %50
49: ; preds = %44
br label %52
50: ; preds = %44
%51 = load i8*, i8** %6
br label %52
52: ; preds = %50, %49
%53 = phi i8* [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), %49 ], [ %51, %50 ]
%54 = call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %45, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i8* %53, i8* %15)
%55 = load i32*, i32** %4
%56 = load i8*, i8** %5
%57 = call i32 @check_io(i32* %55, i8* %56, i32 0)
br label %58
58: ; preds = %52, %41
br label %17
59: ; preds = %17
%60 = load i32, i32* %9
%61 = icmp sle i32 %60, 0
br i1 %61, label %62, label %69
62: ; preds = %59
%63 = load i32*, i32** %4
%64 = load i8*, i8** %6
%65 = call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %63, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i8* %64)
%66 = load i32*, i32** %4
%67 = load i8*, i8** %5
%68 = call i32 @check_io(i32* %66, i8* %67, i32 0)
br label %69
69: ; preds = %62, %59
%70 = load i8*, i8** %7
ret void
}

LLVM IR (-O2):
@BUFSIZ = global i32 0
@.str.1 = [4 x i8] c"%s\09\00"
@.str.2 = [1 x i8] zeroinitializer
@stdout = global i32 0
@.str.3 = [35 x i8] c"\0Aline too long, please re-enter:\0A\09\00"
@.str.4 = [3 x i8] c".\0A\00"
@.str.5 = [6 x i8] c"%s\09%s\00"
@.str.6 = [6 x i8] c"%s\09.\0A\00"
@str = [50 x i8] c"\0ATo end input, enter a line with a single period.\00"
define void @output_till_dot(i32* %0, i8* %1, i8* %2) {
%4 = load i32, i32* @BUFSIZ
%5 = add nsw i32 %4, 1
%6 = zext i32 %5 to i64
%7 = alloca i8, i64 %6
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @str, i64 0, i64 0))
br label %9
9: ; preds = %30, %3
%10 = phi i32 [ 0, %3 ], [ %31, %30 ]
%11 = icmp eq i32 %10, 0
%12 = select i1 %11, i8* %2, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0)
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %12)
%14 = load i32, i32* @stdout
%15 = call i32 @fflush(i32 %14)
%16 = load i32, i32* @BUFSIZ
%17 = call i64 @get_line(i8* %7, i32 %16, i32 70)
%18 = icmp slt i64 %17, 1
br i1 %18, label %19, label %27
19: ; preds = %9, %19
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0))
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %12)
%22 = load i32, i32* @stdout
%23 = call i32 @fflush(i32 %22)
%24 = load i32, i32* @BUFSIZ
%25 = call i64 @get_line(i8* %7, i32 %24, i32 70)
%26 = icmp slt i64 %25, 1
br i1 %26, label %19, label %27
27: ; preds = %19, %9
%28 = call i64 @strcmp(i8* %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%29 = icmp eq i64 %28, 0
br i1 %29, label %34, label %30
30: ; preds = %27
%31 = add nuw nsw i32 %10, 1
%32 = call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i8* %12, i8* %7)
%33 = call i32 @check_io(i32* %0, i8* %1, i32 0)
br label %9
34: ; preds = %27
%35 = icmp eq i32 %10, 0
br i1 %35, label %36, label %39
36: ; preds = %34
%37 = call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i8* %2)
%38 = call i32 @check_io(i32* %0, i8* %1, i32 0)
br label %39
39: ; preds = %36, %34
ret void
}