#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*/ fprintf(int /*<<< orphan*/ *, char *, ...);
void show(FILE *f, int mcount, int mwidth, const int *a) {
  for (int c = 0; c < mcount; c++) {
    for (int j = 0; j < mwidth; j++) {
      fprintf(f, "----");
    }
    fprintf(f, "letter %d\n", c);
    for (int i = 0; i < mwidth; i++) {
      for (int j = 0; j < mwidth; j++) {
        fprintf(f, "%4d", a[c * mwidth * mwidth + i * mwidth + j]);
      }
      fprintf(f, "\n");
    }
  }
}


x86 assembly (clang, -O0):
<show>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    121b <show+0x10b>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    116c <show+0x5c>
mov    -0x8(%rbp),%rdi
lea    0xea9(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1140 <show+0x30>
mov    -0x8(%rbp),%rdi
mov    -0x1c(%rbp),%edx
lea    0xe8b(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1208 <show+0xf8>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11e8 <show+0xd8>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%ecx
imul   -0x10(%rbp),%ecx
imul   -0x10(%rbp),%ecx
mov    -0x24(%rbp),%edx
imul   -0x10(%rbp),%edx
add    %edx,%ecx
add    -0x28(%rbp),%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%edx
lea    0xe3d(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    119b <show+0x8b>
mov    -0x8(%rbp),%rdi
lea    0xe1b(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1188 <show+0x78>
jmp    120d <show+0xfd>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    112d <show+0x1d>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<show>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rcx,0x20(%rsp)
mov    %edx,0x8(%rsp)
mov    %esi,0x14(%rsp)
test   %esi,%esi
jle    126e <show+0x13e>
mov    %rdi,%rbx
mov    0x8(%rsp),%eax
mov    %eax,%r14d
imul   %eax,%eax
mov    %eax,0x10(%rsp)
lea    0xe95(%rip),%r15
lea    0xe9e(%rip),%r13
movl   $0x0,0xc(%rsp)
xor    %r12d,%r12d
jmp    11bb <show+0x8b>
nop
mov    %rbx,%rdi
lea    0xe7b(%rip),%rsi
mov    %r12d,%edx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    0x18(%rsp),%r12d
add    $0x1,%r12d
mov    0xc(%rsp),%eax
add    0x10(%rsp),%eax
mov    %eax,0xc(%rsp)
cmp    0x14(%rsp),%r12d
lea    0xe4b(%rip),%r15
je     126e <show+0x13e>
mov    0x8(%rsp),%eax
mov    %eax,%ebp
test   %eax,%eax
mov    %r12d,0x18(%rsp)
jle    1180 <show+0x50>
nopw   0x0(%rax,%rax,1)
mov    $0x4,%esi
mov    $0x1,%edx
mov    %r15,%rdi
mov    %rbx,%rcx
call   1050 <fwrite@plt>
add    $0xffffffff,%ebp
jne    11d0 <show+0xa0>
mov    %rbx,%rdi
lea    0xe11(%rip),%rsi
mov    %r12d,%edx
xor    %eax,%eax
call   1040 <fprintf@plt>
cmpl   $0x0,0x8(%rsp)
jle    1194 <show+0x64>
mov    0xc(%rsp),%eax
xor    %r15d,%r15d
nopl   0x0(%rax)
mov    %eax,0x1c(%rsp)
cltq
mov    0x20(%rsp),%rcx
lea    (%rcx,%rax,4),%rbp
xor    %r12d,%r12d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    0x0(%rbp,%r12,4),%edx
mov    %rbx,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
add    $0x1,%r12
cmp    %r12,%r14
jne    1230 <show+0x100>
mov    $0xa,%edi
mov    %rbx,%rsi
call   1030 <fputc@plt>
add    $0x1,%r15
mov    0x1c(%rsp),%eax
add    0x8(%rsp),%eax
cmp    %r14,%r15
jne    1210 <show+0xe0>
jmp    1194 <show+0x64>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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