#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 */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  int /*<<< orphan*/ s_addr;
};
struct sockaddr_in {
  int /*<<< orphan*/ sin_port;
  TYPE_1__ sin_addr;
  int /*<<< orphan*/ sin_family;
};
struct sockaddr {
  int dummy;
};
struct sigaction {
  int dummy;
};
struct servent {
  int /*<<< orphan*/ s_port;
};
typedef int /*<<< orphan*/ s_server;
typedef int /*<<< orphan*/ on;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ INADDR_ANY;
int /*<<< orphan*/ IPPROTO_TCP;
int /*<<< orphan*/ LOG_DAEMON;
int /*<<< orphan*/ LOG_ERR;
int /*<<< orphan*/ LOG_PID;
int /*<<< orphan*/ LOG_UPTO(int /*<<< orphan*/);
int /*<<< orphan*/ LOG_WARNING;
int /*<<< orphan*/ SOCK_STREAM;
int /*<<< orphan*/ SOL_SOCKET;
int /*<<< orphan*/ SO_REUSEADDR;
int /*<<< orphan*/ SyslogErrExit(char *, int, int);
int /*<<< orphan*/ SyslogMsgExit(char *, char *);
int bind(int, struct sockaddr *, int);
int /*<<< orphan*/ closelog();
int errno;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, int);
int getpid();
struct servent *getservbyname(char *, char *);
int /*<<< orphan*/ htonl(int /*<<< orphan*/);
int /*<<< orphan*/ htons(int);
int listen(int, int);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int ntohs(int /*<<< orphan*/);
int /*<<< orphan*/ openlog(char *, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ setlogmask(int /*<<< orphan*/);
int setsockopt(int, int /*<<< orphan*/, int /*<<< orphan*/, char *, int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ syslog(int /*<<< orphan*/, char *, int);
void SSTL_MasterSocketInit(int *port, int *master_sock) {
  struct servent *servent_ptr;
  int on = 1;
  struct sockaddr_in s_server;
  FILE *pid_file;
  struct sigaction act_CHLD;
  if ((servent_ptr = getservbyname("SSTL_d", "tcp"))) {
    *port = (ntohs(servent_ptr->s_port));
  } else {
    *port = 2075;
  }
  if ((*master_sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) == -1)
    SyslogErrExit("socket failed - errno %d\n", errno, -1);
  if ((setsockopt(*master_sock, SOL_SOCKET, SO_REUSEADDR, (char *)&on,
                  sizeof(on))) == -1)
    SyslogErrExit("socketopt failed - errno %d\n", errno, -1);
  memset((char *)&s_server, 0, sizeof(s_server));
  s_server.sin_family = AF_INET;
  s_server.sin_addr.s_addr = htonl(INADDR_ANY);
  s_server.sin_port = htons(*port);
  if (bind(*master_sock, (struct sockaddr *)&s_server, sizeof(s_server)) ==
      -1) {
    SyslogErrExit("can't bind to Blm_port %d - errno %d\n", *port, errno);
  }
  if (listen(*master_sock, 5) == -1)
    SyslogErrExit("listen failed - errno %d\n", errno, -1);
  pid_file = fopen("/tmp/SSTL_d_pid", "w");
  if (pid_file == NULL)
    SyslogMsgExit("can't write to file: %s\n", "/tmp/SSTL_d_pid");
  fprintf(pid_file, "%d\n", getpid());
  fclose(pid_file);
  openlog("SSTL_d", LOG_PID, LOG_DAEMON);
  setlogmask(LOG_UPTO(LOG_WARNING));
  syslog(LOG_ERR, "Listening at port %d\n", *port);
  closelog();
  printf("\n  SSLT_d started - listening at port %d\n\n", *port);
}


x86 assembly (clang, -O0):
<SSTL_MasterSocketInit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x1c(%rbp)
lea    0xd92(%rip),%rdi
lea    0xd92(%rip),%rsi
call   10a0 <getservbyname@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
je     12a0 <SSTL_MasterSocketInit+0x50>
mov    -0x18(%rbp),%rax
mov    (%rax),%edi
call   1120 <ntohs@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
jmp    12aa <SSTL_MasterSocketInit+0x5a>
mov    -0x8(%rbp),%rax
movl   $0x81b,(%rax)
mov    0x2d27(%rip),%rax
mov    (%rax),%edi
mov    0x2cee(%rip),%rax
mov    (%rax),%esi
mov    0x2d05(%rip),%rax
mov    (%rax),%edx
call   1170 <socket@plt>
mov    -0x10(%rbp),%rcx
mov    %eax,(%rcx)
cmp    $0xffffffff,%eax
jne    12f3 <SSTL_MasterSocketInit+0xa3>
mov    0x2cc0(%rip),%rax
mov    (%rax),%esi
lea    0xd22(%rip),%rdi
mov    $0xffffffff,%edx
call   10e0 <SyslogErrExit@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
mov    0x2ce8(%rip),%rax
mov    (%rax),%esi
mov    0x2c8f(%rip),%rax
mov    (%rax),%edx
lea    -0x1c(%rbp),%rcx
mov    $0x4,%r8d
call   1040 <setsockopt@plt>
cmp    $0xffffffff,%eax
jne    133d <SSTL_MasterSocketInit+0xed>
mov    0x2c76(%rip),%rax
mov    (%rax),%esi
lea    0xcf2(%rip),%rdi
mov    $0xffffffff,%edx
call   10e0 <SyslogErrExit@plt>
lea    -0x28(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   10c0 <memset@plt>
mov    0x2c84(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    0x2c70(%rip),%rax
mov    (%rax),%edi
call   10b0 <htonl@plt>
mov    %eax,-0x24(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
call   1080 <htons@plt>
mov    %eax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
lea    -0x28(%rbp),%rsi
mov    $0xc,%edx
call   1130 <bind@plt>
cmp    $0xffffffff,%eax
jne    13b0 <SSTL_MasterSocketInit+0x160>
mov    -0x8(%rbp),%rax
mov    (%rax),%esi
mov    0x2bfe(%rip),%rax
mov    (%rax),%edx
lea    0xc97(%rip),%rdi
call   10e0 <SyslogErrExit@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
mov    $0x5,%esi
call   1110 <listen@plt>
cmp    $0xffffffff,%eax
jne    13e3 <SSTL_MasterSocketInit+0x193>
mov    0x2bd0(%rip),%rax
mov    (%rax),%esi
lea    0xc8f(%rip),%rdi
mov    $0xffffffff,%edx
call   10e0 <SyslogErrExit@plt>
lea    0xc98(%rip),%rdi
lea    0xca1(%rip),%rsi
call   1140 <fopen@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    1418 <SSTL_MasterSocketInit+0x1c8>
lea    0xc88(%rip),%rdi
lea    0xc6f(%rip),%rsi
call   1160 <SyslogMsgExit@plt>
mov    -0x30(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    $0x0,%al
call   1050 <getpid@plt>
mov    -0x40(%rbp),%rdi
mov    %eax,%edx
lea    0xc30(%rip),%rsi
call   10d0 <fprintf@plt>
mov    -0x30(%rbp),%rdi
call   1070 <fclose@plt>
mov    0x2b67(%rip),%rax
mov    (%rax),%esi
mov    0x2b8e(%rip),%rax
mov    (%rax),%edx
lea    0xba5(%rip),%rdi
call   1150 <openlog@plt>
mov    0x2b59(%rip),%rax
mov    (%rax),%edi
call   1060 <LOG_UPTO@plt>
mov    %eax,%edi
call   10f0 <setlogmask@plt>
mov    0x2b0c(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rax
mov    (%rax),%edx
lea    0xc22(%rip),%rsi
call   1100 <syslog@plt>
mov    $0x0,%al
call   1030 <closelog@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%esi
lea    0xc1f(%rip),%rdi
call   1090 <printf@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SSTL_MasterSocketInit>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r15
mov    %rdi,%r14
movl   $0x1,0x4(%rsp)
lea    0xd90(%rip),%rdi
lea    0xd90(%rip),%rsi
call   10a0 <getservbyname@plt>
test   %rax,%rax
je     128a <SSTL_MasterSocketInit+0x3a>
mov    (%rax),%edi
call   1120 <ntohs@plt>
jmp    128f <SSTL_MasterSocketInit+0x3f>
mov    $0x81b,%eax
mov    %eax,(%r14)
mov    0x2d3f(%rip),%r12
mov    (%r12),%edi
mov    0x2d04(%rip),%rax
mov    (%rax),%esi
mov    0x2d1b(%rip),%rax
mov    (%rax),%edx
call   1170 <socket@plt>
mov    %eax,(%r15)
cmp    $0xffffffff,%eax
jne    12d9 <SSTL_MasterSocketInit+0x89>
mov    0x2cdd(%rip),%rax
mov    (%rax),%esi
lea    0xd3f(%rip),%rdi
mov    $0xffffffff,%edx
call   10e0 <SyslogErrExit@plt>
mov    (%r15),%eax
mov    0x2d08(%rip),%rcx
mov    (%rcx),%esi
mov    0x2caf(%rip),%rcx
mov    (%rcx),%edx
lea    0x4(%rsp),%rcx
mov    %eax,%edi
mov    $0x4,%r8d
call   1040 <setsockopt@plt>
cmp    $0xffffffff,%eax
jne    131c <SSTL_MasterSocketInit+0xcc>
mov    0x2c97(%rip),%rax
mov    (%rax),%esi
lea    0xd13(%rip),%rdi
mov    $0xffffffff,%edx
call   10e0 <SyslogErrExit@plt>
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   10c0 <memset@plt>
mov    (%r12),%eax
mov    %eax,0x10(%rsp)
mov    0x2c91(%rip),%rax
mov    (%rax),%edi
call   10b0 <htonl@plt>
mov    %eax,0xc(%rsp)
mov    (%r14),%edi
call   1080 <htons@plt>
mov    %eax,0x8(%rsp)
mov    (%r15),%edi
mov    %rbx,%rsi
mov    $0xc,%edx
call   1130 <bind@plt>
cmp    $0xffffffff,%eax
jne    1383 <SSTL_MasterSocketInit+0x133>
mov    (%r14),%esi
mov    0x2c2b(%rip),%rax
mov    (%rax),%edx
lea    0xcc4(%rip),%rdi
call   10e0 <SyslogErrExit@plt>
mov    (%r15),%edi
mov    $0x5,%esi
call   1110 <listen@plt>
cmp    $0xffffffff,%eax
jne    13af <SSTL_MasterSocketInit+0x15f>
mov    0x2c04(%rip),%rax
mov    (%rax),%esi
lea    0xcc3(%rip),%rdi
mov    $0xffffffff,%edx
call   10e0 <SyslogErrExit@plt>
lea    0xccc(%rip),%rdi
lea    0xcd5(%rip),%rsi
call   1140 <fopen@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    13dd <SSTL_MasterSocketInit+0x18d>
lea    0xcc3(%rip),%rdi
lea    0xcaa(%rip),%rsi
call   1160 <SyslogMsgExit@plt>
xor    %eax,%eax
call   1050 <getpid@plt>
lea    0xc79(%rip),%rsi
mov    %rbx,%rdi
mov    %eax,%edx
call   10d0 <fprintf@plt>
mov    %rbx,%rdi
call   1070 <fclose@plt>
mov    0x2bac(%rip),%rax
mov    (%rax),%esi
mov    0x2bd3(%rip),%rax
mov    (%rax),%edx
lea    0xbea(%rip),%rdi
call   1150 <openlog@plt>
mov    0x2b9e(%rip),%rax
mov    (%rax),%edi
call   1060 <LOG_UPTO@plt>
mov    %eax,%edi
call   10f0 <setlogmask@plt>
mov    0x2b51(%rip),%rax
mov    (%rax),%edi
mov    (%r14),%edx
lea    0xc6a(%rip),%rsi
call   1100 <syslog@plt>
xor    %eax,%eax
call   1030 <closelog@plt>
mov    (%r14),%esi
lea    0xc6a(%rip),%rdi
call   1090 <printf@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.servent = type { i32 }
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sigaction = type { i32 }
%struct.sockaddr = type { i32 }
@.str = [7 x i8] c"SSTL_d\00"
@.str.1 = [4 x i8] c"tcp\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@IPPROTO_TCP = global i32 0
@.str.2 = [26 x i8] c"socket failed - errno %d\0A\00"
@errno = global i32 0
@SOL_SOCKET = global i32 0
@SO_REUSEADDR = global i32 0
@.str.3 = [29 x i8] c"socketopt failed - errno %d\0A\00"
@INADDR_ANY = global i32 0
@.str.4 = [38 x i8] c"can't bind to Blm_port %d - errno %d\0A\00"
@.str.5 = [26 x i8] c"listen failed - errno %d\0A\00"
@.str.6 = [16 x i8] c"/tmp/SSTL_d_pid\00"
@.str.7 = [2 x i8] c"w\00"
@.str.8 = [25 x i8] c"can't write to file: %s\0A\00"
@.str.9 = [4 x i8] c"%d\0A\00"
@LOG_PID = global i32 0
@LOG_DAEMON = global i32 0
@LOG_WARNING = global i32 0
@LOG_ERR = global i32 0
@.str.10 = [22 x i8] c"Listening at port %d\0A\00"
@.str.11 = [43 x i8] c"\0A SSLT_d started - listening at port %d\0A\0A\00"
define void @SSTL_MasterSocketInit(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca %struct.servent*
%6 = alloca i32
%7 = alloca %struct.sockaddr_in
%8 = alloca i32*
%9 = alloca %struct.sigaction
store i32* %0, i32** %3
store i32* %1, i32** %4
store i32 1, i32* %6
%10 = call %struct.servent* @getservbyname(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
store %struct.servent* %10, %struct.servent** %5
%11 = icmp ne %struct.servent* %10, null
br i1 %11, label %12, label %18
12: ; preds = %2
%13 = load %struct.servent*, %struct.servent** %5
%14 = getelementptr inbounds %struct.servent, %struct.servent* %13, i32 0, i32 0
%15 = load i32, i32* %14
%16 = call i32 @ntohs(i32 %15)
%17 = load i32*, i32** %3
store i32 %16, i32* %17
br label %20
18: ; preds = %2
%19 = load i32*, i32** %3
store i32 2075, i32* %19
br label %20
20: ; preds = %18, %12
%21 = load i32, i32* @AF_INET
%22 = load i32, i32* @SOCK_STREAM
%23 = load i32, i32* @IPPROTO_TCP
%24 = call i32 @socket(i32 %21, i32 %22, i32 %23)
%25 = load i32*, i32** %4
store i32 %24, i32* %25
%26 = icmp eq i32 %24, -1
br i1 %26, label %27, label %30
27: ; preds = %20
%28 = load i32, i32* @errno
%29 = call i32 @SyslogErrExit(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i32 %28, i32 -1)
br label %30
30: ; preds = %27, %20
%31 = load i32*, i32** %4
%32 = load i32, i32* %31
%33 = load i32, i32* @SOL_SOCKET
%34 = load i32, i32* @SO_REUSEADDR
%35 = bitcast i32* %6 to i8*
%36 = call i32 @setsockopt(i32 %32, i32 %33, i32 %34, i8* %35, i32 4)
%37 = icmp eq i32 %36, -1
br i1 %37, label %38, label %41
38: ; preds = %30
%39 = load i32, i32* @errno
%40 = call i32 @SyslogErrExit(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0), i32 %39, i32 -1)
br label %41
41: ; preds = %38, %30
%42 = bitcast %struct.sockaddr_in* %7 to i8*
%43 = call i32 @memset(i8* %42, i32 0, i32 12)
%44 = load i32, i32* @AF_INET
%45 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %7, i32 0, i32 2
store i32 %44, i32* %45
%46 = load i32, i32* @INADDR_ANY
%47 = call i32 @htonl(i32 %46)
%48 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %7, i32 0, i32 1
%49 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %48, i32 0, i32 0
store i32 %47, i32* %49
%50 = load i32*, i32** %3
%51 = load i32, i32* %50
%52 = call i32 @htons(i32 %51)
%53 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %7, i32 0, i32 0
store i32 %52, i32* %53
%54 = load i32*, i32** %4
%55 = load i32, i32* %54
%56 = bitcast %struct.sockaddr_in* %7 to %struct.sockaddr*
%57 = call i32 @bind(i32 %55, %struct.sockaddr* %56, i32 12)
%58 = icmp eq i32 %57, -1
br i1 %58, label %59, label %64
59: ; preds = %41
%60 = load i32*, i32** %3
%61 = load i32, i32* %60
%62 = load i32, i32* @errno
%63 = call i32 @SyslogErrExit(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.4, i64 0, i64 0), i32 %61, i32 %62)
br label %64
64: ; preds = %59, %41
%65 = load i32*, i32** %4
%66 = load i32, i32* %65
%67 = call i32 @listen(i32 %66, i32 5)
%68 = icmp eq i32 %67, -1
br i1 %68, label %69, label %72
69: ; preds = %64
%70 = load i32, i32* @errno
%71 = call i32 @SyslogErrExit(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0), i32 %70, i32 -1)
br label %72
72: ; preds = %69, %64
%73 = call i32* @fopen(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
store i32* %73, i32** %8
%74 = load i32*, i32** %8
%75 = icmp eq i32* %74, null
br i1 %75, label %76, label %78
76: ; preds = %72
%77 = call i32 @SyslogMsgExit(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0))
br label %78
78: ; preds = %76, %72
%79 = load i32*, i32** %8
%80 = call i32 (...) @getpid()
%81 = call i32 @fprintf(i32* %79, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i32 %80)
%82 = load i32*, i32** %8
%83 = call i32 @fclose(i32* %82)
%84 = load i32, i32* @LOG_PID
%85 = load i32, i32* @LOG_DAEMON
%86 = call i32 @openlog(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %84, i32 %85)
%87 = load i32, i32* @LOG_WARNING
%88 = call i32 @LOG_UPTO(i32 %87)
%89 = call i32 @setlogmask(i32 %88)
%90 = load i32, i32* @LOG_ERR
%91 = load i32*, i32** %3
%92 = load i32, i32* %91
%93 = call i32 @syslog(i32 %90, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.10, i64 0, i64 0), i32 %92)
%94 = call i32 (...) @closelog()
%95 = load i32*, i32** %3
%96 = load i32, i32* %95
%97 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.11, i64 0, i64 0), i32 %96)
ret void
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.servent = type { i32 }
%struct.sockaddr = type { i32 }
@.str = [7 x i8] c"SSTL_d\00"
@.str.1 = [4 x i8] c"tcp\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@IPPROTO_TCP = global i32 0
@.str.2 = [26 x i8] c"socket failed - errno %d\0A\00"
@errno = global i32 0
@SOL_SOCKET = global i32 0
@SO_REUSEADDR = global i32 0
@.str.3 = [29 x i8] c"socketopt failed - errno %d\0A\00"
@INADDR_ANY = global i32 0
@.str.4 = [38 x i8] c"can't bind to Blm_port %d - errno %d\0A\00"
@.str.5 = [26 x i8] c"listen failed - errno %d\0A\00"
@.str.6 = [16 x i8] c"/tmp/SSTL_d_pid\00"
@.str.7 = [2 x i8] c"w\00"
@.str.8 = [25 x i8] c"can't write to file: %s\0A\00"
@.str.9 = [4 x i8] c"%d\0A\00"
@LOG_PID = global i32 0
@LOG_DAEMON = global i32 0
@LOG_WARNING = global i32 0
@LOG_ERR = global i32 0
@.str.10 = [22 x i8] c"Listening at port %d\0A\00"
@.str.11 = [43 x i8] c"\0A SSLT_d started - listening at port %d\0A\0A\00"
define void @SSTL_MasterSocketInit(i32* nocapture %0, i32* nocapture %1) {
%3 = alloca i32
%4 = alloca %struct.sockaddr_in
%5 = bitcast i32* %3 to i8*
store i32 1, i32* %3
%6 = bitcast %struct.sockaddr_in* %4 to i8*
%7 = tail call %struct.servent* @getservbyname(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%8 = icmp eq %struct.servent* %7, null
br i1 %8, label %13, label %9
9: ; preds = %2
%10 = getelementptr inbounds %struct.servent, %struct.servent* %7, i64 0, i32 0
%11 = load i32, i32* %10
%12 = tail call i32 @ntohs(i32 %11)
br label %13
13: ; preds = %2, %9
%14 = phi i32 [ %12, %9 ], [ 2075, %2 ]
store i32 %14, i32* %0
%15 = load i32, i32* @AF_INET
%16 = load i32, i32* @SOCK_STREAM
%17 = load i32, i32* @IPPROTO_TCP
%18 = tail call i32 @socket(i32 %15, i32 %16, i32 %17)
store i32 %18, i32* %1
%19 = icmp eq i32 %18, -1
br i1 %19, label %20, label %24
20: ; preds = %13
%21 = load i32, i32* @errno
%22 = tail call i32 @SyslogErrExit(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i32 %21, i32 -1)
%23 = load i32, i32* %1
br label %24
24: ; preds = %20, %13
%25 = phi i32 [ %23, %20 ], [ %18, %13 ]
%26 = load i32, i32* @SOL_SOCKET
%27 = load i32, i32* @SO_REUSEADDR
%28 = call i32 @setsockopt(i32 %25, i32 %26, i32 %27, i8* %5, i32 4)
%29 = icmp eq i32 %28, -1
br i1 %29, label %30, label %33
30: ; preds = %24
%31 = load i32, i32* @errno
%32 = call i32 @SyslogErrExit(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0), i32 %31, i32 -1)
br label %33
33: ; preds = %30, %24
%34 = call i32 @memset(i8* %6, i32 0, i32 12)
%35 = load i32, i32* @AF_INET
%36 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 2
store i32 %35, i32* %36
%37 = load i32, i32* @INADDR_ANY
%38 = call i32 @htonl(i32 %37)
%39 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 1, i32 0
store i32 %38, i32* %39
%40 = load i32, i32* %0
%41 = call i32 @htons(i32 %40)
%42 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 0
store i32 %41, i32* %42
%43 = load i32, i32* %1
%44 = bitcast %struct.sockaddr_in* %4 to %struct.sockaddr*
%45 = call i32 @bind(i32 %43, %struct.sockaddr* %44, i32 12)
%46 = icmp eq i32 %45, -1
br i1 %46, label %47, label %51
47: ; preds = %33
%48 = load i32, i32* %0
%49 = load i32, i32* @errno
%50 = call i32 @SyslogErrExit(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.4, i64 0, i64 0), i32 %48, i32 %49)
br label %51
51: ; preds = %47, %33
%52 = load i32, i32* %1
%53 = call i32 @listen(i32 %52, i32 5)
%54 = icmp eq i32 %53, -1
br i1 %54, label %55, label %58
55: ; preds = %51
%56 = load i32, i32* @errno
%57 = call i32 @SyslogErrExit(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0), i32 %56, i32 -1)
br label %58
58: ; preds = %55, %51
%59 = call i32* @fopen(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%60 = icmp eq i32* %59, null
br i1 %60, label %61, label %63
61: ; preds = %58
%62 = call i32 @SyslogMsgExit(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0))
br label %63
63: ; preds = %61, %58
%64 = call i32 (...) @getpid()
%65 = call i32 @fprintf(i32* %59, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i32 %64)
%66 = call i32 @fclose(i32* %59)
%67 = load i32, i32* @LOG_PID
%68 = load i32, i32* @LOG_DAEMON
%69 = call i32 @openlog(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %67, i32 %68)
%70 = load i32, i32* @LOG_WARNING
%71 = call i32 @LOG_UPTO(i32 %70)
%72 = call i32 @setlogmask(i32 %71)
%73 = load i32, i32* @LOG_ERR
%74 = load i32, i32* %0
%75 = call i32 @syslog(i32 %73, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.10, i64 0, i64 0), i32 %74)
%76 = call i32 (...) @closelog()
%77 = load i32, i32* %0
%78 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.11, i64 0, i64 0), i32 %77)
ret void
}