#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 */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  int /*<<< orphan*/ s_addr;
};
struct sockaddr_in {
  int /*<<< orphan*/ sin_port;
  TYPE_1__ sin_addr;
  int /*<<< orphan*/ sin_family;
};
struct sockaddr {
  int dummy;
};
typedef int /*<<< orphan*/ sin;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ INADDR_ANY;
int /*<<< orphan*/ IPPROTO_UDP;
int /*<<< orphan*/ SOCK_DGRAM;
int /*<<< orphan*/ htonl(int /*<<< orphan*/);
int /*<<< orphan*/ htons(int);
int /*<<< orphan*/ memset(void *, int /*<<< orphan*/, int);
int /*<<< orphan*/ sendto(int, char *, scalar_t__, int /*<<< orphan*/,
                          struct sockaddr *, int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
scalar_t__ strlen(char *);
int execute_sendto() {
  int sfd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
  struct sockaddr_in sin;
  memset((void *)&sin, 0, sizeof(sin));
  sin.sin_family = AF_INET;
  sin.sin_addr.s_addr = htonl(INADDR_ANY);
  sin.sin_port = htons(25588);
  char *message = "Message for sendto.";
  sendto(sfd, message, strlen(message) + 1, 0, (struct sockaddr *)&sin,
         sizeof(sin));
  return 0;
}


x86 assembly (clang, -O0):
<execute_sendto>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0x2e79(%rip),%rax
mov    (%rax),%edi
mov    0x2e60(%rip),%rax
mov    (%rax),%esi
mov    0x2e3f(%rip),%rax
mov    (%rax),%edx
call   1080 <socket@plt>
mov    %eax,-0x4(%rbp)
lea    -0x10(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1060 <memset@plt>
mov    0x2e46(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
mov    0x2e32(%rip),%rax
mov    (%rax),%edi
call   1050 <htonl@plt>
mov    %eax,-0xc(%rbp)
mov    $0x63f4,%edi
call   1040 <htons@plt>
mov    %eax,-0x10(%rbp)
lea    0xe34(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x24(%rbp),%edi
mov    -0x20(%rbp),%rsi
mov    %rax,%rdx
add    $0x1,%rdx
lea    -0x10(%rbp),%r8
xor    %ecx,%ecx
mov    $0xc,%r9d
call   1070 <sendto@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<execute_sendto>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    0x2e88(%rip),%r15
mov    (%r15),%edi
mov    0x2e6e(%rip),%rax
mov    (%rax),%esi
mov    0x2e4d(%rip),%rax
mov    (%rax),%edx
call   1070 <socket@plt>
mov    %eax,%ebx
mov    %rsp,%r14
mov    %r14,%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1050 <memset@plt>
mov    (%r15),%eax
mov    %eax,0x8(%rsp)
mov    0x2e44(%rip),%rax
mov    (%rax),%edi
call   1040 <htonl@plt>
mov    %eax,0x4(%rsp)
mov    $0x63f4,%edi
call   1030 <htons@plt>
mov    %eax,(%rsp)
lea    0xe45(%rip),%rsi
mov    $0x14,%edx
mov    %ebx,%edi
xor    %ecx,%ecx
mov    %r14,%r8
mov    $0xc,%r9d
call   1060 <sendto@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@AF_INET = global i32 0
@SOCK_DGRAM = global i32 0
@IPPROTO_UDP = global i32 0
@INADDR_ANY = global i32 0
@.str = [20 x i8] c"Message for sendto.\00"
define i32 @execute_sendto() {
%1 = alloca i32
%2 = alloca %struct.sockaddr_in
%3 = alloca i8*
%4 = load i32, i32* @AF_INET
%5 = load i32, i32* @SOCK_DGRAM
%6 = load i32, i32* @IPPROTO_UDP
%7 = call i32 @socket(i32 %4, i32 %5, i32 %6)
store i32 %7, i32* %1
%8 = bitcast %struct.sockaddr_in* %2 to i8*
%9 = call i32 @memset(i8* %8, i32 0, i32 12)
%10 = load i32, i32* @AF_INET
%11 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %2, i32 0, i32 2
store i32 %10, i32* %11
%12 = load i32, i32* @INADDR_ANY
%13 = call i32 @htonl(i32 %12)
%14 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %2, i32 0, i32 1
%15 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %14, i32 0, i32 0
store i32 %13, i32* %15
%16 = call i32 @htons(i32 25588)
%17 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %2, i32 0, i32 0
store i32 %16, i32* %17
store i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8** %3
%18 = load i32, i32* %1
%19 = load i8*, i8** %3
%20 = load i8*, i8** %3
%21 = call i64 @strlen(i8* %20)
%22 = add nsw i64 %21, 1
%23 = bitcast %struct.sockaddr_in* %2 to %struct.sockaddr*
%24 = call i32 @sendto(i32 %18, i8* %19, i64 %22, i32 0, %struct.sockaddr* %23, i32 12)
ret i32 0
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@AF_INET = global i32 0
@SOCK_DGRAM = global i32 0
@IPPROTO_UDP = global i32 0
@INADDR_ANY = global i32 0
@.str = [20 x i8] c"Message for sendto.\00"
define i32 @execute_sendto() {
%1 = alloca %struct.sockaddr_in
%2 = load i32, i32* @AF_INET
%3 = load i32, i32* @SOCK_DGRAM
%4 = load i32, i32* @IPPROTO_UDP
%5 = tail call i32 @socket(i32 %2, i32 %3, i32 %4)
%6 = bitcast %struct.sockaddr_in* %1 to i8*
%7 = call i32 @memset(i8* %6, i32 0, i32 12)
%8 = load i32, i32* @AF_INET
%9 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %1, i64 0, i32 2
store i32 %8, i32* %9
%10 = load i32, i32* @INADDR_ANY
%11 = call i32 @htonl(i32 %10)
%12 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %1, i64 0, i32 1, i32 0
store i32 %11, i32* %12
%13 = call i32 @htons(i32 25588)
%14 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %1, i64 0, i32 0
store i32 %13, i32* %14
%15 = bitcast %struct.sockaddr_in* %1 to %struct.sockaddr*
%16 = call i32 @sendto(i32 %5, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i64 20, i32 0, %struct.sockaddr* %15, i32 12)
ret i32 0
}