#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 in_addr_t;

/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int host_resolv(char *);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  in_addr_t addr = -1;
  if (argc <= 1) {
    printf("%s\n", "Input hostname!");
    exit(0);
  }
  addr = host_resolv(argv[1]);
  printf("%d.%d.%d.%d (%d)\n", (addr & 0x000000ff), (addr & 0x0000ff00) >> 8,
         (addr & 0x00ff0000) >> 16, (addr & 0xff000000) >> 24, addr);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0xffffffff,-0x14(%rbp)
cmpl   $0x1,-0x8(%rbp)
jg     1173 <main+0x43>
lea    0xea2(%rip),%rdi
lea    0xe9f(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %edi,%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <host_resolv@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
and    $0xff,%esi
mov    -0x14(%rbp),%edx
and    $0xff00,%edx
sar    $0x8,%edx
mov    -0x14(%rbp),%ecx
and    $0xff0000,%ecx
sar    $0x10,%ecx
mov    -0x14(%rbp),%r8d
and    $0xff000000,%r8d
shr    $0x18,%r8d
mov    -0x14(%rbp),%r9d
lea    0xe56(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
cmp    $0x1,%edi
jle    117a <main+0x3a>
mov    0x8(%rsi),%rdi
call   1050 <host_resolv@plt>
movzbl %al,%esi
movzbl %ah,%edx
mov    %eax,%ecx
shr    $0x10,%ecx
movzbl %cl,%ecx
mov    %eax,%ebx
shr    $0x18,%ebx
lea    0xea7(%rip),%rdi
mov    %ebx,%r8d
mov    %eax,%r9d
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret
lea    0xe7f(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [16 x i8] c"Input hostname!\00"
@.str.2 = [18 x i8] c"%d.%d.%d.%d (%d)\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 -1, i32* %6
%7 = load i32, i32* %4
%8 = icmp sle i32 %7, 1
br i1 %8, label %9, label %12
9: ; preds = %2
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%11 = call i32 @exit(i32 0)
unreachable
12: ; preds = %2
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
%16 = call i32 @host_resolv(i8* %15)
store i32 %16, i32* %6
%17 = load i32, i32* %6
%18 = and i32 %17, 255
%19 = load i32, i32* %6
%20 = and i32 %19, 65280
%21 = ashr i32 %20, 8
%22 = load i32, i32* %6
%23 = and i32 %22, 16711680
%24 = ashr i32 %23, 16
%25 = load i32, i32* %6
%26 = and i32 %25, -16777216
%27 = lshr i32 %26, 24
%28 = load i32, i32* %6
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 %18, i32 %21, i32 %24, i32 %27, i32 %28)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [16 x i8] c"Input hostname!\00"
@.str.2 = [18 x i8] c"%d.%d.%d.%d (%d)\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i32 @exit(i32 0)
unreachable
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = tail call i32 @host_resolv(i8* %9)
%11 = and i32 %10, 255
%12 = lshr i32 %10, 8
%13 = and i32 %12, 255
%14 = lshr i32 %10, 16
%15 = and i32 %14, 255
%16 = lshr i32 %10, 24
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 %11, i32 %13, i32 %15, i32 %16, i32 %10)
ret i32 0
}