#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_precincts_weight_profit(long ne_ordered_list, int max_quality_layers,
                                   long **weights, double **profit,
                                   long *ordered_list) {
  int i, j;
  printf("\n\n");
  for (i = 0; i < ne_ordered_list; i++) {
    long pos = ordered_list[i];
    for (j = 0; j < max_quality_layers; j++) {
      printf("w[%ld][%d] = %ld / %lf  \t", pos, j, weights[pos][j],
             profit[pos][j]);
    }
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<print_precincts_weight_profit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
lea    0xece(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x2c(%rbp)
movslq -0x2c(%rbp),%rax
cmp    -0x8(%rbp),%rax
jge    11d9 <print_precincts_weight_profit+0xc9>
mov    -0x28(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x38(%rbp)
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11bd <print_precincts_weight_profit+0xad>
mov    -0x38(%rbp),%rsi
mov    -0x30(%rbp),%edx
mov    -0x18(%rbp),%rax
mov    -0x38(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x30(%rbp),%rcx
mov    (%rax,%rcx,8),%rcx
mov    -0x20(%rbp),%rax
mov    -0x38(%rbp),%rdi
mov    (%rax,%rdi,8),%rax
movslq -0x30(%rbp),%rdi
movsd  (%rax,%rdi,8),%xmm0
lea    0xe5b(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    1165 <print_precincts_weight_profit+0x55>
lea    0xe3d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1140 <print_precincts_weight_profit+0x30>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_precincts_weight_profit>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %r8,0x18(%rsp)
mov    %rcx,%r15
mov    %rdx,%rbx
mov    %esi,0xc(%rsp)
mov    %rdi,%rbp
lea    0xec3(%rip),%rdi
call   1040 <puts@plt>
mov    %rbp,0x20(%rsp)
test   %rbp,%rbp
jle    11ed <print_precincts_weight_profit+0xbd>
mov    0xc(%rsp),%r13d
xor    %eax,%eax
mov    %rax,0x10(%rsp)
lea    0xe83(%rip),%rbp
jmp    11a2 <print_precincts_weight_profit+0x72>
nop
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x10(%rsp),%rcx
add    $0x1,%rcx
mov    %rcx,%rax
mov    %rcx,0x10(%rsp)
cmp    0x20(%rsp),%rcx
je     11ed <print_precincts_weight_profit+0xbd>
cmpl   $0x0,0xc(%rsp)
jle    1180 <print_precincts_weight_profit+0x50>
mov    0x18(%rsp),%rax
mov    0x10(%rsp),%rcx
mov    (%rax,%rcx,8),%r14
xor    %r12d,%r12d
nopw   0x0(%rax,%rax,1)
mov    (%rbx,%r14,8),%rax
mov    (%rax,%r12,8),%rcx
mov    (%r15,%r14,8),%rax
movsd  (%rax,%r12,8),%xmm0
mov    %rbp,%rdi
mov    %r14,%rsi
mov    %r12d,%edx
mov    $0x1,%al
call   1050 <printf@plt>
add    $0x1,%r12
cmp    %r12,%r13
jne    11c0 <print_precincts_weight_profit+0x90>
jmp    1180 <print_precincts_weight_profit+0x50>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str.1 = [26 x i8] c"w[%ld][%d] = %ld / %lf \09\00"
@str = [2 x i8] c"\0A\00"
define void @print_precincts_weight_profit(i64 %0, i32 %1, i64** nocapture %2, double** nocapture %3, i64* nocapture %4) {
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
%7 = icmp sgt i64 %0, 0
br i1 %7, label %8, label %34
8: ; preds = %5
%9 = icmp sgt i32 %1, 0
%10 = zext i32 %1 to i64
br label %11
11: ; preds = %8, %30
%12 = phi i64 [ 0, %8 ], [ %32, %30 ]
%13 = getelementptr inbounds i64, i64* %4, i64 %12
%14 = load i64, i64* %13
br i1 %9, label %15, label %30
15: ; preds = %11
%16 = getelementptr inbounds i64*, i64** %2, i64 %14
%17 = getelementptr inbounds double*, double** %3, i64 %14
br label %18
18: ; preds = %15, %18
%19 = phi i64 [ 0, %15 ], [ %28, %18 ]
%20 = load i64*, i64** %16
%21 = getelementptr inbounds i64, i64* %20, i64 %19
%22 = load i64, i64* %21
%23 = load double*, double** %17
%24 = getelementptr inbounds double, double* %23, i64 %19
%25 = load double, double* %24
%26 = trunc i64 %19 to i32
%27 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i64 %14, i32 %26, i64 %22, double %25)
%28 = add nuw nsw i64 %19, 1
%29 = icmp eq i64 %28, %10
br i1 %29, label %30, label %18
30: ; preds = %18, %11
%31 = tail call i32 @putchar(i32 10)
%32 = add nuw nsw i64 %12, 1
%33 = icmp eq i64 %32, %0
br i1 %33, label %34, label %11
34: ; preds = %30, %5
ret void
}