#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*/ ntkresolv_safe_exit(int);
int /*<<< orphan*/ printf(char *, ...);
void service_and_proto_usage(char *arg) {
  if (arg)
    printf("Bad service/proto %s\n\n"
           "Use `ntk-resolv -s help` for more info on"
           " service and proto.\n",
           arg);
  else
    printf("ntk-resolv Service and Proto Help.\n\n"
           "The form to specify a service and a protocol are:\n"
           "  ntk-resolv -s service/proto\n"
           "  ntk-resolv -s service -p proto\n\n"
           "Valid protocols are:\n"
           " * tcp\n"
           "   udp\n\n"
           "Valid services are expressed in /etc/services.\n"
           "You can use numeric form too.\n\n"
           "As example, the next commands are equivalent and\n"
           "will return the IP of the hostname that offers\n"
           "webpages for the hostname \"some_hostname\":\n\n"
           "  ntk-resolv -s http -p tcp some_hostname\n"
           "  ntk-resolv -s http/tcp    some_hostname\n"
           "  ntk-resolv -s 80/tcp      some_hostname\n"
           "  ntk-resolv -s 80          some_hostname\n\n");
  ntkresolv_safe_exit(1);
}


x86 assembly (clang, -O0):
<service_and_proto_usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     114e <service_and_proto_usage+0x2e>
mov    -0x8(%rbp),%rsi
lea    0xebe(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    115c <service_and_proto_usage+0x3c>
lea    0xeff(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   1030 <ntkresolv_safe_exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<service_and_proto_usage>:
push   %rax
test   %rdi,%rdi
je     1149 <service_and_proto_usage+0x19>
mov    %rdi,%rsi
lea    0xec0(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    1155 <service_and_proto_usage+0x25>
lea    0xf04(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%edi
pop    %rax
jmp    1030 <ntkresolv_safe_exit@plt>

LLVM IR (-O0):
@.str = [84 x i8] c"Bad service/proto %s\0A\0AUse `ntk-resolv -s help` for more info on service and proto.\0A\00"
@.str.1 = [574 x i8] c"ntk-resolv Service and Proto Help.\0A\0AThe form to specify a service and a protocol are:\0A ntk-resolv -s service/proto\0A ntk-resolv -s service -p proto\0A\0AValid protocols are:\0A * tcp\0A udp\0A\0AValid services are expressed in /etc/services.\0AYou can use numeric form too.\0A\0AAs example, the next commands are equivalent and\0Awill return the IP of the hostname that offers\0Awebpages for the hostname \22some_hostname\22:\0A\0A ntk-resolv -s http -p tcp some_hostname\0A ntk-resolv -s http/tcp some_hostname\0A ntk-resolv -s 80/tcp some_hostname\0A ntk-resolv -s 80 some_hostname\0A\0A\00"
define void @service_and_proto_usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp ne i8* %3, null
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i8*, i8** %2
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([84 x i8], [84 x i8]* @.str, i64 0, i64 0), i8* %6)
br label %10
8: ; preds = %1
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([574 x i8], [574 x i8]* @.str.1, i64 0, i64 0))
br label %10
10: ; preds = %8, %5
%11 = call i32 @ntkresolv_safe_exit(i32 1)
ret void
}

LLVM IR (-O2):
@.str = [84 x i8] c"Bad service/proto %s\0A\0AUse `ntk-resolv -s help` for more info on service and proto.\0A\00"
@str = [573 x i8] c"ntk-resolv Service and Proto Help.\0A\0AThe form to specify a service and a protocol are:\0A ntk-resolv -s service/proto\0A ntk-resolv -s service -p proto\0A\0AValid protocols are:\0A * tcp\0A udp\0A\0AValid services are expressed in /etc/services.\0AYou can use numeric form too.\0A\0AAs example, the next commands are equivalent and\0Awill return the IP of the hostname that offers\0Awebpages for the hostname \22some_hostname\22:\0A\0A ntk-resolv -s http -p tcp some_hostname\0A ntk-resolv -s http/tcp some_hostname\0A ntk-resolv -s 80/tcp some_hostname\0A ntk-resolv -s 80 some_hostname\0A\00"
define void @service_and_proto_usage(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([84 x i8], [84 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %7
5: ; preds = %1
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([573 x i8], [573 x i8]* @str, i64 0, i64 0))
br label %7
7: ; preds = %5, %3
%8 = tail call i32 @ntkresolv_safe_exit(i32 1)
ret void
}