#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_in6 {
  int dummy;
};
struct sockaddr {
  int dummy;
};
typedef int /*<<< orphan*/ ssize_t;
typedef int socklen_t;
typedef int /*<<< orphan*/ from;
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
int /*<<< orphan*/ recvfrom(int, char *, int, int /*<<< orphan*/,
                            struct sockaddr *, int *);
int reflect_conn(int, char *, int, int /*<<< orphan*/, struct sockaddr *, int);
int reflect_udp6_conn(int s) {
  char buf[1500];
  struct sockaddr_in6 from;
  socklen_t fromlen;
  ssize_t l;
  int error;
  fromlen = sizeof(from);
  l = recvfrom(s, buf, sizeof(buf), 0, (struct sockaddr *)&from, &fromlen);
  error =
      reflect_conn(s, buf, sizeof(buf), l, (struct sockaddr *)&from, fromlen);
  return (error);
}


x86 assembly (clang, -O0):
<reflect_udp6_conn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x600,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x4,-0x5ec(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x5e0(%rbp),%rsi
lea    -0x5e8(%rbp),%r8
mov    $0x5dc,%edx
xor    %ecx,%ecx
lea    -0x5ec(%rbp),%r9
call   1040 <recvfrom@plt>
mov    %eax,-0x5f0(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x5e0(%rbp),%rsi
mov    -0x5f0(%rbp),%ecx
lea    -0x5e8(%rbp),%r8
mov    -0x5ec(%rbp),%r9d
mov    $0x5dc,%edx
call   1030 <reflect_conn@plt>
mov    %eax,-0x5f4(%rbp)
mov    -0x5f4(%rbp),%eax
add    $0x600,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reflect_udp6_conn>:
push   %r15
push   %r14
push   %rbx
sub    $0x5f0,%rsp
mov    %edi,%ebx
movl   $0x4,0x4(%rsp)
lea    0x10(%rsp),%r14
lea    0x8(%rsp),%r15
lea    0x4(%rsp),%r9
mov    %r14,%rsi
mov    $0x5dc,%edx
xor    %ecx,%ecx
mov    %r15,%r8
call   1040 <recvfrom@plt>
mov    0x4(%rsp),%r9d
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0x5dc,%edx
mov    %eax,%ecx
mov    %r15,%r8
call   1030 <reflect_conn@plt>
add    $0x5f0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.sockaddr_in6 = type { i32 }
%struct.sockaddr = type { i32 }
define i32 @reflect_udp6_conn(i32 %0) {
%2 = alloca i32
%3 = alloca [1500 x i8]
%4 = alloca %struct.sockaddr_in6
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %2
store i32 4, i32* %5
%8 = load i32, i32* %2
%9 = getelementptr inbounds [1500 x i8], [1500 x i8]* %3, i64 0, i64 0
%10 = bitcast %struct.sockaddr_in6* %4 to %struct.sockaddr*
%11 = call i32 @recvfrom(i32 %8, i8* %9, i32 1500, i32 0, %struct.sockaddr* %10, i32* %5)
store i32 %11, i32* %6
%12 = load i32, i32* %2
%13 = getelementptr inbounds [1500 x i8], [1500 x i8]* %3, i64 0, i64 0
%14 = load i32, i32* %6
%15 = bitcast %struct.sockaddr_in6* %4 to %struct.sockaddr*
%16 = load i32, i32* %5
%17 = call i32 @reflect_conn(i32 %12, i8* %13, i32 1500, i32 %14, %struct.sockaddr* %15, i32 %16)
store i32 %17, i32* %7
%18 = load i32, i32* %7
ret i32 %18
}

LLVM IR (-O2):
%struct.sockaddr_in6 = type { i32 }
%struct.sockaddr = type { i32 }
define i32 @reflect_udp6_conn(i32 %0) {
%2 = alloca [1500 x i8]
%3 = alloca %struct.sockaddr_in6
%4 = alloca i32
%5 = getelementptr inbounds [1500 x i8], [1500 x i8]* %2, i64 0, i64 0
%6 = bitcast %struct.sockaddr_in6* %3 to i8*
%7 = bitcast i32* %4 to i8*
store i32 4, i32* %4
%8 = bitcast %struct.sockaddr_in6* %3 to %struct.sockaddr*
%9 = call i32 @recvfrom(i32 %0, i8* %5, i32 1500, i32 0, %struct.sockaddr* %8, i32* %4)
%10 = load i32, i32* %4
%11 = call i32 @reflect_conn(i32 %0, i8* %5, i32 1500, i32 %9, %struct.sockaddr* %8, i32 %10)
ret i32 %11
}