main(int argc, char *argv[]) {
  char **dict;
  int i = 0, count;
  if (argc != 3) {
    printf("Usage: %s [parent ip] [count]\n", argv[0]);
    return -1;
  }
  count = atoi(argv[2]);
  dict = malloc(count * sizeof(char *));
  getwork(argv[1], count, dict);
  while (i < count)
    printf("%d:\t%s\n", i, dict[i++]);
  free(dict[0]);
  free(dict);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     1198 <main+0x48>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe7b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    121e <main+0xce>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
mov    $0x0,%al
call   1060 <atoi@plt>
mov    %eax,-0x20(%rbp)
movslq -0x20(%rbp),%rdi
shl    $0x3,%rdi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x20(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    $0x0,%al
call   1070 <getwork@plt>
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    1209 <main+0xb9>
mov    -0x1c(%rbp),%esi
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x1c(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xe22(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11d1 <main+0x81>
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%rbp
cmp    $0x3,%edi
jne    11de <main+0x8e>
mov    0x10(%rbp),%rdi
xor    %r14d,%r14d
xor    %eax,%eax
call   1060 <atoi@plt>
mov    %eax,%r15d
movslq %eax,%r12
lea    0x0(,%r12,8),%rdi
call   1050 <malloc@plt>
mov    %rax,%r13
mov    0x8(%rbp),%rdi
mov    %r12d,%esi
mov    %rax,%rdx
xor    %eax,%eax
call   1070 <getwork@plt>
test   %r12d,%r12d
jle    11cb <main+0x7b>
mov    %r15d,%ebp
lea    0xe78(%rip),%r15
xor    %esi,%esi
nopl   0x0(%rax)
lea    0x1(%rsi),%rbx
mov    0x0(%r13,%rsi,8),%rdx
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rsi
cmp    %rbx,%rbp
jne    11b0 <main+0x60>
mov    0x0(%r13),%rdi
call   1030 <free@plt>
mov    %r13,%rdi
call   1030 <free@plt>
jmp    11f6 <main+0xa6>
mov    0x0(%rbp),%rsi
lea    0xe17(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xffffffff,%r14d
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [31 x i8] c"Usage: %s [parent ip] [count]\0A\00"
@.str.1 = [8 x i8] c"%d:\09%s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8**
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %7
%9 = load i32, i32* %4
%10 = icmp ne i32 %9, 3
br i1 %10, label %11, label %16
11: ; preds = %2
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 0
%14 = load i8*, i8** %13
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i8* %14)
store i32 -1, i32* %3
br label %51
16: ; preds = %2
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 2
%19 = load i8*, i8** %18
%20 = call i32 (i8*, ...) bitcast (i32 (...)* @atoi to i32 (i8*, ...)*)(i8* %19)
store i32 %20, i32* %8
%21 = load i32, i32* %8
%22 = sext i32 %21 to i64
%23 = mul i64 %22, 8
%24 = call i8* @malloc(i64 %23)
%25 = bitcast i8* %24 to i8**
store i8** %25, i8*** %6
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds i8*, i8** %26, i64 1
%28 = load i8*, i8** %27
%29 = load i32, i32* %8
%30 = load i8**, i8*** %6
%31 = call i32 (i8*, i32, i8**, ...) bitcast (i32 (...)* @getwork to i32 (i8*, i32, i8**, ...)*)(i8* %28, i32 %29, i8** %30)
br label %32
32: ; preds = %36, %16
%33 = load i32, i32* %7
%34 = load i32, i32* %8
%35 = icmp slt i32 %33, %34
br i1 %35, label %36, label %45
36: ; preds = %32
%37 = load i32, i32* %7
%38 = load i8**, i8*** %6
%39 = load i32, i32* %7
%40 = add nsw i32 %39, 1
store i32 %40, i32* %7
%41 = sext i32 %39 to i64
%42 = getelementptr inbounds i8*, i8** %38, i64 %41
%43 = load i8*, i8** %42
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %37, i8* %43)
br label %32
45: ; preds = %32
%46 = load i8**, i8*** %6
%47 = getelementptr inbounds i8*, i8** %46, i64 0
%48 = load i8*, i8** %47
%49 = load i8**, i8*** %6
%50 = bitcast i8** %49 to i8*
br label %51
51: ; preds = %45, %11
%52 = load i32, i32* %3
ret i32 %52
}

LLVM IR (-O2):
@.str = [31 x i8] c"Usage: %s [parent ip] [count]\0A\00"
@.str.1 = [8 x i8] c"%d:\09%s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 3
br i1 %3, label %7, label %4
4: ; preds = %2
%5 = load i8*, i8** %1
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i8* %5)
br label %31
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 2
%9 = load i8*, i8** %8
%10 = tail call i32 (i8*, ...) bitcast (i32 (...)* @atoi to i32 (i8*, ...)*)(i8* %9)
%11 = sext i32 %10 to i64
%12 = shl nsw i64 %11, 3
%13 = tail call i8* @malloc(i64 %12)
%14 = bitcast i8* %13 to i8**
%15 = getelementptr inbounds i8*, i8** %1, i64 1
%16 = load i8*, i8** %15
%17 = tail call i32 (i8*, i32, i8**, ...) bitcast (i32 (...)* @getwork to i32 (i8*, i32, i8**, ...)*)(i8* %16, i32 %10, i8** %14)
%18 = icmp sgt i32 %10, 0
br i1 %18, label %19, label %29
19: ; preds = %7
%20 = zext i32 %10 to i64
br label %21
21: ; preds = %19, %21
%22 = phi i64 [ 0, %19 ], [ %23, %21 ]
%23 = add nuw nsw i64 %22, 1
%24 = getelementptr inbounds i8*, i8** %14, i64 %22
%25 = load i8*, i8** %24
%26 = trunc i64 %22 to i32
%27 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %26, i8* %25)
%28 = icmp eq i64 %23, %20
br i1 %28, label %29, label %21
29: ; preds = %21, %7
%30 = load i8*, i8** %14
tail call void @free(i8* %30)
tail call void @free(i8* %13)
br label %31
31: ; preds = %29, %4
%32 = phi i32 [ -1, %4 ], [ 0, %29 ]
ret i32 %32
}