#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*/ listen_on_port(int);
int /*<<< orphan*/ printf(char *);
scalar_t__ strtol(char *, char **, int);
int main(int argc, char **argv) {
  int arg_index;
  printf("Hello from container-probe.\n");
  for (arg_index = 1; arg_index < argc; ++arg_index) {
    char *pEnd;
    int port = (int)strtol(argv[arg_index], &pEnd, 10);
    if (port != 0) {
      listen_on_port(port);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeb3(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11a7 <main+0x77>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    -0x20(%rbp),%rsi
mov    $0xa,%edx
call   1040 <strtol@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
je     1194 <main+0x64>
mov    -0x24(%rbp),%edi
call   1050 <listen_on_port@plt>
jmp    1199 <main+0x69>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1159 <main+0x29>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r15
mov    %edi,%ebp
lea    0xebd(%rip),%rdi
call   1030 <puts@plt>
cmp    $0x2,%ebp
jl     1187 <main+0x57>
mov    %ebp,%ebp
mov    $0x1,%ebx
mov    %rsp,%r14
jmp    1169 <main+0x39>
nopl   0x0(%rax)
add    $0x1,%rbx
cmp    %rbx,%rbp
je     1187 <main+0x57>
mov    (%r15,%rbx,8),%rdi
mov    %r14,%rsi
mov    $0xa,%edx
call   1040 <strtol@plt>
test   %eax,%eax
je     1160 <main+0x30>
mov    %eax,%edi
call   1050 <listen_on_port@plt>
jmp    1160 <main+0x30>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [29 x i8] c"Hello from container-probe.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %6
br label %10
10: ; preds = %28, %2
%11 = load i32, i32* %6
%12 = load i32, i32* %4
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %31
14: ; preds = %10
%15 = load i8**, i8*** %5
%16 = load i32, i32* %6
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8*, i8** %15, i64 %17
%19 = load i8*, i8** %18
%20 = call i64 @strtol(i8* %19, i8** %7, i32 10)
%21 = trunc i64 %20 to i32
store i32 %21, i32* %8
%22 = load i32, i32* %8
%23 = icmp ne i32 %22, 0
br i1 %23, label %24, label %27
24: ; preds = %14
%25 = load i32, i32* %8
%26 = call i32 @listen_on_port(i32 %25)
br label %27
27: ; preds = %24, %14
br label %28
28: ; preds = %27
%29 = load i32, i32* %6
%30 = add nsw i32 %29, 1
store i32 %30, i32* %6
br label %10
31: ; preds = %10
ret i32 0
}

LLVM IR (-O2):
@str = [28 x i8] c"Hello from container-probe.\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i8*
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
%5 = icmp sgt i32 %0, 1
br i1 %5, label %6, label %21
6: ; preds = %2
%7 = bitcast i8** %3 to i8*
%8 = zext i32 %0 to i64
br label %9
9: ; preds = %6, %18
%10 = phi i64 [ 1, %6 ], [ %19, %18 ]
%11 = getelementptr inbounds i8*, i8** %1, i64 %10
%12 = load i8*, i8** %11
%13 = call i64 @strtol(i8* %12, i8** %3, i32 10)
%14 = trunc i64 %13 to i32
%15 = icmp eq i32 %14, 0
br i1 %15, label %18, label %16
16: ; preds = %9
%17 = tail call i32 @listen_on_port(i32 %14)
br label %18
18: ; preds = %16, %9
%19 = add nuw nsw i64 %10, 1
%20 = icmp eq i64 %19, %8
br i1 %20, label %21, label %9
21: ; preds = %18, %2
ret i32 0
}