#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_zero;
  TYPE_1__ sin_addr;
  int /*<<< orphan*/ sin_port;
  int /*<<< orphan*/ sin_family;
};
struct sockaddr {
  int dummy;
};
typedef int socklen_t;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ SOCK_STREAM;
int /*<<< orphan*/ close(int);
int connect(int, struct sockaddr *, int);
int /*<<< orphan*/ htons(int);
int /*<<< orphan*/ inet_addr(char *);
int /*<<< orphan*/ memset(int /*<<< orphan*/, char, int);
int /*<<< orphan*/ printf(char *, char *, ...);
int /*<<< orphan*/ send(int, char *, int, int /*<<< orphan*/);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ sprintf(char *, char *, int);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int registerDep(char *server, int serverport, int num_interfaces,
                char **interfaces, int type) {
  int depSocket;
  char buffer[1024], num_int[5];
  struct sockaddr_in serverAddr;
  socklen_t addr_size;
  if (1)
    printf("Connectiong to %s:%d\n", server, serverport);
  depSocket = socket(AF_INET, SOCK_STREAM, 0);
  serverAddr.sin_family = AF_INET;
  serverAddr.sin_port = htons(serverport);
  serverAddr.sin_addr.s_addr = inet_addr(server);
  memset(serverAddr.sin_zero, '\0', sizeof serverAddr.sin_zero);
  addr_size = sizeof serverAddr;
  int result = connect(depSocket, (struct sockaddr *)&serverAddr, addr_size);
  strcpy(buffer, "inp ");
  if (type == 1)
    strcat(buffer, "device,");
  else
    strcat(buffer, "node,");
  sprintf(num_int, "%d", num_interfaces);
  strcat(buffer, interfaces[0]);
  if (type == 1) {
    strcat(buffer, ",");
    strcat(buffer, num_int);
  }
  strcat(buffer, "\n");
  if (type == 1) {
    strcat(buffer, "inp ");
    int i = 0;
    while (interfaces[i] != NULL) {
      strcat(buffer, interfaces[i]);
      if (interfaces[i + 1] != NULL)
        strcat(buffer, ",");
      else {
        break;
      }
      i++;
    }
    strcat(buffer, "\n");
    if (1)
      printf("Registering interfaces %s\n", buffer);
  }
  strcat(buffer, "out ");
  if (type == 1)
    strcat(buffer, "device,");
  else
    strcat(buffer, "node,");
  sprintf(num_int, "%d", num_interfaces);
  strcat(buffer, interfaces[0]);
  if (type == 1) {
    strcat(buffer, ",");
    strcat(buffer, num_int);
  }
  strcat(buffer, "\n");
  if (type == 1) {
    strcat(buffer, "out ");
    int i = 0;
    while (interfaces[i] != NULL) {
      strcat(buffer, interfaces[i]);
      if (interfaces[i + 1] != NULL)
        strcat(buffer, ",");
      else {
        break;
      }
      i++;
    }
    strcat(buffer, "\n");
    if (1)
      printf("Registering interfaces %s\n", buffer);
  }
  send(depSocket, buffer, 512, 0);
  close(depSocket);
  return 1;
}


x86 assembly (clang, -O0):
<registerDep>:
push   %rbp
mov    %rsp,%rbp
sub    $0x450,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
lea    0xe25(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    0x2dff(%rip),%rax
mov    (%rax),%edi
mov    0x2de6(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10d0 <socket@plt>
mov    %eax,-0x20(%rbp)
mov    0x2de3(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x42c(%rbp)
mov    -0xc(%rbp),%edi
call   1040 <htons@plt>
mov    %eax,-0x430(%rbp)
mov    -0x8(%rbp),%rdi
call   1090 <inet_addr@plt>
mov    %eax,-0x434(%rbp)
mov    -0x438(%rbp),%edi
xor    %esi,%esi
mov    $0x4,%edx
call   1070 <memset@plt>
movl   $0x10,-0x43c(%rbp)
mov    -0x20(%rbp),%edi
lea    -0x438(%rbp),%rsi
mov    -0x43c(%rbp),%edx
call   10c0 <connect@plt>
mov    %eax,-0x440(%rbp)
lea    -0x420(%rbp),%rdi
lea    0xda7(%rip),%rsi
call   1030 <strcpy@plt>
cmpl   $0x1,-0x1c(%rbp)
jne    1296 <registerDep+0xe6>
lea    -0x420(%rbp),%rdi
lea    0xd8f(%rip),%rsi
call   10a0 <strcat@plt>
jmp    12a9 <registerDep+0xf9>
lea    -0x420(%rbp),%rdi
lea    0xd7f(%rip),%rsi
call   10a0 <strcat@plt>
lea    -0x425(%rbp),%rdi
mov    -0x10(%rbp),%edx
lea    0xd6f(%rip),%rsi
call   10b0 <sprintf@plt>
lea    -0x420(%rbp),%rdi
mov    -0x18(%rbp),%rax
mov    (%rax),%rsi
call   10a0 <strcat@plt>
cmpl   $0x1,-0x1c(%rbp)
jne    1302 <registerDep+0x152>
lea    -0x420(%rbp),%rdi
lea    0xd37(%rip),%rsi
call   10a0 <strcat@plt>
lea    -0x420(%rbp),%rdi
lea    -0x425(%rbp),%rsi
call   10a0 <strcat@plt>
lea    -0x420(%rbp),%rdi
lea    0xd04(%rip),%rsi
call   10a0 <strcat@plt>
cmpl   $0x1,-0x1c(%rbp)
jne    13e1 <registerDep+0x231>
lea    -0x420(%rbp),%rdi
lea    0xce9(%rip),%rsi
call   10a0 <strcat@plt>
movl   $0x0,-0x444(%rbp)
mov    -0x18(%rbp),%rax
movslq -0x444(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     13b9 <registerDep+0x209>
lea    -0x420(%rbp),%rdi
mov    -0x18(%rbp),%rax
movslq -0x444(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
call   10a0 <strcat@plt>
mov    -0x18(%rbp),%rax
mov    -0x444(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     13a0 <registerDep+0x1f0>
lea    -0x420(%rbp),%rdi
lea    0xc8b(%rip),%rsi
call   10a0 <strcat@plt>
jmp    13a5 <registerDep+0x1f5>
jmp    13b9 <registerDep+0x209>
mov    -0x444(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x444(%rbp)
jmp    133c <registerDep+0x18c>
lea    -0x420(%rbp),%rdi
lea    0xc4d(%rip),%rsi
call   10a0 <strcat@plt>
lea    -0x420(%rbp),%rsi
lea    0xc52(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    -0x420(%rbp),%rdi
lea    0xc58(%rip),%rsi
call   10a0 <strcat@plt>
cmpl   $0x1,-0x1c(%rbp)
jne    1416 <registerDep+0x266>
lea    -0x420(%rbp),%rdi
lea    0xc0f(%rip),%rsi
call   10a0 <strcat@plt>
jmp    1429 <registerDep+0x279>
lea    -0x420(%rbp),%rdi
lea    0xbff(%rip),%rsi
call   10a0 <strcat@plt>
lea    -0x425(%rbp),%rdi
mov    -0x10(%rbp),%edx
lea    0xbef(%rip),%rsi
call   10b0 <sprintf@plt>
lea    -0x420(%rbp),%rdi
mov    -0x18(%rbp),%rax
mov    (%rax),%rsi
call   10a0 <strcat@plt>
cmpl   $0x1,-0x1c(%rbp)
jne    1482 <registerDep+0x2d2>
lea    -0x420(%rbp),%rdi
lea    0xbb7(%rip),%rsi
call   10a0 <strcat@plt>
lea    -0x420(%rbp),%rdi
lea    -0x425(%rbp),%rsi
call   10a0 <strcat@plt>
lea    -0x420(%rbp),%rdi
lea    0xb84(%rip),%rsi
call   10a0 <strcat@plt>
cmpl   $0x1,-0x1c(%rbp)
jne    1561 <registerDep+0x3b1>
lea    -0x420(%rbp),%rdi
lea    0xb9a(%rip),%rsi
call   10a0 <strcat@plt>
movl   $0x0,-0x448(%rbp)
mov    -0x18(%rbp),%rax
movslq -0x448(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     1539 <registerDep+0x389>
lea    -0x420(%rbp),%rdi
mov    -0x18(%rbp),%rax
movslq -0x448(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
call   10a0 <strcat@plt>
mov    -0x18(%rbp),%rax
mov    -0x448(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     1520 <registerDep+0x370>
lea    -0x420(%rbp),%rdi
lea    0xb0b(%rip),%rsi
call   10a0 <strcat@plt>
jmp    1525 <registerDep+0x375>
jmp    1539 <registerDep+0x389>
mov    -0x448(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x448(%rbp)
jmp    14bc <registerDep+0x30c>
lea    -0x420(%rbp),%rdi
lea    0xacd(%rip),%rsi
call   10a0 <strcat@plt>
lea    -0x420(%rbp),%rsi
lea    0xad2(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x20(%rbp),%edi
lea    -0x420(%rbp),%rsi
mov    $0x200,%edx
xor    %ecx,%ecx
call   1050 <send@plt>
mov    -0x20(%rbp),%edi
call   1080 <close@plt>
mov    $0x1,%eax
add    $0x450,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<registerDep>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x438,%rsp
mov    %r8d,0x1c(%rsp)
mov    %rcx,%rbx
mov    %edx,%r12d
mov    %esi,%r13d
mov    %rdi,%r14
lea    0xe27(%rip),%rdi
mov    %r14,%rsi
mov    %r13d,%edx
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x2dfb(%rip),%r15
mov    (%r15),%edi
mov    0x2de1(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10d0 <socket@plt>
mov    %eax,%ebp
mov    (%r15),%eax
mov    %eax,0x2c(%rsp)
mov    %r13d,%edi
call   1040 <htons@plt>
mov    %eax,0x28(%rsp)
mov    %r14,%rdi
call   1090 <inet_addr@plt>
mov    %eax,0x24(%rsp)
xor    %esi,%esi
mov    $0x4,%edx
call   1070 <memset@plt>
lea    0x20(%rsp),%rsi
mov    %ebp,0x18(%rsp)
mov    %ebp,%edi
mov    $0x10,%edx
call   10c0 <connect@plt>
lea    0xdcd(%rip),%rsi
lea    0x30(%rsp),%r15
mov    %r15,%rdi
call   1030 <strcpy@plt>
mov    0x1c(%rsp),%ebp
cmp    $0x1,%ebp
lea    0xdb7(%rip),%r13
lea    0xdb8(%rip),%r14
mov    %r14,%rsi
cmove  %r13,%rsi
mov    %r15,%rdi
call   10a0 <strcat@plt>
lea    0xda8(%rip),%rsi
lea    0xf(%rsp),%rdi
mov    %r12d,0x14(%rsp)
mov    %r12d,%edx
mov    %ebp,%r12d
call   10b0 <sprintf@plt>
mov    (%rbx),%rsi
mov    %r15,%rdi
call   10a0 <strcat@plt>
cmp    $0x1,%ebp
jne    135c <registerDep+0x1ac>
lea    0xd70(%rip),%rsi
lea    0x30(%rsp),%rbp
mov    %rbp,%rdi
call   10a0 <strcat@plt>
lea    0xf(%rsp),%rsi
mov    %rbp,%rdi
call   10a0 <strcat@plt>
lea    0xd42(%rip),%rsi
mov    %rbp,%rdi
call   10a0 <strcat@plt>
lea    0xd35(%rip),%rsi
mov    %rbp,%rdi
call   10a0 <strcat@plt>
mov    (%rbx),%rsi
test   %rsi,%rsi
je     1335 <registerDep+0x185>
lea    0x8(%rbx),%r15
lea    0x30(%rsp),%rbp
lea    0xd20(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rbp,%rdi
call   10a0 <strcat@plt>
cmpq   $0x0,(%r15)
je     1335 <registerDep+0x185>
mov    %rbp,%rdi
mov    %r14,%rsi
call   10a0 <strcat@plt>
mov    (%r15),%rsi
add    $0x8,%r15
test   %rsi,%rsi
jne    1310 <registerDep+0x160>
lea    0xcd8(%rip),%rsi
lea    0x30(%rsp),%rbp
mov    %rbp,%rdi
call   10a0 <strcat@plt>
lea    0xcdc(%rip),%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
jmp    1370 <registerDep+0x1c0>
lea    0xcb1(%rip),%rsi
lea    0x30(%rsp),%rdi
call   10a0 <strcat@plt>
mov    %r14,%r13
mov    0x14(%rsp),%r14d
lea    0xccb(%rip),%rsi
lea    0x30(%rsp),%rbp
mov    %rbp,%rdi
call   10a0 <strcat@plt>
mov    %rbp,%rdi
mov    %r13,%rsi
call   10a0 <strcat@plt>
lea    0xc8e(%rip),%rsi
lea    0xf(%rsp),%rdi
mov    %r14d,%edx
call   10b0 <sprintf@plt>
mov    (%rbx),%rsi
mov    %rbp,%rdi
call   10a0 <strcat@plt>
cmp    $0x1,%r12d
jne    146c <registerDep+0x2bc>
lea    0xc5d(%rip),%rsi
lea    0x30(%rsp),%rbp
mov    %rbp,%rdi
call   10a0 <strcat@plt>
lea    0xf(%rsp),%rsi
mov    %rbp,%rdi
call   10a0 <strcat@plt>
lea    0xc2f(%rip),%rsi
mov    %rbp,%rdi
call   10a0 <strcat@plt>
lea    0xc53(%rip),%rsi
mov    %rbp,%rdi
call   10a0 <strcat@plt>
mov    (%rbx),%rsi
test   %rsi,%rsi
je     1445 <registerDep+0x295>
add    $0x8,%rbx
lea    0x30(%rsp),%rbp
lea    0xc0d(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rbp,%rdi
call   10a0 <strcat@plt>
cmpq   $0x0,(%rbx)
je     1445 <registerDep+0x295>
mov    %rbp,%rdi
mov    %r14,%rsi
call   10a0 <strcat@plt>
mov    (%rbx),%rsi
add    $0x8,%rbx
test   %rsi,%rsi
jne    1420 <registerDep+0x270>
lea    0xbc8(%rip),%rsi
lea    0x30(%rsp),%rbx
mov    %rbx,%rdi
call   10a0 <strcat@plt>
lea    0xbcc(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
jmp    147d <registerDep+0x2cd>
lea    0xba1(%rip),%rsi
lea    0x30(%rsp),%rdi
call   10a0 <strcat@plt>
mov    0x18(%rsp),%ebx
lea    0x30(%rsp),%rsi
mov    %ebx,%edi
mov    $0x200,%edx
xor    %ecx,%ecx
call   1050 <send@plt>
mov    %ebx,%edi
call   1080 <close@plt>
mov    $0x1,%eax
add    $0x438,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@.str = [22 x i8] c"Connectiong to %s:%d\0A\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.1 = [5 x i8] c"inp \00"
@.str.2 = [8 x i8] c"device,\00"
@.str.3 = [6 x i8] c"node,\00"
@.str.4 = [3 x i8] c"%d\00"
@.str.5 = [2 x i8] c",\00"
@.str.6 = [2 x i8] c"\0A\00"
@.str.7 = [27 x i8] c"Registering interfaces %s\0A\00"
@.str.8 = [5 x i8] c"out \00"
define i32 @registerDep(i8* %0, i32 %1, i32 %2, i8** %3, i32 %4) {
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8**
%10 = alloca i32
%11 = alloca i32
%12 = alloca [1024 x i8]
%13 = alloca [5 x i8]
%14 = alloca %struct.sockaddr_in
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
store i8* %0, i8** %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i8** %3, i8*** %9
store i32 %4, i32* %10
%19 = load i8*, i8** %6
%20 = load i32, i32* %7
%21 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %19, i32 %20)
%22 = load i32, i32* @AF_INET
%23 = load i32, i32* @SOCK_STREAM
%24 = call i32 @socket(i32 %22, i32 %23, i32 0)
store i32 %24, i32* %11
%25 = load i32, i32* @AF_INET
%26 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %14, i32 0, i32 3
store i32 %25, i32* %26
%27 = load i32, i32* %7
%28 = call i32 @htons(i32 %27)
%29 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %14, i32 0, i32 2
store i32 %28, i32* %29
%30 = load i8*, i8** %6
%31 = call i32 @inet_addr(i8* %30)
%32 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %14, i32 0, i32 1
%33 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %32, i32 0, i32 0
store i32 %31, i32* %33
%34 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %14, i32 0, i32 0
%35 = load i32, i32* %34
%36 = call i32 @memset(i32 %35, i8 signext 0, i32 4)
store i32 16, i32* %15
%37 = load i32, i32* %11
%38 = bitcast %struct.sockaddr_in* %14 to %struct.sockaddr*
%39 = load i32, i32* %15
%40 = call i32 @connect(i32 %37, %struct.sockaddr* %38, i32 %39)
store i32 %40, i32* %16
%41 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 0
%42 = call i32 @strcpy(i8* %41, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%43 = load i32, i32* %10
%44 = icmp eq i32 %43, 1
br i1 %44, label %45, label %48
45: ; preds = %5
%46 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 0
%47 = call i32 @strcat(i8* %46, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
br label %51
48: ; preds = %5
%49 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 0
%50 = call i32 @strcat(i8* %49, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
br label %51
51: ; preds = %48, %45
%52 = getelementptr inbounds [5 x i8], [5 x i8]* %13, i64 0, i64 0
%53 = load i32, i32* %8
%54 = call i32 @sprintf(i8* %52, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 %53)
%55 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 0
%56 = load i8**, i8*** %9
%57 = getelementptr inbounds i8*, i8** %56, i64 0
%58 = load i8*, i8** %57
%59 = call i32 @strcat(i8* %55, i8* %58)
%60 = load i32, i32* %10
%61 = icmp eq i32 %60, 1
br i1 %61, label %62, label %68
62: ; preds = %51
%63 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 0
%64 = call i32 @strcat(i8* %63, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%65 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 0
%66 = getelementptr inbounds [5 x i8], [5 x i8]* %13, i64 0, i64 0
%67 = call i32 @strcat(i8* %65, i8* %66)
br label %68
68: ; preds = %62, %51
%69 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 0
%70 = call i32 @strcat(i8* %69, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%71 = load i32, i32* %10
%72 = icmp eq i32 %71, 1
br i1 %72, label %73, label %110
73: ; preds = %68
%74 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 0
%75 = call i32 @strcat(i8* %74, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %17
br label %76
76: ; preds = %102, %73
%77 = load i8**, i8*** %9
%78 = load i32, i32* %17
%79 = sext i32 %78 to i64
%80 = getelementptr inbounds i8*, i8** %77, i64 %79
%81 = load i8*, i8** %80
%82 = icmp ne i8* %81, null
br i1 %82, label %83, label %105
83: ; preds = %76
%84 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 0
%85 = load i8**, i8*** %9
%86 = load i32, i32* %17
%87 = sext i32 %86 to i64
%88 = getelementptr inbounds i8*, i8** %85, i64 %87
%89 = load i8*, i8** %88
%90 = call i32 @strcat(i8* %84, i8* %89)
%91 = load i8**, i8*** %9
%92 = load i32, i32* %17
%93 = add nsw i32 %92, 1
%94 = sext i32 %93 to i64
%95 = getelementptr inbounds i8*, i8** %91, i64 %94
%96 = load i8*, i8** %95
%97 = icmp ne i8* %96, null
br i1 %97, label %98, label %101
98: ; preds = %83
%99 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 0
%100 = call i32 @strcat(i8* %99, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %102
101: ; preds = %83
br label %105
102: ; preds = %98
%103 = load i32, i32* %17
%104 = add nsw i32 %103, 1
store i32 %104, i32* %17
br label %76
105: ; preds = %101, %76
%106 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 0
%107 = call i32 @strcat(i8* %106, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%108 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 0
%109 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.7, i64 0, i64 0), i8* %108)
br label %110
110: ; preds = %105, %68
%111 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 0
%112 = call i32 @strcat(i8* %111, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
%113 = load i32, i32* %10
%114 = icmp eq i32 %113, 1
br i1 %114, label %115, label %118
115: ; preds = %110
%116 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 0
%117 = call i32 @strcat(i8* %116, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
br label %121
118: ; preds = %110
%119 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 0
%120 = call i32 @strcat(i8* %119, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
br label %121
121: ; preds = %118, %115
%122 = getelementptr inbounds [5 x i8], [5 x i8]* %13, i64 0, i64 0
%123 = load i32, i32* %8
%124 = call i32 @sprintf(i8* %122, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 %123)
%125 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 0
%126 = load i8**, i8*** %9
%127 = getelementptr inbounds i8*, i8** %126, i64 0
%128 = load i8*, i8** %127
%129 = call i32 @strcat(i8* %125, i8* %128)
%130 = load i32, i32* %10
%131 = icmp eq i32 %130, 1
br i1 %131, label %132, label %138
132: ; preds = %121
%133 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 0
%134 = call i32 @strcat(i8* %133, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%135 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 0
%136 = getelementptr inbounds [5 x i8], [5 x i8]* %13, i64 0, i64 0
%137 = call i32 @strcat(i8* %135, i8* %136)
br label %138
138: ; preds = %132, %121
%139 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 0
%140 = call i32 @strcat(i8* %139, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%141 = load i32, i32* %10
%142 = icmp eq i32 %141, 1
br i1 %142, label %143, label %180
143: ; preds = %138
%144 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 0
%145 = call i32 @strcat(i8* %144, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
store i32 0, i32* %18
br label %146
146: ; preds = %172, %143
%147 = load i8**, i8*** %9
%148 = load i32, i32* %18
%149 = sext i32 %148 to i64
%150 = getelementptr inbounds i8*, i8** %147, i64 %149
%151 = load i8*, i8** %150
%152 = icmp ne i8* %151, null
br i1 %152, label %153, label %175
153: ; preds = %146
%154 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 0
%155 = load i8**, i8*** %9
%156 = load i32, i32* %18
%157 = sext i32 %156 to i64
%158 = getelementptr inbounds i8*, i8** %155, i64 %157
%159 = load i8*, i8** %158
%160 = call i32 @strcat(i8* %154, i8* %159)
%161 = load i8**, i8*** %9
%162 = load i32, i32* %18
%163 = add nsw i32 %162, 1
%164 = sext i32 %163 to i64
%165 = getelementptr inbounds i8*, i8** %161, i64 %164
%166 = load i8*, i8** %165
%167 = icmp ne i8* %166, null
br i1 %167, label %168, label %171
168: ; preds = %153
%169 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 0
%170 = call i32 @strcat(i8* %169, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %172
171: ; preds = %153
br label %175
172: ; preds = %168
%173 = load i32, i32* %18
%174 = add nsw i32 %173, 1
store i32 %174, i32* %18
br label %146
175: ; preds = %171, %146
%176 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 0
%177 = call i32 @strcat(i8* %176, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%178 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 0
%179 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.7, i64 0, i64 0), i8* %178)
br label %180
180: ; preds = %175, %138
%181 = load i32, i32* %11
%182 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 0
%183 = call i32 @send(i32 %181, i8* %182, i32 512, i32 0)
%184 = load i32, i32* %11
%185 = call i32 @close(i32 %184)
ret i32 1
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@.str = [22 x i8] c"Connectiong to %s:%d\0A\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.1 = [5 x i8] c"inp \00"
@.str.2 = [8 x i8] c"device,\00"
@.str.3 = [6 x i8] c"node,\00"
@.str.4 = [3 x i8] c"%d\00"
@.str.5 = [2 x i8] c",\00"
@.str.6 = [2 x i8] c"\0A\00"
@.str.7 = [27 x i8] c"Registering interfaces %s\0A\00"
@.str.8 = [5 x i8] c"out \00"
define i32 @registerDep(i8* %0, i32 %1, i32 %2, i8** nocapture %3, i32 %4) {
%6 = alloca [1024 x i8]
%7 = alloca [5 x i8]
%8 = alloca %struct.sockaddr_in
%9 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%10 = getelementptr inbounds [5 x i8], [5 x i8]* %7, i64 0, i64 0
%11 = bitcast %struct.sockaddr_in* %8 to i8*
%12 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %1)
%13 = load i32, i32* @AF_INET
%14 = load i32, i32* @SOCK_STREAM
%15 = tail call i32 @socket(i32 %13, i32 %14, i32 0)
%16 = load i32, i32* @AF_INET
%17 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %8, i64 0, i32 3
store i32 %16, i32* %17
%18 = tail call i32 @htons(i32 %1)
%19 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %8, i64 0, i32 2
store i32 %18, i32* %19
%20 = tail call i32 @inet_addr(i8* %0)
%21 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %8, i64 0, i32 1, i32 0
store i32 %20, i32* %21
%22 = tail call i32 @memset(i32 undef, i8 signext 0, i32 4)
%23 = bitcast %struct.sockaddr_in* %8 to %struct.sockaddr*
%24 = call i32 @connect(i32 %15, %struct.sockaddr* %23, i32 16)
%25 = call i32 @strcpy(i8* %9, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%26 = icmp eq i32 %4, 1
%27 = select i1 %26, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0)
%28 = call i32 @strcat(i8* %9, i8* %27)
%29 = call i32 @sprintf(i8* %10, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 %2)
%30 = load i8*, i8** %3
%31 = call i32 @strcat(i8* %9, i8* %30)
br i1 %26, label %32, label %54
32: ; preds = %5
%33 = call i32 @strcat(i8* %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%34 = call i32 @strcat(i8* %9, i8* %10)
%35 = call i32 @strcat(i8* %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%36 = call i32 @strcat(i8* %9, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%37 = load i8*, i8** %3
%38 = icmp eq i8* %37, null
br i1 %38, label %51, label %39
39: ; preds = %32, %47
%40 = phi i64 [ %43, %47 ], [ 0, %32 ]
%41 = phi i8* [ %49, %47 ], [ %37, %32 ]
%42 = call i32 @strcat(i8* %9, i8* %41)
%43 = add nuw i64 %40, 1
%44 = getelementptr inbounds i8*, i8** %3, i64 %43
%45 = load i8*, i8** %44
%46 = icmp eq i8* %45, null
br i1 %46, label %51, label %47
47: ; preds = %39
%48 = call i32 @strcat(i8* %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%49 = load i8*, i8** %44
%50 = icmp eq i8* %49, null
br i1 %50, label %51, label %39
51: ; preds = %47, %39, %32
%52 = call i32 @strcat(i8* %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%53 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.7, i64 0, i64 0), i8* %9)
br label %56
54: ; preds = %5
%55 = call i32 @strcat(i8* %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
br label %56
56: ; preds = %54, %51
%57 = phi i8* [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), %54 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), %51 ]
%58 = call i32 @strcat(i8* %9, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
%59 = call i32 @strcat(i8* %9, i8* %57)
%60 = call i32 @sprintf(i8* %10, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 %2)
%61 = load i8*, i8** %3
%62 = call i32 @strcat(i8* %9, i8* %61)
br i1 %26, label %63, label %85
63: ; preds = %56
%64 = call i32 @strcat(i8* %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%65 = call i32 @strcat(i8* %9, i8* %10)
%66 = call i32 @strcat(i8* %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%67 = call i32 @strcat(i8* %9, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
%68 = load i8*, i8** %3
%69 = icmp eq i8* %68, null
br i1 %69, label %82, label %70
70: ; preds = %63, %78
%71 = phi i64 [ %74, %78 ], [ 0, %63 ]
%72 = phi i8* [ %80, %78 ], [ %68, %63 ]
%73 = call i32 @strcat(i8* %9, i8* %72)
%74 = add nuw i64 %71, 1
%75 = getelementptr inbounds i8*, i8** %3, i64 %74
%76 = load i8*, i8** %75
%77 = icmp eq i8* %76, null
br i1 %77, label %82, label %78
78: ; preds = %70
%79 = call i32 @strcat(i8* %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%80 = load i8*, i8** %75
%81 = icmp eq i8* %80, null
br i1 %81, label %82, label %70
82: ; preds = %78, %70, %63
%83 = call i32 @strcat(i8* %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%84 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.7, i64 0, i64 0), i8* %9)
br label %87
85: ; preds = %56
%86 = call i32 @strcat(i8* %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
br label %87
87: ; preds = %85, %82
%88 = call i32 @send(i32 %15, i8* %9, i32 512, i32 0)
%89 = call i32 @close(i32 %15)
ret i32 1
}