#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 */
typedef int /*<<< orphan*/ uint32_t;
struct in6_flowlabel_req {
  int /*<<< orphan*/ flr_label;
  int /*<<< orphan*/ flr_action;
};
typedef int /*<<< orphan*/ req;

/* Variables and functions */
int /*<<< orphan*/ IPV6_FL_A_PUT;
int /*<<< orphan*/ SOL_IPV6;
int /*<<< orphan*/ htonl(int /*<<< orphan*/);
int setsockopt(int, int /*<<< orphan*/, int, struct in6_flowlabel_req *, int);
int flowlabel_put(int fd, uint32_t label) {
  struct in6_flowlabel_req req = {
      .flr_action = IPV6_FL_A_PUT,
      .flr_label = htonl(label),
  };
  return setsockopt(fd, SOL_IPV6, 32, &req, sizeof(req));
}


x86 assembly (clang, -O0):
<flowlabel_put>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <htonl@plt>
mov    %eax,-0x10(%rbp)
mov    0x2e98(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2ea1(%rip),%rax
mov    (%rax),%esi
mov    $0x20,%edx
lea    -0x10(%rbp),%rcx
mov    $0x8,%r8d
call   1030 <setsockopt@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<flowlabel_put>:
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebx
mov    %esi,%edi
call   1040 <htonl@plt>
mov    %eax,0x8(%rsp)
mov    0x2e9f(%rip),%rax
mov    (%rax),%eax
mov    %eax,0xc(%rsp)
mov    0x2eaa(%rip),%rax
mov    (%rax),%esi
lea    0x8(%rsp),%rcx
mov    %ebx,%edi
mov    $0x20,%edx
mov    $0x8,%r8d
call   1030 <setsockopt@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.in6_flowlabel_req = type { i32, i32 }
@IPV6_FL_A_PUT = global i32 0
@SOL_IPV6 = global i32 0
define i32 @flowlabel_put(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca %struct.in6_flowlabel_req
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = getelementptr inbounds %struct.in6_flowlabel_req, %struct.in6_flowlabel_req* %5, i32 0, i32 0
%7 = load i32, i32* %4
%8 = call i32 @htonl(i32 %7)
store i32 %8, i32* %6
%9 = getelementptr inbounds %struct.in6_flowlabel_req, %struct.in6_flowlabel_req* %5, i32 0, i32 1
%10 = load i32, i32* @IPV6_FL_A_PUT
store i32 %10, i32* %9
%11 = load i32, i32* %3
%12 = load i32, i32* @SOL_IPV6
%13 = call i32 @setsockopt(i32 %11, i32 %12, i32 32, %struct.in6_flowlabel_req* %5, i32 8)
ret i32 %13
}

LLVM IR (-O2):
%struct.in6_flowlabel_req = type { i32, i32 }
@IPV6_FL_A_PUT = global i32 0
@SOL_IPV6 = global i32 0
define i32 @flowlabel_put(i32 %0, i32 %1) {
%3 = alloca %struct.in6_flowlabel_req
%4 = bitcast %struct.in6_flowlabel_req* %3 to i8*
%5 = getelementptr inbounds %struct.in6_flowlabel_req, %struct.in6_flowlabel_req* %3, i64 0, i32 0
%6 = tail call i32 @htonl(i32 %1)
store i32 %6, i32* %5
%7 = getelementptr inbounds %struct.in6_flowlabel_req, %struct.in6_flowlabel_req* %3, i64 0, i32 1
%8 = load i32, i32* @IPV6_FL_A_PUT
store i32 %8, i32* %7
%9 = load i32, i32* @SOL_IPV6
%10 = call i32 @setsockopt(i32 %0, i32 %9, i32 32, %struct.in6_flowlabel_req* %3, i32 8)
ret i32 %10
}