#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 *, int, ...);
void print_panel_seg(int n, int w, int jcol, int nseg, int *segrep,
                     int *repfnz) {
  int j, k;
  for (j = jcol; j < jcol + w; j++) {
    printf("\tcol %d:\n", j);
    for (k = 0; k < nseg; k++)
      printf("\t\tseg %d, segrep %d, repfnz %d\n", k, segrep[k],
             repfnz[(j - jcol) * n + segrep[k]]);
  }
}


x86 assembly (clang, -O0):
<print_panel_seg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8,-0x18(%rbp)
mov    %r9,-0x20(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    -0xc(%rbp),%ecx
add    -0x8(%rbp),%ecx
cmp    %ecx,%eax
jge    11c4 <print_panel_seg+0xb4>
mov    -0x24(%rbp),%esi
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11b1 <print_panel_seg+0xa1>
mov    -0x28(%rbp),%esi
mov    -0x18(%rbp),%rax
movslq -0x28(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x20(%rbp),%rax
mov    -0x24(%rbp),%ecx
sub    -0xc(%rbp),%ecx
imul   -0x4(%rbp),%ecx
mov    -0x18(%rbp),%rdi
movslq -0x28(%rbp),%r8
add    (%rdi,%r8,4),%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%ecx
lea    0xe6e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    115b <print_panel_seg+0x4b>
jmp    11b6 <print_panel_seg+0xa6>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1132 <print_panel_seg+0x22>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_panel_seg>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %ecx,0xc(%rsp)
mov    %edx,0x4(%rsp)
mov    %edi,0x14(%rsp)
mov    %esi,0x8(%rsp)
test   %esi,%esi
jle    11c6 <print_panel_seg+0xb6>
mov    %r9,%r14
mov    %r8,%rbx
mov    0x4(%rsp),%eax
add    %eax,0x8(%rsp)
mov    0xc(%rsp),%ebp
lea    0xebb(%rip),%r13
mov    %eax,%esi
jmp    116d <print_panel_seg+0x5d>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    0x10(%rsp),%esi
add    $0x1,%esi
cmp    0x8(%rsp),%esi
jge    11c6 <print_panel_seg+0xb6>
lea    0xe8c(%rip),%rdi
mov    %esi,0x10(%rsp)
xor    %eax,%eax
call   1030 <printf@plt>
cmpl   $0x0,0xc(%rsp)
jle    1160 <print_panel_seg+0x50>
mov    0x10(%rsp),%eax
mov    %eax,%r15d
sub    0x4(%rsp),%r15d
imul   0x14(%rsp),%r15d
xor    %r12d,%r12d
nopl   0x0(%rax,%rax,1)
mov    (%rbx,%r12,4),%edx
lea    (%rdx,%r15,1),%eax
cltq
mov    (%r14,%rax,4),%ecx
mov    %r13,%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x1,%r12
cmp    %r12,%rbp
jne    11a0 <print_panel_seg+0x90>
jmp    1160 <print_panel_seg+0x50>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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