#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_storage {
  int dummy;
};
struct sockaddr {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ perror(char *);
int sendto(int, char *, int /*<<< orphan*/, int /*<<< orphan*/,
           struct sockaddr *, int);
int /*<<< orphan*/ strlen(char *);
void send_reply(int new_fd, char *reply[],
                struct sockaddr_storage client_addr) {
  if (sendto(new_fd, *reply, strlen(*reply), 0, (struct sockaddr *)&client_addr,
             sizeof(struct sockaddr)) == -1)
    perror("send");
}


x86 assembly (clang, -O0):
<send_reply>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edx,-0x8(%rbp)
mov    %edi,-0xc(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
call   1030 <strlen@plt>
mov    -0x24(%rbp),%edi
mov    -0x20(%rbp),%rsi
mov    %eax,%edx
lea    -0x8(%rbp),%r8
xor    %ecx,%ecx
mov    $0x4,%r9d
call   1040 <sendto@plt>
cmp    $0xffffffff,%eax
jne    118e <send_reply+0x5e>
lea    0xe77(%rip),%rdi
call   1050 <perror@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<send_reply>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
mov    %edx,(%rsp)
mov    (%rsi),%rbx
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %rsp,%r8
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
mov    $0x4,%r9d
call   1040 <sendto@plt>
cmp    $0xffffffff,%eax
je     1166 <send_reply+0x36>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
lea    0xe93(%rip),%rdi
call   1050 <perror@plt>
jmp    115f <send_reply+0x2f>

LLVM IR (-O0):
%struct.sockaddr_storage = type { i32 }
%struct.sockaddr = type { i32 }
@.str = [5 x i8] c"send\00"
define void @send_reply(i32 %0, i8** %1, i32 %2) {
%4 = alloca %struct.sockaddr_storage
%5 = alloca i32
%6 = alloca i8**
%7 = getelementptr inbounds %struct.sockaddr_storage, %struct.sockaddr_storage* %4, i32 0, i32 0
store i32 %2, i32* %7
store i32 %0, i32* %5
store i8** %1, i8*** %6
%8 = load i32, i32* %5
%9 = load i8**, i8*** %6
%10 = load i8*, i8** %9
%11 = load i8**, i8*** %6
%12 = load i8*, i8** %11
%13 = call i32 @strlen(i8* %12)
%14 = bitcast %struct.sockaddr_storage* %4 to %struct.sockaddr*
%15 = call i32 @sendto(i32 %8, i8* %10, i32 %13, i32 0, %struct.sockaddr* %14, i32 4)
%16 = icmp eq i32 %15, -1
br i1 %16, label %17, label %19
17: ; preds = %3
%18 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %19
19: ; preds = %17, %3
ret void
}

LLVM IR (-O2):
%struct.sockaddr_storage = type { i32 }
%struct.sockaddr = type { i32 }
@.str = [5 x i8] c"send\00"
define void @send_reply(i32 %0, i8** nocapture %1, i32 %2) {
%4 = alloca %struct.sockaddr_storage
%5 = getelementptr inbounds %struct.sockaddr_storage, %struct.sockaddr_storage* %4, i64 0, i32 0
store i32 %2, i32* %5
%6 = load i8*, i8** %1
%7 = tail call i32 @strlen(i8* %6)
%8 = bitcast %struct.sockaddr_storage* %4 to %struct.sockaddr*
%9 = call i32 @sendto(i32 %0, i8* %6, i32 %7, i32 0, %struct.sockaddr* %8, i32 4)
%10 = icmp eq i32 %9, -1
br i1 %10, label %11, label %13
11: ; preds = %3
%12 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %13
13: ; preds = %11, %3
ret void
}