#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 {
  int dummy;
};
typedef int /*<<< orphan*/ ssize_t;
typedef int /*<<< orphan*/ socklen_t;
typedef scalar_t__ __ptr_t;

/* Variables and functions */
int /*<<< orphan*/ __socketcall(int, unsigned long *);
ssize_t __libc_recvfrom(int sockfd, __ptr_t buffer, size_t len, int flags,
                        struct sockaddr *to, socklen_t *tolen) {
  unsigned long args[6];
  args[0] = sockfd;
  args[1] = (unsigned long)buffer;
  args[2] = len;
  args[3] = flags;
  args[4] = (unsigned long)to;
  args[5] = (unsigned long)tolen;
  return (__socketcall(12, args));
}


x86 assembly (clang, -O0):
<__libc_recvfrom>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
movslq -0x4(%rbp),%rax
mov    %rax,-0x60(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x50(%rbp)
movslq -0x1c(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x38(%rbp)
lea    -0x60(%rbp),%rsi
mov    $0xc,%edi
call   1030 <__socketcall@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__libc_recvfrom>:
sub    $0x38,%rsp
movslq %edi,%rax
mov    %rax,(%rsp)
mov    %rsi,0x8(%rsp)
mov    %rdx,0x10(%rsp)
movslq %ecx,%rax
mov    %rax,0x18(%rsp)
mov    %r8,0x20(%rsp)
mov    %r9,0x28(%rsp)
mov    %rsp,%rsi
mov    $0xc,%edi
call   1030 <__socketcall@plt>
add    $0x38,%rsp
ret

LLVM IR (-O0):
%struct.sockaddr = type { i32 }
define i32 @__libc_recvfrom(i32 %0, i64 %1, i64 %2, i32 %3, %struct.sockaddr* %4, i32* %5) {
%7 = alloca i32
%8 = alloca i64
%9 = alloca i64
%10 = alloca i32
%11 = alloca %struct.sockaddr*
%12 = alloca i32*
%13 = alloca [6 x i64]
store i32 %0, i32* %7
store i64 %1, i64* %8
store i64 %2, i64* %9
store i32 %3, i32* %10
store %struct.sockaddr* %4, %struct.sockaddr** %11
store i32* %5, i32** %12
%14 = load i32, i32* %7
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [6 x i64], [6 x i64]* %13, i64 0, i64 0
store i64 %15, i64* %16
%17 = load i64, i64* %8
%18 = getelementptr inbounds [6 x i64], [6 x i64]* %13, i64 0, i64 1
store i64 %17, i64* %18
%19 = load i64, i64* %9
%20 = getelementptr inbounds [6 x i64], [6 x i64]* %13, i64 0, i64 2
store i64 %19, i64* %20
%21 = load i32, i32* %10
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [6 x i64], [6 x i64]* %13, i64 0, i64 3
store i64 %22, i64* %23
%24 = load %struct.sockaddr*, %struct.sockaddr** %11
%25 = ptrtoint %struct.sockaddr* %24 to i64
%26 = getelementptr inbounds [6 x i64], [6 x i64]* %13, i64 0, i64 4
store i64 %25, i64* %26
%27 = load i32*, i32** %12
%28 = ptrtoint i32* %27 to i64
%29 = getelementptr inbounds [6 x i64], [6 x i64]* %13, i64 0, i64 5
store i64 %28, i64* %29
%30 = getelementptr inbounds [6 x i64], [6 x i64]* %13, i64 0, i64 0
%31 = call i32 @__socketcall(i32 12, i64* %30)
ret i32 %31
}

LLVM IR (-O2):
%struct.sockaddr = type { i32 }
define i32 @__libc_recvfrom(i32 %0, i64 %1, i64 %2, i32 %3, %struct.sockaddr* %4, i32* %5) {
%7 = alloca [6 x i64]
%8 = bitcast [6 x i64]* %7 to i8*
%9 = sext i32 %0 to i64
%10 = getelementptr inbounds [6 x i64], [6 x i64]* %7, i64 0, i64 0
store i64 %9, i64* %10
%11 = getelementptr inbounds [6 x i64], [6 x i64]* %7, i64 0, i64 1
store i64 %1, i64* %11
%12 = getelementptr inbounds [6 x i64], [6 x i64]* %7, i64 0, i64 2
store i64 %2, i64* %12
%13 = sext i32 %3 to i64
%14 = getelementptr inbounds [6 x i64], [6 x i64]* %7, i64 0, i64 3
store i64 %13, i64* %14
%15 = ptrtoint %struct.sockaddr* %4 to i64
%16 = getelementptr inbounds [6 x i64], [6 x i64]* %7, i64 0, i64 4
store i64 %15, i64* %16
%17 = ptrtoint i32* %5 to i64
%18 = getelementptr inbounds [6 x i64], [6 x i64]* %7, i64 0, i64 5
store i64 %17, i64* %18
%19 = call i32 @__socketcall(i32 12, i64* %10)
ret i32 %19
}