#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 */
struct timeval {
  int tv_usec;
  scalar_t__ tv_sec;
};

/* Variables and functions */
int /*<<< orphan*/ process_incoming();
scalar_t__ wait_for_data(struct timeval *);
int process_connection(int block) {
  struct timeval tv;
  if (block) {
    wait_for_data(NULL);
    process_incoming();
  } else {
    tv.tv_sec = 0;
    tv.tv_usec = 10;
    if (wait_for_data(&tv) == 0)
      process_incoming();
  }
  return 0;
}


x86 assembly (clang, -O0):
<process_connection>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     114a <process_connection+0x2a>
xor    %eax,%eax
mov    %eax,%edi
call   1040 <wait_for_data@plt>
mov    $0x0,%al
call   1030 <process_incoming@plt>
jmp    1178 <process_connection+0x58>
movq   $0x0,-0x10(%rbp)
movl   $0xa,-0x18(%rbp)
lea    -0x18(%rbp),%rdi
call   1040 <wait_for_data@plt>
cmp    $0x0,%rax
jne    1173 <process_connection+0x53>
mov    $0x0,%al
call   1030 <process_incoming@plt>
jmp    1178 <process_connection+0x58>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<process_connection>:
sub    $0x18,%rsp
test   %edi,%edi
je     1131 <process_connection+0x11>
xor    %edi,%edi
call   1040 <wait_for_data@plt>
jmp    1151 <process_connection+0x31>
movq   $0x0,0x10(%rsp)
movl   $0xa,0x8(%rsp)
lea    0x8(%rsp),%rdi
call   1040 <wait_for_data@plt>
test   %rax,%rax
jne    1158 <process_connection+0x38>
xor    %eax,%eax
call   1030 <process_incoming@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timeval = type { i32, i64 }
define i32 @process_connection(i32 %0) {
%2 = alloca i32
%3 = alloca %struct.timeval
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = icmp ne i32 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = call i64 @wait_for_data(%struct.timeval* null)
%8 = call i32 (...) @process_incoming()
br label %17
9: ; preds = %1
%10 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i32 0, i32 1
store i64 0, i64* %10
%11 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i32 0, i32 0
store i32 10, i32* %11
%12 = call i64 @wait_for_data(%struct.timeval* %3)
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %9
%15 = call i32 (...) @process_incoming()
br label %16
16: ; preds = %14, %9
br label %17
17: ; preds = %16, %6
ret i32 0
}

LLVM IR (-O2):
%struct.timeval = type { i32, i64 }
define i32 @process_connection(i32 %0) {
%2 = alloca %struct.timeval
%3 = bitcast %struct.timeval* %2 to i8*
%4 = icmp eq i32 %0, 0
br i1 %4, label %8, label %5
5: ; preds = %1
%6 = tail call i64 @wait_for_data(%struct.timeval* null)
%7 = tail call i32 (...) @process_incoming()
br label %15
8: ; preds = %1
%9 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i64 0, i32 1
store i64 0, i64* %9
%10 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i64 0, i32 0
store i32 10, i32* %10
%11 = call i64 @wait_for_data(%struct.timeval* %2)
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %8
%14 = call i32 (...) @process_incoming()
br label %15
15: ; preds = %8, %13, %5
ret i32 0
}