#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*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, int, int);
void dump_lattice_to_file(FILE *fout, char *plattice, int dim) {
  assert(fout != NULL);
  assert(plattice != NULL);
  assert(dim > 0);
  char(*lattice)[dim] = (char(*)[dim])plattice;
  int i, j;
  for (i = 0; i < dim; i++)
    for (j = 0; j < dim; j++)
      if (lattice[i][j])
        fprintf(fout, "%d %d\n", j, i);
}


x86 assembly (clang, -O0):
<dump_lattice_to_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
cmpq   $0x0,-0x8(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
cmpq   $0x0,-0x10(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
cmpl   $0x0,-0x14(%rbp)
setg   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x14(%rbp),%eax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11fa <dump_lattice_to_file+0xda>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11e7 <dump_lattice_to_file+0xc7>
mov    -0x30(%rbp),%rdx
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
imul   %rdx,%rcx
add    %rcx,%rax
movslq -0x28(%rbp),%rcx
cmpb   $0x0,(%rax,%rcx,1)
je     11d4 <dump_lattice_to_file+0xb4>
mov    -0x8(%rbp),%rdi
mov    -0x28(%rbp),%edx
mov    -0x24(%rbp),%ecx
lea    0xe31(%rip),%rsi
call   1040 <fprintf@plt>
jmp    11d9 <dump_lattice_to_file+0xb9>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1191 <dump_lattice_to_file+0x71>
jmp    11ec <dump_lattice_to_file+0xcc>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    117e <dump_lattice_to_file+0x5e>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dump_lattice_to_file>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edx,%ebx
mov    %rsi,%r15
mov    %rdi,%r14
xor    %edi,%edi
test   %r14,%r14
setne  %dil
call   1030 <assert@plt>
xor    %edi,%edi
test   %r15,%r15
setne  %dil
call   1030 <assert@plt>
xor    %edi,%edi
test   %ebx,%ebx
setg   %dil
call   1030 <assert@plt>
test   %ebx,%ebx
jle    11a2 <dump_lattice_to_file+0x82>
mov    %ebx,%ebp
xor    %r13d,%r13d
lea    0xe94(%rip),%r12
jmp    117c <dump_lattice_to_file+0x5c>
xchg   %ax,%ax
add    $0x1,%r13
add    %rbp,%r15
cmp    %rbp,%r13
je     11a2 <dump_lattice_to_file+0x82>
xor    %ebx,%ebx
jmp    1189 <dump_lattice_to_file+0x69>
add    $0x1,%rbx
cmp    %rbx,%rbp
je     1170 <dump_lattice_to_file+0x50>
cmpb   $0x0,(%r15,%rbx,1)
je     1180 <dump_lattice_to_file+0x60>
mov    %r14,%rdi
mov    %r12,%rsi
mov    %ebx,%edx
mov    %r13d,%ecx
call   1040 <fprintf@plt>
jmp    1180 <dump_lattice_to_file+0x60>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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