#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*/ allhosts();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int getopt(int, char **, char *);
int /*<<< orphan*/ onehost(char *);
int optind;
int /*<<< orphan*/ setlinebuf(int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ usage();
int main(int argc, char *argv[]) {
  int ch;
  while ((ch = getopt(argc, argv, "?")) != -1)
    switch (ch) {
    default:
      usage();
    }
  setlinebuf(stdout);
  if (argc == optind)
    allhosts();
  else {
    for (; optind < argc; optind++)
      (void)onehost(argv[optind]);
  }
  exit(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),%edi
mov    -0x10(%rbp),%rsi
lea    0xe7c(%rip),%rdx
call   1070 <getopt@plt>
mov    %eax,-0x14(%rbp)
cmp    $0xffffffff,%eax
je     11a1 <main+0x41>
mov    $0x0,%al
call   1060 <usage@plt>
jmp    1176 <main+0x16>
mov    0x2e30(%rip),%rax
mov    (%rax),%edi
call   1040 <setlinebuf@plt>
mov    -0x8(%rbp),%eax
mov    0x2e2f(%rip),%rcx
cmp    (%rcx),%eax
jne    11cd <main+0x6d>
mov    $0x0,%al
call   1050 <allhosts@plt>
jmp    121a <main+0xba>
jmp    11d2 <main+0x72>
mov    0x2e0f(%rip),%rax
mov    (%rax),%eax
cmp    -0x8(%rbp),%eax
jge    1215 <main+0xb5>
mov    -0x10(%rbp),%rax
mov    0x2df9(%rip),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <onehost@plt>
mov    0x2de6(%rip),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    0x2dda(%rip),%rax
mov    %ecx,(%rax)
jmp    11d2 <main+0x72>
jmp    121a <main+0xba>
xor    %edi,%edi
call   1080 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xe90(%rip),%rdx
call   1070 <getopt@plt>
cmp    $0xffffffff,%eax
je     11a9 <main+0x49>
lea    0xe7f(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1060 <usage@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1070 <getopt@plt>
cmp    $0xffffffff,%eax
jne    1190 <main+0x30>
mov    0x2e28(%rip),%rax
mov    (%rax),%edi
call   1040 <setlinebuf@plt>
mov    0x2e2a(%rip),%r14
mov    (%r14),%eax
cmp    %ebp,%eax
jne    11d3 <main+0x73>
xor    %eax,%eax
call   1050 <allhosts@plt>
xor    %edi,%edi
call   1080 <exit@plt>
jge    11f8 <main+0x98>
cs nopw 0x0(%rax,%rax,1)
nop
cltq
mov    (%rbx,%rax,8),%rdi
call   1030 <onehost@plt>
mov    (%r14),%eax
add    $0x1,%eax
mov    %eax,(%r14)
cmp    %ebp,%eax
jl     11e0 <main+0x80>
xor    %edi,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"?\00"
@stdout = global i32 0
@optind = global i32 0
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
br label %7
7: ; preds = %16, %2
%8 = load i32, i32* %4
%9 = load i8**, i8*** %5
%10 = call i32 @getopt(i32 %8, i8** %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32 %10, i32* %6
%11 = icmp ne i32 %10, -1
br i1 %11, label %12, label %17
12: ; preds = %7
%13 = load i32, i32* %6
switch i32 %13, label %14 [
]
14: ; preds = %12
%15 = call i32 (...) @usage()
br label %16
16: ; preds = %14
br label %7
17: ; preds = %7
%18 = load i32, i32* @stdout
%19 = call i32 @setlinebuf(i32 %18)
%20 = load i32, i32* %4
%21 = load i32, i32* @optind
%22 = icmp eq i32 %20, %21
br i1 %22, label %23, label %25
23: ; preds = %17
%24 = call i32 (...) @allhosts()
br label %41
25: ; preds = %17
br label %26
26: ; preds = %37, %25
%27 = load i32, i32* @optind
%28 = load i32, i32* %4
%29 = icmp slt i32 %27, %28
br i1 %29, label %30, label %40
30: ; preds = %26
%31 = load i8**, i8*** %5
%32 = load i32, i32* @optind
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i8*, i8** %31, i64 %33
%35 = load i8*, i8** %34
%36 = call i32 @onehost(i8* %35)
br label %37
37: ; preds = %30
%38 = load i32, i32* @optind
%39 = add nsw i32 %38, 1
store i32 %39, i32* @optind
br label %26
40: ; preds = %26
br label %41
41: ; preds = %40, %23
%42 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [2 x i8] c"?\00"
@stdout = global i32 0
@optind = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i32 %3, -1
br i1 %4, label %9, label %5
5: ; preds = %2, %5
%6 = tail call i32 (...) @usage()
%7 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i32 %7, -1
br i1 %8, label %9, label %5
9: ; preds = %5, %2
%10 = load i32, i32* @stdout
%11 = tail call i32 @setlinebuf(i32 %10)
%12 = load i32, i32* @optind
%13 = icmp eq i32 %12, %0
br i1 %13, label %16, label %14
14: ; preds = %9
%15 = icmp slt i32 %12, %0
br i1 %15, label %18, label %27
16: ; preds = %9
%17 = tail call i32 (...) @allhosts()
br label %27
18: ; preds = %14, %18
%19 = phi i32 [ %25, %18 ], [ %12, %14 ]
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8*, i8** %1, i64 %20
%22 = load i8*, i8** %21
%23 = tail call i32 @onehost(i8* %22)
%24 = load i32, i32* @optind
%25 = add nsw i32 %24, 1
store i32 %25, i32* @optind
%26 = icmp slt i32 %25, %0
br i1 %26, label %18, label %27
27: ; preds = %18, %14, %16
%28 = tail call i32 @exit(i32 0)
unreachable
}