#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*/ get_event_data(int);
int /*<<< orphan*/ get_int_from_srv_noblock(int *);
int /*<<< orphan*/ internal_logit(char *, int, char *, char *);
int /*<<< orphan*/ server_event(int, int /*<<< orphan*/);
void get_and_handle_event() {
  int type;
  if (!get_int_from_srv_noblock(&type)) {
    internal_logit("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                   "outputs/2022-01-22/02-19-57/repos/ecthiender/mocp-git/refs/"
                   "heads/master/interface.c",
                   3523, "UNKNOWN_FUNC", "Getting event would block.");
    return;
  }
  server_event(type, get_event_data(type));
}


x86 assembly (clang, -O0):
<get_and_handle_event>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x4(%rbp),%rdi
call   1050 <get_int_from_srv_noblock@plt>
cmp    $0x0,%eax
jne    117e <get_and_handle_event+0x3e>
lea    0xe9f(%rip),%rdi
mov    $0xdc3,%esi
lea    0xf1f(%rip),%rdx
lea    0xf25(%rip),%rcx
call   1060 <internal_logit@plt>
jmp    1196 <get_and_handle_event+0x56>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <get_event_data@plt>
mov    -0x8(%rbp),%edi
mov    %eax,%esi
call   1030 <server_event@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_and_handle_event>:
push   %rbx
sub    $0x10,%rsp
lea    0xc(%rsp),%rdi
call   1050 <get_int_from_srv_noblock@plt>
test   %eax,%eax
je     1169 <get_and_handle_event+0x29>
mov    0xc(%rsp),%ebx
mov    %ebx,%edi
call   1040 <get_event_data@plt>
mov    %ebx,%edi
mov    %eax,%esi
call   1030 <server_event@plt>
jmp    1188 <get_and_handle_event+0x48>
lea    0xe90(%rip),%rdi
lea    0xf15(%rip),%rdx
lea    0xf1b(%rip),%rcx
mov    $0xdc3,%esi
call   1060 <internal_logit@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [140 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/ecthiender/mocp-git/refs/heads/master/interface.c\00"
@.str.1 = [13 x i8] c"UNKNOWN_FUNC\00"
@.str.2 = [27 x i8] c"Getting event would block.\00"
define void @get_and_handle_event() {
%1 = alloca i32
%2 = call i32 @get_int_from_srv_noblock(i32* %1)
%3 = icmp ne i32 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %0
%5 = call i32 @internal_logit(i8* getelementptr inbounds ([140 x i8], [140 x i8]* @.str, i64 0, i64 0), i32 3523, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
br label %11
6: ; preds = %0
%7 = load i32, i32* %1
%8 = load i32, i32* %1
%9 = call i32 @get_event_data(i32 %8)
%10 = call i32 @server_event(i32 %7, i32 %9)
br label %11
11: ; preds = %6, %4
ret void
}

LLVM IR (-O2):
@.str = [140 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/ecthiender/mocp-git/refs/heads/master/interface.c\00"
@.str.1 = [13 x i8] c"UNKNOWN_FUNC\00"
@.str.2 = [27 x i8] c"Getting event would block.\00"
define void @get_and_handle_event() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @get_int_from_srv_noblock(i32* %1)
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %0
%6 = call i32 @internal_logit(i8* getelementptr inbounds ([140 x i8], [140 x i8]* @.str, i64 0, i64 0), i32 3523, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
br label %11
7: ; preds = %0
%8 = load i32, i32* %1
%9 = call i32 @get_event_data(i32 %8)
%10 = call i32 @server_event(i32 %8, i32 %9)
br label %11
11: ; preds = %7, %5
ret void
}