#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*/ u_char;

/* Variables and functions */
int /*<<< orphan*/ C_IN;
int PACKETSZ;
int /*<<< orphan*/ T_TXT;
scalar_t__ h_errno;
int /*<<< orphan*/ putc(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ res_init();
int /*<<< orphan*/ res_query(char *, int /*<<< orphan*/, int /*<<< orphan*/,
                             int /*<<< orphan*/ *, int);
int /*<<< orphan*/ stdout;
int main(int argc, char *argv[]) {
  int i;
  char domain[] = "2.0.0.127.rbl.maps.vix.com";
  u_char buf[PACKETSZ];
  res_init();
  res_query(domain, C_IN, T_TXT, buf, PACKETSZ);
  if (h_errno != 0)
    return 0;
  for (i = 0; i < PACKETSZ; i++)
    putc(buf[i], stdout);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movups 0xebe(%rip),%xmm0
movups %xmm0,-0x25(%rbp)
movaps 0xea8(%rip),%xmm0
movaps %xmm0,-0x30(%rbp)
mov    0x2e85(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
mov    %rcx,-0x38(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x50(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x40(%rbp)
mov    $0x0,%al
call   1030 <res_init@plt>
mov    -0x50(%rbp),%rcx
lea    -0x30(%rbp),%rdi
mov    0x2e41(%rip),%rax
mov    (%rax),%esi
mov    0x2e20(%rip),%rax
mov    (%rax),%edx
mov    0x2e37(%rip),%rax
mov    (%rax),%r8d
call   1050 <res_query@plt>
mov    0x2e18(%rip),%rax
cmpq   $0x0,(%rax)
je     11dd <main+0xad>
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x44(%rbp)
jmp    122b <main+0xfb>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    0x2dfa(%rip),%rcx
cmp    (%rcx),%eax
jge    121d <main+0xed>
mov    -0x50(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
mov    0x2db8(%rip),%rax
mov    (%rax),%esi
call   1040 <putc@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11e4 <main+0xb4>
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x44(%rbp)
mov    -0x38(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rsp,%r14
movups 0xec0(%rip),%xmm0
movups %xmm0,-0x45(%rbp)
movaps 0xeaa(%rip),%xmm0
movaps %xmm0,-0x50(%rbp)
mov    0x2e87(%rip),%r15
mov    (%r15),%eax
mov    %rsp,%r12
lea    0xf(,%rax,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r12
mov    %r12,%rsp
xor    %eax,%eax
call   1030 <res_init@plt>
mov    0x2e59(%rip),%rax
mov    (%rax),%esi
mov    0x2e38(%rip),%rax
mov    (%rax),%edx
mov    (%r15),%r8d
lea    -0x50(%rbp),%rdi
mov    %r12,%rcx
call   1050 <res_query@plt>
mov    0x2e30(%rip),%rax
cmpq   $0x0,(%rax)
jne    11d9 <main+0xa9>
cmpl   $0x0,(%r15)
jle    11d9 <main+0xa9>
xor    %ebx,%ebx
mov    0x2e03(%rip),%r13
nopl   (%rax)
mov    (%r12,%rbx,4),%edi
mov    0x0(%r13),%esi
call   1040 <putc@plt>
add    $0x1,%rbx
movslq (%r15),%rax
cmp    %rax,%rbx
jl     11c0 <main+0x90>
mov    %r14,%rsp
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.main.domain = [27 x i8] c"2.0.0.127.rbl.maps.vix.com\00"
@PACKETSZ = global i32 0
@C_IN = global i32 0
@T_TXT = global i32 0
@h_errno = global i64 0
@stdout = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca [27 x i8]
%8 = alloca i8*
%9 = alloca i64
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = bitcast [27 x i8]* %7 to i8*
%12 = load i32, i32* @PACKETSZ
%13 = zext i32 %12 to i64
%14 = call i8* @llvm.stacksave()
store i8* %14, i8** %8
%15 = alloca i32, i64 %13
store i64 %13, i64* %9
%16 = call i32 (...) @res_init()
%17 = getelementptr inbounds [27 x i8], [27 x i8]* %7, i64 0, i64 0
%18 = load i32, i32* @C_IN
%19 = load i32, i32* @T_TXT
%20 = load i32, i32* @PACKETSZ
%21 = call i32 @res_query(i8* %17, i32 %18, i32 %19, i32* %15, i32 %20)
%22 = load i64, i64* @h_errno
%23 = icmp ne i64 %22, 0
br i1 %23, label %24, label %25
24: ; preds = %2
store i32 0, i32* %3
store i32 1, i32* %10
br label %41
25: ; preds = %2
store i32 0, i32* %6
br label %26
26: ; preds = %37, %25
%27 = load i32, i32* %6
%28 = load i32, i32* @PACKETSZ
%29 = icmp slt i32 %27, %28
br i1 %29, label %30, label %40
30: ; preds = %26
%31 = load i32, i32* %6
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i32, i32* %15, i64 %32
%34 = load i32, i32* %33
%35 = load i32, i32* @stdout
%36 = call i32 @putc(i32 %34, i32 %35)
br label %37
37: ; preds = %30
%38 = load i32, i32* %6
%39 = add nsw i32 %38, 1
store i32 %39, i32* %6
br label %26
40: ; preds = %26
store i32 0, i32* %3
store i32 1, i32* %10
br label %41
41: ; preds = %40, %24
%42 = load i8*, i8** %8
%43 = load i32, i32* %3
ret i32 %43
}

LLVM IR (-O2):
@__const.main.domain = [27 x i8] c"2.0.0.127.rbl.maps.vix.com\00"
@PACKETSZ = global i32 0
@C_IN = global i32 0
@T_TXT = global i32 0
@h_errno = global i64 0
@stdout = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [27 x i8]
%4 = getelementptr inbounds [27 x i8], [27 x i8]* %3, i64 0, i64 0
%5 = load i32, i32* @PACKETSZ
%6 = zext i32 %5 to i64
%7 = tail call i8* @llvm.stacksave()
%8 = alloca i32, i64 %6
%9 = tail call i32 (...) @res_init()
%10 = load i32, i32* @C_IN
%11 = load i32, i32* @T_TXT
%12 = load i32, i32* @PACKETSZ
%13 = call i32 @res_query(i8* %4, i32 %10, i32 %11, i32* %8, i32 %12)
%14 = load i64, i64* @h_errno
%15 = icmp eq i64 %14, 0
%16 = load i32, i32* @PACKETSZ
%17 = icmp sgt i32 %16, 0
%18 = select i1 %15, i1 %17, i1 false
br i1 %18, label %19, label %29
19: ; preds = %2, %19
%20 = phi i64 [ %25, %19 ], [ 0, %2 ]
%21 = getelementptr inbounds i32, i32* %8, i64 %20
%22 = load i32, i32* %21
%23 = load i32, i32* @stdout
%24 = call i32 @putc(i32 %22, i32 %23)
%25 = add nuw nsw i64 %20, 1
%26 = load i32, i32* @PACKETSZ
%27 = sext i32 %26 to i64
%28 = icmp slt i64 %25, %27
br i1 %28, label %19, label %29
29: ; preds = %19, %2
ret i32 0
}