#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*/ EXIT_SUCCESS;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ log_print_all(void *);
int /*<<< orphan*/ sleep(int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ top_insert(void *);
int /*<<< orphan*/ top_prefs_get_sleep();
scalar_t__ top_signal_is_exit_set();
void top_logging_loop_body(void *tinst) {
  top_insert(tinst);
  log_print_all(tinst);
  fflush(stdout);
  sleep(top_prefs_get_sleep());
  if (top_signal_is_exit_set())
    exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<top_logging_loop_body>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <top_insert@plt>
mov    -0x8(%rbp),%rdi
call   1070 <log_print_all@plt>
mov    0x2e4b(%rip),%rax
mov    (%rax),%edi
call   1060 <fflush@plt>
mov    $0x0,%al
call   1030 <top_prefs_get_sleep@plt>
mov    %eax,%edi
call   1090 <sleep@plt>
mov    $0x0,%al
call   1050 <top_signal_is_exit_set@plt>
cmp    $0x0,%rax
je     11c9 <top_logging_loop_body+0x59>
mov    0x2e16(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<top_logging_loop_body>:
push   %rbx
mov    %rdi,%rbx
call   1040 <top_insert@plt>
mov    %rbx,%rdi
call   1070 <log_print_all@plt>
mov    0x2e58(%rip),%rax
mov    (%rax),%edi
call   1060 <fflush@plt>
xor    %eax,%eax
call   1030 <top_prefs_get_sleep@plt>
mov    %eax,%edi
call   1090 <sleep@plt>
xor    %eax,%eax
call   1050 <top_signal_is_exit_set@plt>
test   %rax,%rax
jne    11ab <top_logging_loop_body+0x3b>
pop    %rbx
ret
mov    0x2e26(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@stdout = global i32 0
@EXIT_SUCCESS = global i32 0
define void @top_logging_loop_body(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @top_insert(i8* %3)
%5 = load i8*, i8** %2
%6 = call i32 @log_print_all(i8* %5)
%7 = load i32, i32* @stdout
%8 = call i32 @fflush(i32 %7)
%9 = call i32 (...) @top_prefs_get_sleep()
%10 = call i32 @sleep(i32 %9)
%11 = call i64 (...) @top_signal_is_exit_set()
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %1
%14 = load i32, i32* @EXIT_SUCCESS
%15 = call i32 @exit(i32 %14)
unreachable
16: ; preds = %1
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@EXIT_SUCCESS = global i32 0
define void @top_logging_loop_body(i8* %0) {
%2 = tail call i32 @top_insert(i8* %0)
%3 = tail call i32 @log_print_all(i8* %0)
%4 = load i32, i32* @stdout
%5 = tail call i32 @fflush(i32 %4)
%6 = tail call i32 (...) @top_prefs_get_sleep()
%7 = tail call i32 @sleep(i32 %6)
%8 = tail call i64 (...) @top_signal_is_exit_set()
%9 = icmp eq i64 %8, 0
br i1 %9, label %13, label %10
10: ; preds = %1
%11 = load i32, i32* @EXIT_SUCCESS
%12 = tail call i32 @exit(i32 %11)
unreachable
13: ; preds = %1
ret void
}