#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 atoi(char *);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ syscall(int, int, int *);
int main(int argc, char **argv) {
  int cpuNum = atoi(argv[1]);
  int pids[300];
  syscall(319, cpuNum, pids);
  int i;
  for (i = 0; i < 40; i++) {
    printf("%d \t", pids[i]);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x4e0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    -0x4d0(%rbp),%rdx
mov    $0x13f,%edi
call   1040 <syscall@plt>
movl   $0x0,-0x4d4(%rbp)
cmpl   $0x28,-0x4d4(%rbp)
jge    11b2 <main+0x82>
movslq -0x4d4(%rbp),%rax
mov    -0x4d0(%rbp,%rax,4),%esi
lea    0xe67(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4d4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4d4(%rbp)
jmp    1177 <main+0x47>
mov    -0x4(%rbp),%eax
add    $0x4e0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x4b8,%rsp
mov    0x8(%rsi),%rdi
call   1050 <atoi@plt>
mov    %rsp,%rdx
mov    $0x13f,%edi
mov    %eax,%esi
call   1040 <syscall@plt>
xor    %ebx,%ebx
lea    0xea5(%rip),%r14
nopl   0x0(%rax,%rax,1)
mov    (%rsp,%rbx,4),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    $0x28,%rbx
jne    1160 <main+0x30>
xor    %eax,%eax
add    $0x4b8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c"%d \09\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [300 x i32]
%4 = getelementptr inbounds i8*, i8** %1, i64 1
%5 = load i8*, i8** %4
%6 = tail call i32 @atoi(i8* %5)
%7 = bitcast [300 x i32]* %3 to i8*
%8 = getelementptr inbounds [300 x i32], [300 x i32]* %3, i64 0, i64 0
%9 = call i32 @syscall(i32 319, i32 %6, i32* %8)
br label %10
10: ; preds = %2, %10
%11 = phi i64 [ 0, %2 ], [ %15, %10 ]
%12 = getelementptr inbounds [300 x i32], [300 x i32]* %3, i64 0, i64 %11
%13 = load i32, i32* %12
%14 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %13)
%15 = add nuw nsw i64 %11, 1
%16 = icmp eq i64 %15, 40
br i1 %16, label %17, label %10
17: ; preds = %10
ret i32 0
}