#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 */
typedef int /*<<< orphan*/ mpq_t;

/* Variables and functions */
int /*<<< orphan*/ free_wrapper(int /*<<< orphan*/ *);
int /*<<< orphan*/ mpq_clear(int /*<<< orphan*/);
void clear_laplacian(int u, mpq_t *l) {
  for (int i = 0; i < u; i++)
    for (int j = 0; j < u; j++)
      mpq_clear(l[i * u + j]);
  free_wrapper(l);
}


x86 assembly (clang, -O0):
<clear_laplacian>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    118f <clear_laplacian+0x6f>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    117c <clear_laplacian+0x5c>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
imul   -0x4(%rbp),%ecx
add    -0x18(%rbp),%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%edi
call   1030 <mpq_clear@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1149 <clear_laplacian+0x29>
jmp    1181 <clear_laplacian+0x61>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1136 <clear_laplacian+0x16>
mov    -0x10(%rbp),%rdi
call   1040 <free_wrapper@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clear_laplacian>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
test   %edi,%edi
jle    117d <clear_laplacian+0x5d>
mov    %edi,%r13d
lea    0x0(,%r13,4),%r15
xor    %r12d,%r12d
mov    %r14,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    (%rbx,%rbp,4),%edi
call   1030 <mpq_clear@plt>
add    $0x1,%rbp
cmp    %rbp,%r13
jne    1160 <clear_laplacian+0x40>
add    $0x1,%r12
add    %r15,%rbx
cmp    %r13,%r12
jne    1150 <clear_laplacian+0x30>
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <free_wrapper@plt>

LLVM IR (-O0):
define void @clear_laplacian(i32 %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i32* %1, i32** %4
store i32 0, i32* %5
br label %7
7: ; preds = %31, %2
%8 = load i32, i32* %5
%9 = load i32, i32* %3
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %34
11: ; preds = %7
store i32 0, i32* %6
br label %12
12: ; preds = %27, %11
%13 = load i32, i32* %6
%14 = load i32, i32* %3
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %30
16: ; preds = %12
%17 = load i32*, i32** %4
%18 = load i32, i32* %5
%19 = load i32, i32* %3
%20 = mul nsw i32 %18, %19
%21 = load i32, i32* %6
%22 = add nsw i32 %20, %21
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i32, i32* %17, i64 %23
%25 = load i32, i32* %24
%26 = call i32 @mpq_clear(i32 %25)
br label %27
27: ; preds = %16
%28 = load i32, i32* %6
%29 = add nsw i32 %28, 1
store i32 %29, i32* %6
br label %12
30: ; preds = %12
br label %31
31: ; preds = %30
%32 = load i32, i32* %5
%33 = add nsw i32 %32, 1
store i32 %33, i32* %5
br label %7
34: ; preds = %7
%35 = load i32*, i32** %4
%36 = call i32 @free_wrapper(i32* %35)
ret void
}

LLVM IR (-O2):
define void @clear_laplacian(i32 %0, i32* %1) {
%3 = icmp sgt i32 %0, 0
br i1 %3, label %4, label %10
4: ; preds = %2
%5 = zext i32 %0 to i64
%6 = zext i32 %0 to i64
br label %7
7: ; preds = %12, %4
%8 = phi i64 [ 0, %4 ], [ %13, %12 ]
%9 = mul nsw i64 %8, %5
br label %15
10: ; preds = %12, %2
%11 = tail call i32 @free_wrapper(i32* %1)
ret void
12: ; preds = %15
%13 = add nuw nsw i64 %8, 1
%14 = icmp eq i64 %13, %6
br i1 %14, label %10, label %7
15: ; preds = %7, %15
%16 = phi i64 [ 0, %7 ], [ %21, %15 ]
%17 = add nuw nsw i64 %16, %9
%18 = getelementptr inbounds i32, i32* %1, i64 %17
%19 = load i32, i32* %18
%20 = tail call i32 @mpq_clear(i32 %19)
%21 = add nuw nsw i64 %16, 1
%22 = icmp eq i64 %21, %6
br i1 %22, label %12, label %15
}