#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 */
char *RepGetHost(char *, char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stderr;
int main(int argc, char *argv[]) {
  char *Host;
  int i;
  if ((argc % 2) != 1) {
    fprintf(stderr, "Usage: %s type filename [type filename [...]]\n", argv[0]);
    exit(-1);
  }
  for (i = 1; i < argc; i += 2) {
    Host = RepGetHost(argv[i], argv[i + 1]);
    if (!Host)
      printf("localhost\n");
    else {
      printf("%s\n", Host);
      free(Host);
    }
  }
  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)
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x1,%edx
je     11a0 <main+0x50>
mov    0x2e5f(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe6f(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0xffffffff,%edi
call   1070 <exit@plt>
movl   $0x1,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1225 <main+0xd5>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x10(%rbp),%rax
mov    -0x1c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rsi
call   1060 <RepGetHost@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    11f7 <main+0xa7>
lea    0xe44(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1212 <main+0xc2>
mov    -0x18(%rbp),%rsi
lea    0xe38(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
jmp    1217 <main+0xc7>
mov    -0x1c(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x1c(%rbp)
jmp    11a7 <main+0x57>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rsi,%r15
mov    %edi,%eax
shr    $0x1f,%eax
add    %edi,%eax
and    $0xfffffffe,%eax
mov    %edi,%ecx
sub    %eax,%ecx
cmp    $0x1,%ecx
jne    11d5 <main+0x85>
cmp    $0x2,%edi
jl     11c9 <main+0x79>
mov    %edi,%r12d
mov    $0x1,%ebx
lea    0xeac(%rip),%r14
jmp    11ac <main+0x5c>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rax,%r13
mov    %rax,%rdi
call   1040 <puts@plt>
mov    %r13,%rdi
call   1030 <free@plt>
add    $0x2,%rbx
cmp    %r12,%rbx
jae    11c9 <main+0x79>
mov    (%r15,%rbx,8),%rdi
mov    0x8(%r15,%rbx,8),%rsi
call   1060 <RepGetHost@plt>
test   %rax,%rax
jne    1190 <main+0x40>
mov    %r14,%rdi
call   1040 <puts@plt>
jmp    11a3 <main+0x53>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret
mov    0x2e04(%rip),%rax
mov    (%rax),%edi
mov    (%r15),%rdx
lea    0xe18(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0xffffffff,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [47 x i8] c"Usage: %s type filename [type filename [...]]\0A\00"
@.str.1 = [11 x i8] c"localhost\0A\00"
@.str.2 = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = srem i32 %8, 2
%10 = icmp ne i32 %9, 1
br i1 %10, label %11, label %18
11: ; preds = %2
%12 = load i32, i32* @stderr
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 0
%15 = load i8*, i8** %14
%16 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), i8* %15)
%17 = call i32 @exit(i32 -1)
unreachable
18: ; preds = %2
store i32 1, i32* %7
br label %19
19: ; preds = %46, %18
%20 = load i32, i32* %7
%21 = load i32, i32* %4
%22 = icmp slt i32 %20, %21
br i1 %22, label %23, label %49
23: ; preds = %19
%24 = load i8**, i8*** %5
%25 = load i32, i32* %7
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8*, i8** %24, i64 %26
%28 = load i8*, i8** %27
%29 = load i8**, i8*** %5
%30 = load i32, i32* %7
%31 = add nsw i32 %30, 1
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i8*, i8** %29, i64 %32
%34 = load i8*, i8** %33
%35 = call i8* @RepGetHost(i8* %28, i8* %34)
store i8* %35, i8** %6
%36 = load i8*, i8** %6
%37 = icmp ne i8* %36, null
br i1 %37, label %40, label %38
38: ; preds = %23
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
br label %45
40: ; preds = %23
%41 = load i8*, i8** %6
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %41)
%43 = load i8*, i8** %6
%44 = call i32 @free(i8* %43)
br label %45
45: ; preds = %40, %38
br label %46
46: ; preds = %45
%47 = load i32, i32* %7
%48 = add nsw i32 %47, 2
store i32 %48, i32* %7
br label %19
49: ; preds = %19
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [47 x i8] c"Usage: %s type filename [type filename [...]]\0A\00"
@str = [10 x i8] c"localhost\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = srem i32 %0, 2
%4 = icmp eq i32 %3, 1
br i1 %4, label %5, label %9
5: ; preds = %2
%6 = icmp sgt i32 %0, 1
br i1 %6, label %7, label %31
7: ; preds = %5
%8 = zext i32 %0 to i64
br label %14
9: ; preds = %2
%10 = load i32, i32* @stderr
%11 = load i8*, i8** %1
%12 = tail call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), i8* %11)
%13 = tail call i32 @exit(i32 -1)
unreachable
14: ; preds = %7, %28
%15 = phi i64 [ 1, %7 ], [ %29, %28 ]
%16 = getelementptr inbounds i8*, i8** %1, i64 %15
%17 = load i8*, i8** %16
%18 = add nuw nsw i64 %15, 1
%19 = getelementptr inbounds i8*, i8** %1, i64 %18
%20 = load i8*, i8** %19
%21 = tail call i8* @RepGetHost(i8* %17, i8* %20)
%22 = icmp eq i8* %21, null
br i1 %22, label %23, label %25
23: ; preds = %14
%24 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str, i64 0, i64 0))
br label %28
25: ; preds = %14
%26 = tail call i32 @puts(i8* %21)
%27 = tail call i32 @free(i8* %21)
br label %28
28: ; preds = %23, %25
%29 = add nuw nsw i64 %15, 2
%30 = icmp ult i64 %29, %8
br i1 %30, label %14, label %31
31: ; preds = %28, %5
ret i32 0
}