#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_weights_values(long max_precincts, int max_quality_layers,
                          long **weights) {
  int i, j;
  printf("\nweights (precincts sizes in bytes): \n");
  for (i = 0; i < max_precincts; i++) {
    for (j = 0; j < max_quality_layers; j++) {
      printf(" %4ld ", weights[i][j]);
    }
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<print_weights_values>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
lea    0xed6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x1c(%rbp)
movslq -0x1c(%rbp),%rax
cmp    -0x8(%rbp),%rax
jge    11a5 <print_weights_values+0x95>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1189 <print_weights_values+0x79>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    114d <print_weights_values+0x3d>
lea    0xe95(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1138 <print_weights_values+0x28>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_weights_values>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r13
mov    %esi,0x4(%rsp)
mov    %rdi,%r15
lea    0xebb(%rip),%rdi
call   1040 <puts@plt>
test   %r15,%r15
jle    11ae <print_weights_values+0x7e>
mov    0x4(%rsp),%ebp
lea    0xe9f(%rip),%r12
xor    %ebx,%ebx
jmp    1183 <print_weights_values+0x53>
cs nopw 0x0(%rax,%rax,1)
nop
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
cmp    %r15,%rbx
je     11ae <print_weights_values+0x7e>
cmpl   $0x0,0x4(%rsp)
jle    1170 <print_weights_values+0x40>
xor    %r14d,%r14d
nopl   (%rax)
mov    0x0(%r13,%rbx,8),%rax
mov    (%rax,%r14,8),%rsi
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%r14
cmp    %r14,%rbp
jne    1190 <print_weights_values+0x60>
jmp    1170 <print_weights_values+0x40>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [39 x i8] c"\0Aweights (precincts sizes in bytes): \0A\00"
@.str.1 = [7 x i8] c" %4ld \00"
@.str.2 = [2 x i8] c"\0A\00"
define void @print_weights_values(i64 %0, i32 %1, i64** %2) {
%4 = alloca i64
%5 = alloca i32
%6 = alloca i64**
%7 = alloca i32
%8 = alloca i32
store i64 %0, i64* %4
store i32 %1, i32* %5
store i64** %2, i64*** %6
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %7
br label %10
10: ; preds = %36, %3
%11 = load i32, i32* %7
%12 = sext i32 %11 to i64
%13 = load i64, i64* %4
%14 = icmp slt i64 %12, %13
br i1 %14, label %15, label %39
15: ; preds = %10
store i32 0, i32* %8
br label %16
16: ; preds = %31, %15
%17 = load i32, i32* %8
%18 = load i32, i32* %5
%19 = icmp slt i32 %17, %18
br i1 %19, label %20, label %34
20: ; preds = %16
%21 = load i64**, i64*** %6
%22 = load i32, i32* %7
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i64*, i64** %21, i64 %23
%25 = load i64*, i64** %24
%26 = load i32, i32* %8
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i64, i64* %25, i64 %27
%29 = load i64, i64* %28
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i64 %29)
br label %31
31: ; preds = %20
%32 = load i32, i32* %8
%33 = add nsw i32 %32, 1
store i32 %33, i32* %8
br label %16
34: ; preds = %16
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %36
36: ; preds = %34
%37 = load i32, i32* %7
%38 = add nsw i32 %37, 1
store i32 %38, i32* %7
br label %10
39: ; preds = %10
ret void
}

LLVM IR (-O2):
@.str.1 = [7 x i8] c" %4ld \00"
@str = [38 x i8] c"\0Aweights (precincts sizes in bytes): \00"
define void @print_weights_values(i64 %0, i32 %1, i64** nocapture %2) {
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str, i64 0, i64 0))
%5 = icmp sgt i64 %0, 0
br i1 %5, label %6, label %25
6: ; preds = %3
%7 = icmp sgt i32 %1, 0
%8 = zext i32 %1 to i64
br label %9
9: ; preds = %6, %21
%10 = phi i64 [ 0, %6 ], [ %23, %21 ]
br i1 %7, label %11, label %21
11: ; preds = %9
%12 = getelementptr inbounds i64*, i64** %2, i64 %10
br label %13
13: ; preds = %11, %13
%14 = phi i64 [ 0, %11 ], [ %19, %13 ]
%15 = load i64*, i64** %12
%16 = getelementptr inbounds i64, i64* %15, i64 %14
%17 = load i64, i64* %16
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i64 %17)
%19 = add nuw nsw i64 %14, 1
%20 = icmp eq i64 %19, %8
br i1 %20, label %21, label %13
21: ; preds = %13, %9
%22 = tail call i32 @putchar(i32 10)
%23 = add nuw nsw i64 %10, 1
%24 = icmp eq i64 %23, %0
br i1 %24, label %25, label %9
25: ; preds = %21, %3
ret void
}