#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*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
char *read_line(int /*<<< orphan*/ *, char *, size_t);
int /*<<< orphan*/ stderr;
scalar_t__ strlen(char *);
char *read_non_empty_line(FILE *file, char *buff, size_t buff_size) {
  char *ret;
  ret = read_line(file, buff, buff_size);
  if (ret == NULL) {
    fprintf(stderr, "unexpected EOF\n");
    exit(1);
  }
  if (strlen(ret) == 0) {
    fprintf(stderr, "Unexpected empty line\n");
    exit(1);
  }
  return ret;
}


x86 assembly (clang, -O0):
<read_non_empty_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1050 <read_line@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1193 <read_non_empty_line+0x53>
mov    0x2e65(%rip),%rax
mov    (%rax),%edi
lea    0xe7c(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
mov    -0x20(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x0,%rax
jne    11c5 <read_non_empty_line+0x85>
mov    0x2e33(%rip),%rax
mov    (%rax),%edi
lea    0xe5a(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_non_empty_line>:
push   %rax
call   1040 <read_line@plt>
test   %rax,%rax
je     1142 <read_non_empty_line+0x12>
cmpb   $0x0,(%rax)
je     1154 <read_non_empty_line+0x24>
pop    %rcx
ret
mov    0x2e97(%rip),%rax
mov    (%rax),%edi
lea    0xeae(%rip),%rsi
jmp    1164 <read_non_empty_line+0x34>
mov    0x2e85(%rip),%rax
mov    (%rax),%edi
lea    0xeac(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [16 x i8] c"unexpected EOF\0A\00"
@.str.1 = [23 x i8] c"Unexpected empty line\0A\00"
define i8* @read_non_empty_line(i32* %0, i8* %1, i64 %2) {
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i8*
store i32* %0, i32** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%8 = load i32*, i32** %4
%9 = load i8*, i8** %5
%10 = load i64, i64* %6
%11 = call i8* @read_line(i32* %8, i8* %9, i64 %10)
store i8* %11, i8** %7
%12 = load i8*, i8** %7
%13 = icmp eq i8* %12, null
br i1 %13, label %14, label %18
14: ; preds = %3
%15 = load i32, i32* @stderr
%16 = call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%17 = call i32 @exit(i32 1)
unreachable
18: ; preds = %3
%19 = load i8*, i8** %7
%20 = call i64 @strlen(i8* %19)
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %26
22: ; preds = %18
%23 = load i32, i32* @stderr
%24 = call i32 @fprintf(i32 %23, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
%25 = call i32 @exit(i32 1)
unreachable
26: ; preds = %18
%27 = load i8*, i8** %7
ret i8* %27
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [16 x i8] c"unexpected EOF\0A\00"
@.str.1 = [23 x i8] c"Unexpected empty line\0A\00"
define i8* @read_non_empty_line(i32* %0, i8* %1, i64 %2) {
%4 = tail call i8* @read_line(i32* %0, i8* %1, i64 %2)
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %10
6: ; preds = %3
%7 = load i32, i32* @stderr
%8 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%9 = tail call i32 @exit(i32 1)
unreachable
10: ; preds = %3
%11 = load i8, i8* %4
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %17
13: ; preds = %10
%14 = load i32, i32* @stderr
%15 = tail call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
%16 = tail call i32 @exit(i32 1)
unreachable
17: ; preds = %10
ret i8* %4
}