#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 addrinfo {
  int ai_flags;
  int /*<<< orphan*/ *ai_next;
  int /*<<< orphan*/ *ai_canonname;
  int /*<<< orphan*/ *ai_addr;
  scalar_t__ ai_addrlen;
  scalar_t__ ai_protocol;
  int /*<<< orphan*/ ai_socktype;
  int /*<<< orphan*/ ai_family;
};

/* Variables and functions */
int /*<<< orphan*/ AF_INET6;
int AI_ALL;
int AI_V4MAPPED;
int /*<<< orphan*/ SOCK_STREAM;
struct addrinfo lookup_configuration(void) {
  struct addrinfo hints;
  int *flags = &(hints.ai_flags);
  hints.ai_family = AF_INET6;
  hints.ai_socktype = SOCK_STREAM;
  hints.ai_protocol = 0;
  *flags = 0;
  *flags |= AI_V4MAPPED;
  *flags |= AI_ALL;
  hints.ai_addrlen = 0;
  hints.ai_addr = NULL;
  hints.ai_canonname = NULL;
  hints.ai_next = NULL;
  return hints;
}


x86 assembly (clang, -O0):
<lookup_configuration>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,%rax
mov    %rdi,-0x8(%rbp)
mov    0x2ece(%rip),%rcx
mov    (%rcx),%ecx
mov    %ecx,0x34(%rdi)
mov    0x2eaa(%rip),%rcx
mov    (%rcx),%ecx
mov    %ecx,0x30(%rdi)
movq   $0x0,0x28(%rdi)
mov    -0x8(%rbp),%rcx
movl   $0x0,(%rcx)
mov    0x2eac(%rip),%rcx
mov    (%rcx),%edx
mov    -0x8(%rbp),%rcx
or     (%rcx),%edx
mov    %edx,(%rcx)
mov    0x2e83(%rip),%rcx
mov    (%rcx),%edx
mov    -0x8(%rbp),%rcx
or     (%rcx),%edx
mov    %edx,(%rcx)
movq   $0x0,0x20(%rdi)
movq   $0x0,0x18(%rdi)
movq   $0x0,0x10(%rdi)
movq   $0x0,0x8(%rdi)
pop    %rbp
ret

x86 assembly (clang, -O2):
<lookup_configuration>:
mov    %rdi,%rax
mov    0x2ed6(%rip),%rcx
mov    (%rcx),%ecx
mov    %ecx,0x34(%rdi)
mov    0x2eb2(%rip),%rcx
mov    (%rcx),%ecx
mov    %ecx,0x30(%rdi)
movq   $0x0,0x28(%rdi)
mov    0x2ebe(%rip),%rcx
mov    0x2e9f(%rip),%rdx
mov    (%rdx),%edx
or     (%rcx),%edx
mov    %edx,(%rdi)
xorps  %xmm0,%xmm0
movups %xmm0,0x8(%rdi)
movups %xmm0,0x18(%rdi)
ret

LLVM IR (-O0):
%struct.addrinfo = type { i32, i32*, i32*, i32*, i64, i64, i32, i32 }
@AF_INET6 = global i32 0
@SOCK_STREAM = global i32 0
@AI_V4MAPPED = global i32 0
@AI_ALL = global i32 0
define void @lookup_configuration(%struct.addrinfo* noalias sret(%struct.addrinfo) align 8 %0) {
%2 = alloca i32*
%3 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %0, i32 0, i32 0
store i32* %3, i32** %2
%4 = load i32, i32* @AF_INET6
%5 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %0, i32 0, i32 7
store i32 %4, i32* %5
%6 = load i32, i32* @SOCK_STREAM
%7 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %0, i32 0, i32 6
store i32 %6, i32* %7
%8 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %0, i32 0, i32 5
store i64 0, i64* %8
%9 = load i32*, i32** %2
store i32 0, i32* %9
%10 = load i32, i32* @AI_V4MAPPED
%11 = load i32*, i32** %2
%12 = load i32, i32* %11
%13 = or i32 %12, %10
store i32 %13, i32* %11
%14 = load i32, i32* @AI_ALL
%15 = load i32*, i32** %2
%16 = load i32, i32* %15
%17 = or i32 %16, %14
store i32 %17, i32* %15
%18 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %0, i32 0, i32 4
store i64 0, i64* %18
%19 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %0, i32 0, i32 3
store i32* null, i32** %19
%20 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %0, i32 0, i32 2
store i32* null, i32** %20
%21 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %0, i32 0, i32 1
store i32* null, i32** %21
ret void
}

LLVM IR (-O2):
%struct.addrinfo = type { i32, i32*, i32*, i32*, i64, i64, i32, i32 }
@AF_INET6 = global i32 0
@SOCK_STREAM = global i32 0
@AI_V4MAPPED = global i32 0
@AI_ALL = global i32 0
define void @lookup_configuration(%struct.addrinfo* noalias nocapture writeonly sret(%struct.addrinfo) align 8 %0) {
%2 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %0, i64 0, i32 0
%3 = load i32, i32* @AF_INET6
%4 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %0, i64 0, i32 7
store i32 %3, i32* %4
%5 = load i32, i32* @SOCK_STREAM
%6 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %0, i64 0, i32 6
store i32 %5, i32* %6
%7 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %0, i64 0, i32 5
store i64 0, i64* %7
%8 = load i32, i32* @AI_V4MAPPED
%9 = load i32, i32* @AI_ALL
%10 = or i32 %9, %8
store i32 %10, i32* %2
%11 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %0, i64 0, i32 1
%12 = bitcast i32** %11 to i8*
ret void
}