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

/* Variables and functions */
int /*<<< orphan*/ Log(char *);
int sendto(int, struct NetworkPacket *, int, int /*<<< orphan*/,
           struct sockaddr const *, int /*<<< orphan*/);
void Respond(int s, const struct sockaddr_in *dest, socklen_t salen,
             struct NetworkPacket *pkt) {
  ssize_t n;
  n = sendto(s, pkt, sizeof(pkt), 0, (const struct sockaddr *)dest, salen);
  if (n != sizeof(pkt)) {
    Log("WARNING: Error sending response packet\n");
  }
}


x86 assembly (clang, -O0):
<Respond>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x20(%rbp),%rsi
mov    -0x10(%rbp),%r8
mov    -0x14(%rbp),%r9d
mov    $0x8,%edx
xor    %ecx,%ecx
call   1030 <sendto@plt>
mov    %eax,-0x24(%rbp)
movslq -0x24(%rbp),%rax
cmp    $0x8,%rax
je     116e <Respond+0x4e>
lea    0xe97(%rip),%rdi
call   1040 <Log@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Respond>:
push   %rax
mov    %edx,%r9d
mov    %rsi,%r8
mov    %rcx,%rsi
mov    $0x8,%edx
xor    %ecx,%ecx
call   1030 <sendto@plt>
cmp    $0x8,%eax
jne    113d <Respond+0x1d>
pop    %rax
ret
lea    0xebc(%rip),%rdi
pop    %rax
jmp    1040 <Log@plt>

LLVM IR (-O0):
%struct.sockaddr_in = type { i32 }
%struct.NetworkPacket = type { i32 }
%struct.sockaddr = type { i32 }
@.str = [40 x i8] c"WARNING: Error sending response packet\0A\00"
define void @Respond(i32 %0, %struct.sockaddr_in* %1, i32 %2, %struct.NetworkPacket* %3) {
%5 = alloca i32
%6 = alloca %struct.sockaddr_in*
%7 = alloca i32
%8 = alloca %struct.NetworkPacket*
%9 = alloca i32
store i32 %0, i32* %5
store %struct.sockaddr_in* %1, %struct.sockaddr_in** %6
store i32 %2, i32* %7
store %struct.NetworkPacket* %3, %struct.NetworkPacket** %8
%10 = load i32, i32* %5
%11 = load %struct.NetworkPacket*, %struct.NetworkPacket** %8
%12 = load %struct.sockaddr_in*, %struct.sockaddr_in** %6
%13 = bitcast %struct.sockaddr_in* %12 to %struct.sockaddr*
%14 = load i32, i32* %7
%15 = call i32 @sendto(i32 %10, %struct.NetworkPacket* %11, i32 8, i32 0, %struct.sockaddr* %13, i32 %14)
store i32 %15, i32* %9
%16 = load i32, i32* %9
%17 = sext i32 %16 to i64
%18 = icmp ne i64 %17, 8
br i1 %18, label %19, label %21
19: ; preds = %4
%20 = call i32 @Log(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
br label %21
21: ; preds = %19, %4
ret void
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32 }
%struct.NetworkPacket = type { i32 }
%struct.sockaddr = type { i32 }
@.str = [40 x i8] c"WARNING: Error sending response packet\0A\00"
define void @Respond(i32 %0, %struct.sockaddr_in* %1, i32 %2, %struct.NetworkPacket* %3) {
%5 = bitcast %struct.sockaddr_in* %1 to %struct.sockaddr*
%6 = tail call i32 @sendto(i32 %0, %struct.NetworkPacket* %3, i32 8, i32 0, %struct.sockaddr* %5, i32 %2)
%7 = icmp eq i32 %6, 8
br i1 %7, label %10, label %8
8: ; preds = %4
%9 = tail call i32 @Log(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %8, %4
ret void
}