#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*/ printf(char *, ...);
void print_popular(int dimense, int pop_number, double *popular,
                   double *speed) {
  int i = 0;
  int j = 0;
  printf("##############################################\n");
  printf("BEGIN OF PRINT POPULAR\n");
  for (i = 0; i < pop_number; i++) {
    printf("\nParticle NO: (%d)\n", i);
    printf("Particle Position:  ");
    for (j = 0; j < dimense; j++)
      printf("%f  ", *(popular + i * dimense + j));
    printf("\nParticle Speed:  ");
    for (j = 0; j < dimense; j++)
      printf("%f  ", *(speed + i * dimense + j));
    printf("\n");
  }
  printf("\nEND OF PRINT POPULAR\n");
  printf("##############################################\n");
}


x86 assembly (clang, -O0):
<print_popular>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
lea    0xec5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1246 <print_popular+0x136>
mov    -0x1c(%rbp),%esi
lea    0xedb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11cf <print_popular+0xbf>
mov    -0x10(%rbp),%rax
mov    -0x1c(%rbp),%ecx
imul   -0x4(%rbp),%ecx
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
movslq -0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xeb7(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1189 <print_popular+0x79>
lea    0xea0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    122a <print_popular+0x11a>
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%ecx
imul   -0x4(%rbp),%ecx
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
movslq -0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xe5c(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11e4 <print_popular+0xd4>
lea    0xdfd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1157 <print_popular+0x47>
lea    0xe3c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xda5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_popular>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rcx,%r14
mov    %rdx,%rbx
mov    %esi,%ebp
mov    %edi,%r15d
lea    0xf1e(%rip),%rdi
call   1040 <puts@plt>
lea    0xee5(%rip),%rdi
call   1040 <puts@plt>
test   %ebp,%ebp
jle    123e <print_popular+0x10e>
movslq %r15d,%rax
mov    %ebp,%ecx
mov    %rcx,(%rsp)
mov    %eax,%r13d
shl    $0x3,%rax
mov    %rax,0x8(%rsp)
lea    0xea4(%rip),%r12
xor    %ebp,%ebp
jmp    11c2 <print_popular+0x92>
nopl   0x0(%rax)
lea    0xe97(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x10(%rsp),%rbp
add    $0x1,%rbp
mov    0x8(%rsp),%rax
add    %rax,%rbx
add    %rax,%r14
cmp    (%rsp),%rbp
je     123e <print_popular+0x10e>
lea    0xe37(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe3b(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
test   %r15d,%r15d
mov    %rbp,0x10(%rsp)
jle    1190 <print_popular+0x60>
mov    %r15d,%ebp
xor    %r15d,%r15d
movsd  (%rbx,%r15,8),%xmm0
mov    %r12,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
add    $0x1,%r15
cmp    %r15,%r13
jne    11f0 <print_popular+0xc0>
lea    0xe1e(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %ebp,%r15d
test   %ebp,%ebp
jle    119e <print_popular+0x6e>
xor    %ebp,%ebp
movsd  (%r14,%rbp,8),%xmm0
mov    %r12,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
add    $0x1,%rbp
cmp    %rbp,%r13
jne    1220 <print_popular+0xf0>
jmp    119e <print_popular+0x6e>
lea    0xe13(%rip),%rdi
call   1040 <puts@plt>
lea    0xe1d(%rip),%rdi
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <puts@plt>

LLVM IR (-O0):
@.str = [48 x i8] c"##############################################\0A\00"
@.str.1 = [24 x i8] c"BEGIN OF PRINT POPULAR\0A\00"
@.str.2 = [20 x i8] c"\0AParticle NO: (%d)\0A\00"
@.str.3 = [21 x i8] c"Particle Position: \00"
@.str.4 = [5 x i8] c"%f \00"
@.str.5 = [19 x i8] c"\0AParticle Speed: \00"
@.str.6 = [2 x i8] c"\0A\00"
@.str.7 = [23 x i8] c"\0AEND OF PRINT POPULAR\0A\00"
define void @print_popular(i32 %0, i32 %1, double* %2, double* %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca double*
%8 = alloca double*
%9 = alloca i32
%10 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store double* %2, double** %7
store double* %3, double** %8
store i32 0, i32* %9
store i32 0, i32* %10
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0))
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %9
br label %13
13: ; preds = %63, %4
%14 = load i32, i32* %9
%15 = load i32, i32* %6
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %66
17: ; preds = %13
%18 = load i32, i32* %9
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %18)
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %10
br label %21
21: ; preds = %37, %17
%22 = load i32, i32* %10
%23 = load i32, i32* %5
%24 = icmp slt i32 %22, %23
br i1 %24, label %25, label %40
25: ; preds = %21
%26 = load double*, double** %7
%27 = load i32, i32* %9
%28 = load i32, i32* %5
%29 = mul nsw i32 %27, %28
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds double, double* %26, i64 %30
%32 = load i32, i32* %10
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds double, double* %31, i64 %33
%35 = load double, double* %34
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), double %35)
br label %37
37: ; preds = %25
%38 = load i32, i32* %10
%39 = add nsw i32 %38, 1
store i32 %39, i32* %10
br label %21
40: ; preds = %21
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0))
store i32 0, i32* %10
br label %42
42: ; preds = %58, %40
%43 = load i32, i32* %10
%44 = load i32, i32* %5
%45 = icmp slt i32 %43, %44
br i1 %45, label %46, label %61
46: ; preds = %42
%47 = load double*, double** %8
%48 = load i32, i32* %9
%49 = load i32, i32* %5
%50 = mul nsw i32 %48, %49
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds double, double* %47, i64 %51
%53 = load i32, i32* %10
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds double, double* %52, i64 %54
%56 = load double, double* %55
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), double %56)
br label %58
58: ; preds = %46
%59 = load i32, i32* %10
%60 = add nsw i32 %59, 1
store i32 %60, i32* %10
br label %42
61: ; preds = %42
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
br label %63
63: ; preds = %61
%64 = load i32, i32* %9
%65 = add nsw i32 %64, 1
store i32 %65, i32* %9
br label %13
66: ; preds = %13
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0))
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str.2 = [20 x i8] c"\0AParticle NO: (%d)\0A\00"
@.str.3 = [21 x i8] c"Particle Position: \00"
@.str.4 = [5 x i8] c"%f \00"
@.str.5 = [19 x i8] c"\0AParticle Speed: \00"
@str.8 = [23 x i8] c"BEGIN OF PRINT POPULAR\00"
@str.9 = [22 x i8] c"\0AEND OF PRINT POPULAR\00"
@str.10 = [47 x i8] c"##############################################\00"
define void @print_popular(i32 %0, i32 %1, double* nocapture %2, double* nocapture %3) {
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @str.10, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.8, i64 0, i64 0))
%7 = icmp sgt i32 %1, 0
br i1 %7, label %8, label %47
8: ; preds = %4
%9 = icmp sgt i32 %0, 0
%10 = sext i32 %0 to i64
%11 = zext i32 %1 to i64
%12 = zext i32 %0 to i64
%13 = zext i32 %0 to i64
br label %14
14: ; preds = %8, %43
%15 = phi i64 [ 0, %8 ], [ %45, %43 ]
%16 = trunc i64 %15 to i32
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %16)
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0))
br i1 %9, label %21, label %19
19: ; preds = %14
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0))
br label %43
21: ; preds = %14
%22 = mul nsw i64 %15, %10
%23 = getelementptr inbounds double, double* %2, i64 %22
br label %24
24: ; preds = %21, %24
%25 = phi i64 [ 0, %21 ], [ %29, %24 ]
%26 = getelementptr inbounds double, double* %23, i64 %25
%27 = load double, double* %26
%28 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), double %27)
%29 = add nuw nsw i64 %25, 1
%30 = icmp eq i64 %29, %12
br i1 %30, label %31, label %24
31: ; preds = %24
%32 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0))
br i1 %9, label %33, label %43
33: ; preds = %31
%34 = mul nsw i64 %15, %10
%35 = getelementptr inbounds double, double* %3, i64 %34
br label %36
36: ; preds = %33, %36
%37 = phi i64 [ 0, %33 ], [ %41, %36 ]
%38 = getelementptr inbounds double, double* %35, i64 %37
%39 = load double, double* %38
%40 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), double %39)
%41 = add nuw nsw i64 %37, 1
%42 = icmp eq i64 %41, %13
br i1 %42, label %43, label %36
43: ; preds = %36, %19, %31
%44 = tail call i32 @putchar(i32 10)
%45 = add nuw nsw i64 %15, 1
%46 = icmp eq i64 %45, %11
br i1 %46, label %47, label %14
47: ; preds = %43, %4
%48 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.9, i64 0, i64 0))
%49 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @str.10, i64 0, i64 0))
ret void
}