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

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int getftpname(char *, char *, unsigned char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ usage(char *);
int main(int argc, char *argv[]) {
  char dnsname[1024];
  unsigned char addr[4];
  if (argc < 2) {
    usage(argv[0]);
    exit(1);
  }
  if (getftpname(argv[1], dnsname, addr) == 3)
    printf("%s\n", dnsname);
  else
    printf("\n");
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x420,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    1179 <main+0x39>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1050 <usage@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    -0x410(%rbp),%rsi
lea    -0x414(%rbp),%rdx
call   1030 <getftpname@plt>
cmp    $0x3,%eax
jne    11b7 <main+0x77>
lea    -0x410(%rbp),%rsi
lea    0xe55(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11c5 <main+0x85>
lea    0xe44(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x418,%rsp
cmp    $0x1,%edi
jle    1194 <main+0x44>
mov    0x8(%rsi),%rdi
lea    0x10(%rsp),%rsi
lea    0xc(%rsp),%rdx
call   1050 <getftpname@plt>
cmp    $0x3,%eax
jne    1180 <main+0x30>
lea    0x10(%rsp),%rdi
call   1040 <puts@plt>
jmp    118a <main+0x3a>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x418,%rsp
ret
mov    (%rsi),%rdi
call   1060 <usage@plt>
mov    $0x1,%edi
call   1070 <exit@plt>

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [1024 x i8]
%4 = alloca [4 x i8]
%5 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [4 x i8], [4 x i8]* %4, i64 0, i64 0
%7 = icmp slt i32 %0, 2
br i1 %7, label %8, label %12
8: ; preds = %2
%9 = load i8*, i8** %1
%10 = tail call i32 @usage(i8* %9)
%11 = tail call i32 @exit(i32 1)
unreachable
12: ; preds = %2
%13 = getelementptr inbounds i8*, i8** %1, i64 1
%14 = load i8*, i8** %13
%15 = call i32 @getftpname(i8* %14, i8* %5, i8* %6)
%16 = icmp eq i32 %15, 3
br i1 %16, label %17, label %19
17: ; preds = %12
%18 = call i32 @puts(i8* %5)
br label %21
19: ; preds = %12
%20 = call i32 @putchar(i32 10)
br label %21
21: ; preds = %19, %17
ret i32 0
}