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

/* Variables and functions */
int /*<<< orphan*/ ctime(int *);
int /*<<< orphan*/ errx(int, char *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int get_remote_info(char *, char *, char *, int *, char **);
int getopt(int, char **, char *);
char *optarg;
int optind;
int /*<<< orphan*/ printf(char *, char *, ...);
int /*<<< orphan*/ usage();
int /*<<< orphan*/ yp_get_default_domain(char **);
int yp_master(char *, char *, char **);
int yp_order(char *, char *, int *);
int /*<<< orphan*/ yperr_string(int);
int main(int argc, char *argv[]) {
  char *domainname, *hostname = NULL, *inmap, *master;
  int order, c, r;
  time_t torder;
  yp_get_default_domain(&domainname);
  while ((c = getopt(argc, argv, "h:d:")) != -1)
    switch (c) {
    case 'd':
      domainname = optarg;
      break;
    case 'h':
      hostname = optarg;
      break;
    default:
      usage();
    }
  if (optind + 1 != argc)
    usage();
  inmap = argv[optind];
  if (hostname != NULL) {
    r = get_remote_info(domainname, inmap, hostname, &order, &master);
  } else {
    r = yp_order(domainname, inmap, &order);
    if (r == 0)
      r = yp_master(domainname, inmap, &master);
  }
  if (r != 0)
    errx(1, "no such map %s: reason: %s", inmap, yperr_string(r));
  torder = order;
  printf("Map %s has order number %lld. %s", inmap, (long long)order,
         ctime(&torder));
  printf("The master server is %s.\n", master);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x20(%rbp)
lea    -0x18(%rbp),%rdi
call   1070 <yp_get_default_domain@plt>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe1b(%rip),%rdx
call   10c0 <getopt@plt>
mov    %eax,-0x38(%rbp)
cmp    $0xffffffff,%eax
je     124d <main+0x9d>
mov    -0x38(%rbp),%eax
mov    %eax,-0x44(%rbp)
sub    $0x64,%eax
je     121b <main+0x6b>
jmp    120a <main+0x5a>
mov    -0x44(%rbp),%eax
sub    $0x68,%eax
je     122e <main+0x7e>
jmp    1241 <main+0x91>
mov    0x2dd6(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
jmp    1248 <main+0x98>
mov    0x2dc3(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
jmp    1248 <main+0x98>
mov    $0x0,%al
call   1090 <usage@plt>
jmp    11d7 <main+0x27>
mov    0x2d8c(%rip),%rax
mov    (%rax),%eax
add    $0x1,%eax
cmp    -0x8(%rbp),%eax
je     1269 <main+0xb9>
mov    $0x0,%al
call   1090 <usage@plt>
mov    -0x10(%rbp),%rax
mov    0x2d6c(%rip),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     12ab <main+0xfb>
mov    -0x18(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x20(%rbp),%rdx
lea    -0x34(%rbp),%rcx
lea    -0x30(%rbp),%r8
call   10a0 <get_remote_info@plt>
mov    %eax,-0x3c(%rbp)
jmp    12e2 <main+0x132>
mov    -0x18(%rbp),%rdi
mov    -0x28(%rbp),%rsi
lea    -0x34(%rbp),%rdx
call   10b0 <yp_order@plt>
mov    %eax,-0x3c(%rbp)
cmpl   $0x0,-0x3c(%rbp)
jne    12dd <main+0x12d>
mov    -0x18(%rbp),%rdi
mov    -0x28(%rbp),%rsi
lea    -0x30(%rbp),%rdx
call   1030 <yp_master@plt>
mov    %eax,-0x3c(%rbp)
jmp    12e2 <main+0x132>
cmpl   $0x0,-0x3c(%rbp)
je     1313 <main+0x163>
mov    -0x28(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x3c(%rbp),%edi
call   1080 <yperr_string@plt>
mov    -0x50(%rbp),%rdx
mov    %eax,%ecx
mov    $0x1,%edi
lea    0xcf7(%rip),%rsi
call   1050 <errx@plt>
mov    -0x34(%rbp),%eax
mov    %eax,-0x40(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x60(%rbp)
movslq -0x34(%rbp),%rax
mov    %rax,-0x58(%rbp)
lea    -0x40(%rbp),%rdi
call   1040 <ctime@plt>
mov    -0x60(%rbp),%rsi
mov    -0x58(%rbp),%rdx
mov    %eax,%ecx
lea    0xcdd(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x30(%rbp),%rsi
lea    0xcec(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
xor    %edi,%edi
call   10d0 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x20,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0x8(%rsp),%rdi
call   1070 <yp_get_default_domain@plt>
lea    0xe2e(%rip),%r15
mov    0x2e1f(%rip),%r12
xor    %r14d,%r14d
jmp    11f0 <main+0x40>
mov    (%r12),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r15,%rdx
call   10c0 <getopt@plt>
cmp    $0x64,%eax
je     1220 <main+0x70>
cmp    $0x68,%eax
je     11de <main+0x2e>
cmp    $0xffffffff,%eax
je     122b <main+0x7b>
xor    %eax,%eax
call   1090 <usage@plt>
jmp    11f0 <main+0x40>
cs nopw 0x0(%rax,%rax,1)
nop
mov    (%r12),%rax
mov    %rax,0x8(%rsp)
jmp    11f0 <main+0x40>
mov    0x2dae(%rip),%r15
mov    (%r15),%eax
lea    0x1(%rax),%ecx
cmp    %ebp,%ecx
je     1246 <main+0x96>
xor    %eax,%eax
call   1090 <usage@plt>
mov    (%r15),%eax
cltq
mov    (%rbx,%rax,8),%rbx
mov    0x8(%rsp),%rdi
test   %r14,%r14
jne    127f <main+0xcf>
lea    0x4(%rsp),%rdx
mov    %rbx,%rsi
call   10b0 <yp_order@plt>
test   %eax,%eax
jne    1298 <main+0xe8>
mov    0x8(%rsp),%rdi
lea    0x18(%rsp),%rdx
mov    %rbx,%rsi
call   1030 <yp_master@plt>
test   %eax,%eax
jne    1298 <main+0xe8>
jmp    12b5 <main+0x105>
lea    0x4(%rsp),%rcx
lea    0x18(%rsp),%r8
mov    %rbx,%rsi
mov    %r14,%rdx
call   10a0 <get_remote_info@plt>
test   %eax,%eax
je     12b5 <main+0x105>
mov    %eax,%edi
call   1080 <yperr_string@plt>
lea    0xd5f(%rip),%rsi
mov    $0x1,%edi
mov    %rbx,%rdx
mov    %eax,%ecx
call   1050 <errx@plt>
movslq 0x4(%rsp),%rbp
mov    %ebp,0x14(%rsp)
lea    0x14(%rsp),%rdi
call   1040 <ctime@plt>
lea    0xd51(%rip),%rdi
mov    %rbx,%rsi
mov    %rbp,%rdx
mov    %eax,%ecx
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x18(%rsp),%rsi
lea    0xd57(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %edi,%edi
call   10d0 <exit@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"h:d:\00"
@optarg = global i8* null
@optind = global i32 0
@.str.1 = [27 x i8] c"no such map %s: reason: %s\00"
@.str.2 = [33 x i8] c"Map %s has order number %lld. %s\00"
@.str.3 = [26 x i8] c"The master server is %s.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* null, i8** %7
%14 = call i32 @yp_get_default_domain(i8** %6)
br label %15
15: ; preds = %28, %2
%16 = load i32, i32* %4
%17 = load i8**, i8*** %5
%18 = call i32 @getopt(i32 %16, i8** %17, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
store i32 %18, i32* %11
%19 = icmp ne i32 %18, -1
br i1 %19, label %20, label %29
20: ; preds = %15
%21 = load i32, i32* %11
switch i32 %21, label %26 [
i32 100, label %22
i32 104, label %24
]
22: ; preds = %20
%23 = load i8*, i8** @optarg
store i8* %23, i8** %6
br label %28
24: ; preds = %20
%25 = load i8*, i8** @optarg
store i8* %25, i8** %7
br label %28
26: ; preds = %20
%27 = call i32 (...) @usage()
br label %28
28: ; preds = %26, %24, %22
br label %15
29: ; preds = %15
%30 = load i32, i32* @optind
%31 = add nsw i32 %30, 1
%32 = load i32, i32* %4
%33 = icmp ne i32 %31, %32
br i1 %33, label %34, label %36
34: ; preds = %29
%35 = call i32 (...) @usage()
br label %36
36: ; preds = %34, %29
%37 = load i8**, i8*** %5
%38 = load i32, i32* @optind
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds i8*, i8** %37, i64 %39
%41 = load i8*, i8** %40
store i8* %41, i8** %8
%42 = load i8*, i8** %7
%43 = icmp ne i8* %42, null
br i1 %43, label %44, label %49
44: ; preds = %36
%45 = load i8*, i8** %6
%46 = load i8*, i8** %8
%47 = load i8*, i8** %7
%48 = call i32 @get_remote_info(i8* %45, i8* %46, i8* %47, i32* %10, i8** %9)
store i32 %48, i32* %12
br label %60
49: ; preds = %36
%50 = load i8*, i8** %6
%51 = load i8*, i8** %8
%52 = call i32 @yp_order(i8* %50, i8* %51, i32* %10)
store i32 %52, i32* %12
%53 = load i32, i32* %12
%54 = icmp eq i32 %53, 0
br i1 %54, label %55, label %59
55: ; preds = %49
%56 = load i8*, i8** %6
%57 = load i8*, i8** %8
%58 = call i32 @yp_master(i8* %56, i8* %57, i8** %9)
store i32 %58, i32* %12
br label %59
59: ; preds = %55, %49
br label %60
60: ; preds = %59, %44
%61 = load i32, i32* %12
%62 = icmp ne i32 %61, 0
br i1 %62, label %63, label %68
63: ; preds = %60
%64 = load i8*, i8** %8
%65 = load i32, i32* %12
%66 = call i32 @yperr_string(i32 %65)
%67 = call i32 @errx(i32 1, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8* %64, i32 %66)
br label %68
68: ; preds = %63, %60
%69 = load i32, i32* %10
store i32 %69, i32* %13
%70 = load i8*, i8** %8
%71 = load i32, i32* %10
%72 = sext i32 %71 to i64
%73 = call i32 @ctime(i32* %13)
%74 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0), i8* %70, i64 %72, i32 %73)
%75 = load i8*, i8** %9
%76 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), i8* %75)
%77 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [5 x i8] c"h:d:\00"
@optarg = global i8* null
@optind = global i32 0
@.str.1 = [27 x i8] c"no such map %s: reason: %s\00"
@.str.2 = [33 x i8] c"Map %s has order number %lld. %s\00"
@.str.3 = [26 x i8] c"The master server is %s.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = bitcast i8** %3 to i8*
%8 = bitcast i8** %4 to i8*
%9 = bitcast i32* %5 to i8*
%10 = bitcast i32* %6 to i8*
%11 = call i32 @yp_get_default_domain(i8** %3)
br label %12
12: ; preds = %18, %2
%13 = phi i8* [ %19, %18 ], [ null, %2 ]
br label %14
14: ; preds = %22, %12
%15 = call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
switch i32 %15, label %20 [
i32 -1, label %23
i32 100, label %16
i32 104, label %18
]
16: ; preds = %14
%17 = load i8*, i8** @optarg
store i8* %17, i8** %3
br label %22
18: ; preds = %14
%19 = load i8*, i8** @optarg
br label %12
20: ; preds = %14
%21 = call i32 (...) @usage()
br label %22
22: ; preds = %20, %16
br label %14
23: ; preds = %14
%24 = load i32, i32* @optind
%25 = add nsw i32 %24, 1
%26 = icmp eq i32 %25, %0
br i1 %26, label %30, label %27
27: ; preds = %23
%28 = call i32 (...) @usage()
%29 = load i32, i32* @optind
br label %30
30: ; preds = %27, %23
%31 = phi i32 [ %29, %27 ], [ %24, %23 ]
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i8*, i8** %1, i64 %32
%34 = load i8*, i8** %33
%35 = icmp eq i8* %13, null
%36 = load i8*, i8** %3
br i1 %35, label %39, label %37
37: ; preds = %30
%38 = call i32 @get_remote_info(i8* %36, i8* %34, i8* %13, i32* %5, i8** %4)
br label %45
39: ; preds = %30
%40 = call i32 @yp_order(i8* %36, i8* %34, i32* %5)
%41 = icmp eq i32 %40, 0
br i1 %41, label %42, label %48
42: ; preds = %39
%43 = load i8*, i8** %3
%44 = call i32 @yp_master(i8* %43, i8* %34, i8** %4)
br label %45
45: ; preds = %42, %37
%46 = phi i32 [ %38, %37 ], [ %44, %42 ]
%47 = icmp eq i32 %46, 0
br i1 %47, label %52, label %48
48: ; preds = %39, %45
%49 = phi i32 [ %46, %45 ], [ %40, %39 ]
%50 = call i32 @yperr_string(i32 %49)
%51 = call i32 @errx(i32 1, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8* %34, i32 %50)
br label %52
52: ; preds = %48, %45
%53 = load i32, i32* %5
store i32 %53, i32* %6
%54 = sext i32 %53 to i64
%55 = call i32 @ctime(i32* %6)
%56 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0), i8* %34, i64 %54, i32 %55)
%57 = load i8*, i8** %4
%58 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), i8* %57)
%59 = call i32 @exit(i32 0)
unreachable
}