#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 EXIT_SUCCESS;
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int /*<<< orphan*/ checkEntryByValue(char *, int, char **);
int /*<<< orphan*/ checkEntryDatabase();
int /*<<< orphan*/ endprotoent();
int /*<<< orphan*/ *getprotobyname(char *);
int /*<<< orphan*/ puts(char *);
int main() {
  char *aliases[] = {"TCP"};
  checkEntryByValue("tcp", 6, aliases);
  aliases[0] = "UDP";
  checkEntryByValue("udp", 17, aliases);
  assert(getprotobyname("doomsday") == NULL);
  checkEntryDatabase();
  endprotoent();
  puts("success");
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2c9a(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    -0x10(%rbp),%rdx
lea    0xe7f(%rip),%rdi
mov    $0x6,%esi
call   1070 <checkEntryByValue@plt>
lea    0xe72(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    -0x10(%rbp),%rdx
lea    0xe67(%rip),%rdi
mov    $0x11,%esi
call   1070 <checkEntryByValue@plt>
lea    0xe5a(%rip),%rdi
call   1060 <getprotobyname@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    $0x0,%al
call   1080 <checkEntryDatabase@plt>
mov    $0x0,%al
call   1030 <endprotoent@plt>
lea    0xe38(%rip),%rdi
call   1040 <puts@plt>
mov    0x2df3(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xe94(%rip),%rax
mov    %rax,0x8(%rsp)
lea    0xe8c(%rip),%rdi
lea    0x8(%rsp),%rbx
mov    $0x6,%esi
mov    %rbx,%rdx
call   1070 <checkEntryByValue@plt>
lea    0xe77(%rip),%rax
mov    %rax,0x8(%rsp)
lea    0xe6f(%rip),%rdi
mov    $0x11,%esi
mov    %rbx,%rdx
call   1070 <checkEntryByValue@plt>
lea    0xe5f(%rip),%rdi
call   1060 <getprotobyname@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1050 <assert@plt>
xor    %eax,%eax
call   1080 <checkEntryDatabase@plt>
xor    %eax,%eax
call   1030 <endprotoent@plt>
lea    0xe40(%rip),%rdi
call   1040 <puts@plt>
mov    0x2dfb(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"TCP\00"
@__const.main.aliases = [1 x i8*] [i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0)]
@.str.1 = [4 x i8] c"tcp\00"
@.str.2 = [4 x i8] c"UDP\00"
@.str.3 = [4 x i8] c"udp\00"
@.str.4 = [9 x i8] c"doomsday\00"
@.str.5 = [8 x i8] c"success\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca [1 x i8*]
store i32 0, i32* %1
%3 = bitcast [1 x i8*]* %2 to i8*
%4 = getelementptr inbounds [1 x i8*], [1 x i8*]* %2, i64 0, i64 0
%5 = call i32 @checkEntryByValue(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 6, i8** %4)
%6 = getelementptr inbounds [1 x i8*], [1 x i8*]* %2, i64 0, i64 0
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8** %6
%7 = getelementptr inbounds [1 x i8*], [1 x i8*]* %2, i64 0, i64 0
%8 = call i32 @checkEntryByValue(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 17, i8** %7)
%9 = call i32* @getprotobyname(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
%10 = icmp eq i32* %9, null
%11 = zext i1 %10 to i32
%12 = call i32 @assert(i32 %11)
%13 = call i32 (...) @checkEntryDatabase()
%14 = call i32 (...) @endprotoent()
%15 = call i32 @puts(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0))
%16 = load i32, i32* @EXIT_SUCCESS
ret i32 %16
}

LLVM IR (-O2):
@.str = [4 x i8] c"TCP\00"
@.str.1 = [4 x i8] c"tcp\00"
@.str.2 = [4 x i8] c"UDP\00"
@.str.3 = [4 x i8] c"udp\00"
@.str.4 = [9 x i8] c"doomsday\00"
@.str.5 = [8 x i8] c"success\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca [1 x i8*]
%2 = bitcast [1 x i8*]* %1 to i8*
%3 = bitcast [1 x i8*]* %1 to i64*
store i64 ptrtoint ([4 x i8]* @.str to i64), i64* %3
%4 = getelementptr inbounds [1 x i8*], [1 x i8*]* %1, i64 0, i64 0
%5 = call i32 @checkEntryByValue(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 6, i8** %4)
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8** %4
%6 = call i32 @checkEntryByValue(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 17, i8** %4)
%7 = call i32* @getprotobyname(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
%8 = icmp eq i32* %7, null
%9 = zext i1 %8 to i32
%10 = call i32 @assert(i32 %9)
%11 = call i32 (...) @checkEntryDatabase()
%12 = call i32 (...) @endprotoent()
%13 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0))
%14 = load i32, i32* @EXIT_SUCCESS
ret i32 %14
}