#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*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ printf(char *, char *);
char **restoreIpAddresses(char *, int *);
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  if (argc != 2) {
    fprintf(stderr, "Usage: ./test num\n");
    exit(-1);
  }
  int i, count = 0;
  char **list = restoreIpAddresses(argv[1], &count);
  for (i = 0; i < count; i++) {
    printf("%s\n", list[i]);
  }
}


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)
cmpl   $0x2,-0x8(%rbp)
je     117f <main+0x3f>
mov    0x2e79(%rip),%rax
mov    (%rax),%edi
lea    0xe90(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0xffffffff,%edi
call   1060 <exit@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    -0x18(%rbp),%rsi
call   1050 <restoreIpAddresses@plt>
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    11d4 <main+0x94>
mov    -0x20(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xe52(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11a2 <main+0x62>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
cmp    $0x2,%edi
jne    11a6 <main+0x66>
movl   $0x0,0xc(%rsp)
mov    0x8(%rsi),%rdi
lea    0xc(%rsp),%rsi
call   1050 <restoreIpAddresses@plt>
cmpl   $0x0,0xc(%rsp)
jle    119a <main+0x5a>
mov    %rax,%r15
xor    %ebx,%ebx
lea    0xe9c(%rip),%r14
nopw   0x0(%rax,%rax,1)
mov    (%r15,%rbx,8),%rsi
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0x1,%rbx
movslq 0xc(%rsp),%rax
cmp    %rax,%rbx
jl     1180 <main+0x40>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret
mov    0x2e33(%rip),%rax
mov    (%rax),%edi
lea    0xe4a(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0xffffffff,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [19 x i8] c"Usage: ./test num\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* %4
%10 = icmp ne i32 %9, 2
br i1 %10, label %11, label %15
11: ; preds = %2
%12 = load i32, i32* @stderr
%13 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%14 = call i32 @exit(i32 -1)
unreachable
15: ; preds = %2
store i32 0, i32* %7
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 1
%18 = load i8*, i8** %17
%19 = call i8** @restoreIpAddresses(i8* %18, i32* %7)
store i8** %19, i8*** %8
store i32 0, i32* %6
br label %20
20: ; preds = %31, %15
%21 = load i32, i32* %6
%22 = load i32, i32* %7
%23 = icmp slt i32 %21, %22
br i1 %23, label %24, label %34
24: ; preds = %20
%25 = load i8**, i8*** %8
%26 = load i32, i32* %6
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i8*, i8** %25, i64 %27
%29 = load i8*, i8** %28
%30 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %29)
br label %31
31: ; preds = %24
%32 = load i32, i32* %6
%33 = add nsw i32 %32, 1
store i32 %33, i32* %6
br label %20
34: ; preds = %20
%35 = load i32, i32* %3
ret i32 %35
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [19 x i8] c"Usage: ./test num\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = icmp eq i32 %0, 2
br i1 %4, label %9, label %5
5: ; preds = %2
%6 = load i32, i32* @stderr
%7 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%8 = tail call i32 @exit(i32 -1)
unreachable
9: ; preds = %2
%10 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = call i8** @restoreIpAddresses(i8* %12, i32* %3)
%14 = load i32, i32* %3
%15 = icmp sgt i32 %14, 0
br i1 %15, label %16, label %25
16: ; preds = %9, %16
%17 = phi i64 [ %21, %16 ], [ 0, %9 ]
%18 = getelementptr inbounds i8*, i8** %13, i64 %17
%19 = load i8*, i8** %18
%20 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %19)
%21 = add nuw nsw i64 %17, 1
%22 = load i32, i32* %3
%23 = sext i32 %22 to i64
%24 = icmp slt i64 %21, %23
br i1 %24, label %16, label %25
25: ; preds = %16, %9
ret i32 0
}