#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 /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stdin;
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ util_no_whitespace(char *);
int handle_user() {
  char buffer[2048];
  fgets(buffer, 2048 - 1, stdin);
  util_no_whitespace(buffer);
  if (strcmp(buffer, "q") == 0) {
    printf("Exiting...\n");
    return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<handle_user>:
push   %rbp
mov    %rsp,%rbp
sub    $0x810,%rsp
lea    -0x810(%rbp),%rdi
mov    0x2e8f(%rip),%rax
mov    (%rax),%edx
mov    $0x7ff,%esi
call   1040 <fgets@plt>
lea    -0x810(%rbp),%rdi
call   1060 <util_no_whitespace@plt>
lea    -0x810(%rbp),%rdi
lea    0xe81(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    11a6 <handle_user+0x66>
lea    0xe6d(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    11ad <handle_user+0x6d>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x810,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<handle_user>:
push   %rbx
sub    $0x800,%rsp
mov    0x2e99(%rip),%rax
mov    (%rax),%edx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x7ff,%esi
call   1040 <fgets@plt>
mov    %rbx,%rdi
call   1060 <util_no_whitespace@plt>
lea    0xe90(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
mov    %rax,%rcx
mov    $0x1,%eax
test   %rcx,%rcx
jne    1193 <handle_user+0x53>
lea    0xe76(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x800,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@stdin = global i32 0
@.str = [2 x i8] c"q\00"
@.str.1 = [12 x i8] c"Exiting...\0A\00"
define i32 @handle_user() {
%1 = alloca i32
%2 = alloca [2048 x i8]
%3 = getelementptr inbounds [2048 x i8], [2048 x i8]* %2, i64 0, i64 0
%4 = load i32, i32* @stdin
%5 = call i32 @fgets(i8* %3, i32 2047, i32 %4)
%6 = getelementptr inbounds [2048 x i8], [2048 x i8]* %2, i64 0, i64 0
%7 = call i32 @util_no_whitespace(i8* %6)
%8 = getelementptr inbounds [2048 x i8], [2048 x i8]* %2, i64 0, i64 0
%9 = call i64 @strcmp(i8* %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %0
%12 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %1
br label %14
13: ; preds = %0
store i32 1, i32* %1
br label %14
14: ; preds = %13, %11
%15 = load i32, i32* %1
ret i32 %15
}

LLVM IR (-O2):
@stdin = global i32 0
@.str = [2 x i8] c"q\00"
@str = [11 x i8] c"Exiting...\00"
define i32 @handle_user() {
%1 = alloca [2048 x i8]
%2 = getelementptr inbounds [2048 x i8], [2048 x i8]* %1, i64 0, i64 0
%3 = load i32, i32* @stdin
%4 = call i32 @fgets(i8* %2, i32 2047, i32 %3)
%5 = call i32 @util_no_whitespace(i8* %2)
%6 = call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %0
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
br label %10
10: ; preds = %0, %8
%11 = phi i32 [ 0, %8 ], [ 1, %0 ]
ret i32 %11
}