#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*/ do_fortune();
int /*<<< orphan*/ flush_input(int /*<<< orphan*/);
int /*<<< orphan*/ my_exit(int);
int /*<<< orphan*/ my_printf(char *);
scalar_t__ yesno(int);
void dologout(void) {
  my_printf("Logout\n\nReally log out? (Y/N) -> ");
  flush_input(0);
  if (yesno(-1)) {
    my_printf("\n");
    do_fortune();
    my_printf("\nThanks for dropping by.\n");
    my_exit(1);
  }
}


x86 assembly (clang, -O0):
<dologout>:
push   %rbp
mov    %rsp,%rbp
lea    0xea5(%rip),%rdi
call   1030 <my_printf@plt>
xor    %edi,%edi
call   1070 <flush_input@plt>
mov    $0xffffffff,%edi
call   1060 <yesno@plt>
cmp    $0x0,%rax
je     11a4 <dologout+0x54>
lea    0xeb8(%rip),%rdi
call   1030 <my_printf@plt>
mov    $0x0,%al
call   1050 <do_fortune@plt>
lea    0xe8d(%rip),%rdi
call   1030 <my_printf@plt>
mov    $0x1,%edi
call   1040 <my_exit@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<dologout>:
push   %rax
lea    0xea8(%rip),%rdi
call   1030 <my_printf@plt>
xor    %edi,%edi
call   1070 <flush_input@plt>
mov    $0xffffffff,%edi
call   1060 <yesno@plt>
test   %rax,%rax
je     119d <dologout+0x4d>
lea    0xec0(%rip),%rdi
call   1030 <my_printf@plt>
xor    %eax,%eax
call   1050 <do_fortune@plt>
lea    0xe95(%rip),%rdi
call   1030 <my_printf@plt>
mov    $0x1,%edi
pop    %rax
jmp    1040 <my_exit@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [34 x i8] c"Logout\0A\0AReally log out? (Y/N) -> \00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [26 x i8] c"\0AThanks for dropping by.\0A\00"
define void @dologout() {
%1 = call i32 @my_printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @flush_input(i32 0)
%3 = call i64 @yesno(i32 -1)
%4 = icmp ne i64 %3, 0
br i1 %4, label %5, label %10
5: ; preds = %0
%6 = call i32 @my_printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 (...) @do_fortune()
%8 = call i32 @my_printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 @my_exit(i32 1)
br label %10
10: ; preds = %5, %0
ret void
}

LLVM IR (-O2):
@.str = [34 x i8] c"Logout\0A\0AReally log out? (Y/N) -> \00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [26 x i8] c"\0AThanks for dropping by.\0A\00"
define void @dologout() {
%1 = tail call i32 @my_printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @flush_input(i32 0)
%3 = tail call i64 @yesno(i32 -1)
%4 = icmp eq i64 %3, 0
br i1 %4, label %10, label %5
5: ; preds = %0
%6 = tail call i32 @my_printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%7 = tail call i32 (...) @do_fortune()
%8 = tail call i32 @my_printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
%9 = tail call i32 @my_exit(i32 1)
br label %10
10: ; preds = %5, %0
ret void
}