#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 sh_dump(FILE *stream, int *bsizes, void ***table, char ***keys, int size) {
  int i;
  fprintf(stream, "hash-table size: %d buckets\n", size);
  for (i = 0; i < size; i++) {
    fprintf(stream, "bucket %d:\tsize %d:\t", i, bsizes[i]);
    if (bsizes[i]) {
      int j;
      for (j = 0; j < bsizes[i]; j++) {
        fprintf(stream, "%s%s (%p)", (!j ? "" : ", "), keys[i][j], table[i][j]);
      }
    }
    fprintf(stream, "\n");
  }
}


x86 assembly (clang, -O0):
<sh_dump>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x24(%rbp),%edx
lea    0xec6(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    122d <sh_dump+0x11d>
mov    -0x8(%rbp),%rdi
mov    -0x28(%rbp),%edx
mov    -0x10(%rbp),%rax
movslq -0x28(%rbp),%rcx
mov    (%rax,%rcx,4),%ecx
lea    0xeb0(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x10(%rbp),%rax
movslq -0x28(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
je     120d <sh_dump+0xfd>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
mov    -0x10(%rbp),%rcx
movslq -0x28(%rbp),%rdx
cmp    (%rcx,%rdx,4),%eax
jge    1208 <sh_dump+0xf8>
mov    -0x8(%rbp),%rdi
cmpl   $0x0,-0x2c(%rbp)
setne  %cl
xor    $0xff,%cl
lea    0xe86(%rip),%rdx
lea    0xe74(%rip),%rax
test   $0x1,%cl
cmovne %rax,%rdx
mov    -0x20(%rbp),%rax
movslq -0x28(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,8),%rcx
mov    -0x18(%rbp),%rax
movslq -0x28(%rbp),%rsi
mov    (%rax,%rsi,8),%rax
movslq -0x2c(%rbp),%rsi
mov    (%rax,%rsi,8),%r8
lea    0xe3f(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    118d <sh_dump+0x7d>
jmp    120d <sh_dump+0xfd>
mov    -0x8(%rbp),%rdi
lea    0xe03(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1148 <sh_dump+0x38>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sh_dump>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %r8d,%r14d
mov    %rcx,0x8(%rsp)
mov    %rdx,0x18(%rsp)
mov    %rsi,%r12
mov    %rdi,%rbp
lea    0xeb8(%rip),%rsi
mov    %r8d,%edx
xor    %eax,%eax
call   1040 <fprintf@plt>
test   %r14d,%r14d
jle    1236 <sh_dump+0x116>
mov    %r14d,%eax
mov    %rax,0x10(%rsp)
xor    %r15d,%r15d
mov    %r12,0x20(%rsp)
mov    0x18(%rsp),%rbx
jmp    119f <sh_dump+0x7f>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0xa,%edi
mov    %r9,%rbp
mov    %r9,%rsi
call   1030 <fputc@plt>
add    $0x1,%r15
cmp    0x10(%rsp),%r15
je     1236 <sh_dump+0x116>
mov    (%r12,%r15,4),%ecx
mov    %rbp,%rdi
lea    0xe70(%rip),%rsi
mov    %r15d,%edx
xor    %eax,%eax
call   1040 <fprintf@plt>
cmpl   $0x0,(%r12,%r15,4)
mov    %rbp,%r9
lea    0xe6b(%rip),%rcx
mov    0x8(%rsp),%rdi
lea    0xe6a(%rip),%r14
lea    0xe59(%rip),%r13
jle    1180 <sh_dump+0x60>
xor    %ebp,%ebp
nopl   (%rax)
test   %rbp,%rbp
mov    %r14,%rdx
cmove  %rcx,%rdx
mov    (%rdi,%r15,8),%rax
mov    (%rax,%rbp,8),%rcx
mov    (%rbx,%r15,8),%rax
mov    (%rax,%rbp,8),%r8
mov    %r9,%rdi
mov    %r15,%r12
mov    %r9,%r15
mov    %r13,%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    0x8(%rsp),%rdi
mov    %r15,%r9
mov    %r12,%r15
lea    0xe12(%rip),%rcx
mov    0x20(%rsp),%r12
add    $0x1,%rbp
movslq (%r12,%r15,4),%rax
cmp    %rax,%rbp
jl     11e0 <sh_dump+0xc0>
jmp    1180 <sh_dump+0x60>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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