#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*/ atoi(char *);
int /*<<< orphan*/ getPrimaryIP();
void *malloc(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ registerDep(char *, int /*<<< orphan*/, int, char **, int);
int /*<<< orphan*/ start(char *, char *, char *);
int /*<<< orphan*/ strcpy(char *, int /*<<< orphan*/);
int /*<<< orphan*/ stunGetPublicIP(char *, int /*<<< orphan*/ *);
int main(int argc, char *argv[]) {
  char **primIP;
  char *myPubIP;
  primIP = malloc(sizeof(char *));
  primIP[0] = malloc(sizeof(char) * 20);
  primIP[1] = malloc(sizeof(char) * 20);
  strcpy(primIP[1], getPrimaryIP());
  stunGetPublicIP(primIP[0], NULL);
  if (1)
    printf("Registering primary IP %s\n", primIP[0]);
  registerDep(argv[1], atoi(argv[2]), 1, primIP, 2);
  if (1)
    printf("Done registering IP\n");
  start(primIP[1], "9899", primIP[0]);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x8,%edi
call   1080 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    $0x14,%edi
call   1080 <malloc@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    $0x14,%edi
call   1080 <malloc@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,0x8(%rax)
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x30(%rbp)
mov    $0x0,%al
call   10a0 <getPrimaryIP@plt>
mov    -0x30(%rbp),%rdi
mov    %eax,%esi
call   1030 <strcpy@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1070 <stunGetPublicIP@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%rsi
lea    0xdfe(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1090 <atoi@plt>
mov    -0x28(%rbp),%rdi
mov    %eax,%esi
mov    -0x18(%rbp),%rcx
mov    $0x1,%edx
mov    $0x2,%r8d
call   1050 <registerDep@plt>
lea    0xdd8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x18(%rbp),%rax
mov    (%rax),%rdx
lea    0xdd0(%rip),%rsi
call   1060 <start@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    $0x8,%edi
call   1090 <malloc@plt>
mov    %rax,%r12
mov    $0x14,%edi
call   1090 <malloc@plt>
mov    %rax,%r15
mov    $0x14,%edi
call   1090 <malloc@plt>
mov    %rax,%rbx
mov    %rax,0x8(%r12)
xor    %eax,%eax
call   10b0 <getPrimaryIP@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <strcpy@plt>
mov    %r15,%rdi
xor    %esi,%esi
call   1080 <stunGetPublicIP@plt>
lea    0xe17(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x8(%r14),%rbx
mov    0x10(%r14),%rdi
call   10a0 <atoi@plt>
mov    %rbx,%rdi
mov    %eax,%esi
mov    $0x1,%edx
mov    %r12,%rcx
mov    $0x2,%r8d
call   1060 <registerDep@plt>
lea    0xe01(%rip),%rdi
call   1040 <puts@plt>
mov    (%r12),%rdx
mov    0x8(%r12),%rdi
lea    0xde7(%rip),%rsi
call   1070 <start@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [27 x i8] c"Registering primary IP %s\0A\00"
@.str.1 = [21 x i8] c"Done registering IP\0A\00"
@.str.2 = [5 x i8] c"9899\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i8**
%6 = alloca i8*
store i32 %0, i32* %3
store i8** %1, i8*** %4
%7 = call i8* @malloc(i32 8)
%8 = bitcast i8* %7 to i8**
store i8** %8, i8*** %5
%9 = call i8* @malloc(i32 20)
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 0
store i8* %9, i8** %11
%12 = call i8* @malloc(i32 20)
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 1
store i8* %12, i8** %14
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 1
%17 = load i8*, i8** %16
%18 = call i32 (...) @getPrimaryIP()
%19 = call i32 @strcpy(i8* %17, i32 %18)
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 0
%22 = load i8*, i8** %21
%23 = call i32 @stunGetPublicIP(i8* %22, i32* null)
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 0
%26 = load i8*, i8** %25
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %26)
%28 = load i8**, i8*** %4
%29 = getelementptr inbounds i8*, i8** %28, i64 1
%30 = load i8*, i8** %29
%31 = load i8**, i8*** %4
%32 = getelementptr inbounds i8*, i8** %31, i64 2
%33 = load i8*, i8** %32
%34 = call i32 @atoi(i8* %33)
%35 = load i8**, i8*** %5
%36 = call i32 @registerDep(i8* %30, i32 %34, i32 1, i8** %35, i32 2)
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
%38 = load i8**, i8*** %5
%39 = getelementptr inbounds i8*, i8** %38, i64 1
%40 = load i8*, i8** %39
%41 = load i8**, i8*** %5
%42 = getelementptr inbounds i8*, i8** %41, i64 0
%43 = load i8*, i8** %42
%44 = call i32 @start(i8* %40, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* %43)
ret i32 0
}

LLVM IR (-O2):
@.str = [27 x i8] c"Registering primary IP %s\0A\00"
@.str.2 = [5 x i8] c"9899\00"
@str = [20 x i8] c"Done registering IP\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = tail call dereferenceable_or_null(8) i8* @malloc(i32 8)
%4 = bitcast i8* %3 to i8**
%5 = tail call dereferenceable_or_null(20) i8* @malloc(i32 20)
%6 = tail call dereferenceable_or_null(20) i8* @malloc(i32 20)
%7 = getelementptr inbounds i8*, i8** %4, i64 1
store i8* %6, i8** %7
%8 = tail call i32 (...) @getPrimaryIP()
%9 = tail call i32 @strcpy(i8* %6, i32 %8)
%10 = tail call i32 @stunGetPublicIP(i8* %5, i32* null)
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %5)
%12 = getelementptr inbounds i8*, i8** %1, i64 1
%13 = load i8*, i8** %12
%14 = getelementptr inbounds i8*, i8** %1, i64 2
%15 = load i8*, i8** %14
%16 = tail call i32 @atoi(i8* %15)
%17 = tail call i32 @registerDep(i8* %13, i32 %16, i32 1, i8** %4, i32 2)
%18 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
%19 = load i8*, i8** %7
%20 = load i8*, i8** %4
%21 = tail call i32 @start(i8* %19, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* %20)
ret i32 0
}