#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 unsigned long socklen_t;

/* Variables and functions */
int /*<<< orphan*/ __socketcall(int, unsigned long *);
ssize_t __libc_sendto(int sockfd, const void *buffer, size_t len, int flags,
                      const 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] = tolen;
  return (__socketcall(11, args));
}


x86 assembly (clang, -O0):
<__libc_sendto>:
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    $0xb,%edi
call   1030 <__socketcall@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__libc_sendto>:
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    $0xb,%edi
call   1030 <__socketcall@plt>
add    $0x38,%rsp
ret

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

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