#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 sockaddr_in {
  int dummy;
};
struct sockaddr {
  int dummy;
};
typedef int /*<<< orphan*/ buff;

/* Variables and functions */
short EV_READ;
int /*<<< orphan*/ net_forward_module_inside_parse_response(char *, int);
int recvfrom(int, char *, int, int /*<<< orphan*/, struct sockaddr *, int *);
void net_forward_module_inside_udp_cb(int fd, short event, void *arg) {
  int h, sz;
  char buff[2048];
  int clilen;
  struct sockaddr_in cliaddr;
  if (event & EV_READ) {
    sz = recvfrom(fd, buff, sizeof(buff), 0, (struct sockaddr *)&cliaddr,
                  &clilen);
    net_forward_module_inside_parse_response(buff, sz);
  }
}


x86 assembly (clang, -O0):
<net_forward_module_inside_udp_cb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x830,%rsp
mov    %si,%ax
mov    %edi,-0x4(%rbp)
mov    %ax,-0x6(%rbp)
mov    %rdx,-0x10(%rbp)
movswl -0x6(%rbp),%eax
mov    0x2ea4(%rip),%rcx
movswl (%rcx),%ecx
and    %ecx,%eax
cmp    $0x0,%eax
je     1188 <net_forward_module_inside_udp_cb+0x68>
mov    -0x4(%rbp),%edi
lea    -0x820(%rbp),%rsi
lea    -0x828(%rbp),%r8
mov    $0x800,%edx
xor    %ecx,%ecx
lea    -0x824(%rbp),%r9
call   1040 <recvfrom@plt>
mov    %eax,-0x18(%rbp)
lea    -0x820(%rbp),%rdi
mov    -0x18(%rbp),%esi
call   1030 <net_forward_module_inside_parse_response@plt>
add    $0x830,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<net_forward_module_inside_udp_cb>:
push   %rbx
sub    $0x810,%rsp
mov    0x2eb9(%rip),%rax
test   %si,(%rax)
je     115c <net_forward_module_inside_udp_cb+0x3c>
lea    0x10(%rsp),%rbx
lea    0x8(%rsp),%r8
lea    0xc(%rsp),%r9
mov    %rbx,%rsi
mov    $0x800,%edx
xor    %ecx,%ecx
call   1040 <recvfrom@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <net_forward_module_inside_parse_response@plt>
add    $0x810,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.sockaddr_in = type { i32 }
%struct.sockaddr = type { i32 }
@EV_READ = global i16 0
define void @net_forward_module_inside_udp_cb(i32 %0, i16 signext %1, i8* %2) {
%4 = alloca i32
%5 = alloca i16
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca [2048 x i8]
%10 = alloca i32
%11 = alloca %struct.sockaddr_in
store i32 %0, i32* %4
store i16 %1, i16* %5
store i8* %2, i8** %6
%12 = load i16, i16* %5
%13 = sext i16 %12 to i32
%14 = load i16, i16* @EV_READ
%15 = sext i16 %14 to i32
%16 = and i32 %13, %15
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %26
18: ; preds = %3
%19 = load i32, i32* %4
%20 = getelementptr inbounds [2048 x i8], [2048 x i8]* %9, i64 0, i64 0
%21 = bitcast %struct.sockaddr_in* %11 to %struct.sockaddr*
%22 = call i32 @recvfrom(i32 %19, i8* %20, i32 2048, i32 0, %struct.sockaddr* %21, i32* %10)
store i32 %22, i32* %8
%23 = getelementptr inbounds [2048 x i8], [2048 x i8]* %9, i64 0, i64 0
%24 = load i32, i32* %8
%25 = call i32 @net_forward_module_inside_parse_response(i8* %23, i32 %24)
br label %26
26: ; preds = %18, %3
ret void
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32 }
%struct.sockaddr = type { i32 }
@EV_READ = global i16 0
define void @net_forward_module_inside_udp_cb(i32 %0, i16 signext %1, i8* nocapture readnone %2) {
%4 = alloca [2048 x i8]
%5 = alloca i32
%6 = alloca %struct.sockaddr_in
%7 = getelementptr inbounds [2048 x i8], [2048 x i8]* %4, i64 0, i64 0
%8 = bitcast i32* %5 to i8*
%9 = bitcast %struct.sockaddr_in* %6 to i8*
%10 = load i16, i16* @EV_READ
%11 = and i16 %10, %1
%12 = icmp eq i16 %11, 0
br i1 %12, label %17, label %13
13: ; preds = %3
%14 = bitcast %struct.sockaddr_in* %6 to %struct.sockaddr*
%15 = call i32 @recvfrom(i32 %0, i8* %7, i32 2048, i32 0, %struct.sockaddr* %14, i32* %5)
%16 = call i32 @net_forward_module_inside_parse_response(i8* %7, i32 %15)
br label %17
17: ; preds = %13, %3
ret void
}