#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, int, int);
void test_hash() {
  int dev, block;
  for (dev = 0; dev <= 3; dev++)
    for (block = 0; block <= 15; block++)
      printf("hash dev=%d block=%d : %d\n", dev, block, ((dev ^ block) % 10));
}


x86 assembly (clang, -O0):
<test_hash>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
cmpl   $0x3,-0x4(%rbp)
jg     1183 <test_hash+0x73>
movl   $0x0,-0x8(%rbp)
cmpl   $0xf,-0x8(%rbp)
jg     1170 <test_hash+0x60>
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
xor    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,%ecx
mov    -0xc(%rbp),%edx
lea    0xea3(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1130 <test_hash+0x20>
jmp    1175 <test_hash+0x65>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    111f <test_hash+0xf>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_hash>:
push   %r15
push   %r14
push   %rbx
xor    %ebx,%ebx
mov    $0xcccccccd,%r15d
lea    0xedc(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %ebx,%eax
imul   %r15,%rax
shr    $0x23,%rax
add    %eax,%eax
lea    (%rax,%rax,4),%eax
mov    %ebx,%ecx
sub    %eax,%ecx
mov    %r14,%rdi
xor    %esi,%esi
mov    %ebx,%edx
call   1030 <printf@plt>
add    $0x1,%ebx
cmp    $0x10,%ebx
jne    1130 <test_hash+0x20>
xor    %ebx,%ebx
mov    $0xcccccccd,%r15d
lea    0xe9a(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
mov    %ebx,%ecx
xor    $0x1,%ecx
mov    %rcx,%rax
imul   %r15,%rax
shr    $0x23,%rax
add    %eax,%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%ecx
mov    %r14,%rdi
mov    $0x1,%esi
mov    %ebx,%edx
call   1030 <printf@plt>
add    $0x1,%ebx
cmp    $0x10,%ebx
jne    1170 <test_hash+0x60>
xor    %ebx,%ebx
mov    $0xcccccccd,%r15d
lea    0xe53(%rip),%r14
nopl   (%rax)
mov    %ebx,%ecx
xor    $0x2,%ecx
mov    %rcx,%rax
imul   %r15,%rax
shr    $0x23,%rax
add    %eax,%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%ecx
mov    %r14,%rdi
mov    $0x2,%esi
mov    %ebx,%edx
call   1030 <printf@plt>
add    $0x1,%ebx
cmp    $0x10,%ebx
jne    11b0 <test_hash+0xa0>
xor    %ebx,%ebx
mov    $0xcccccccd,%r15d
lea    0xe13(%rip),%r14
nopl   (%rax)
mov    %ebx,%ecx
xor    $0x3,%ecx
mov    %rcx,%rax
imul   %r15,%rax
shr    $0x23,%rax
add    %eax,%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%ecx
mov    %r14,%rdi
mov    $0x3,%esi
mov    %ebx,%edx
call   1030 <printf@plt>
add    $0x1,%ebx
cmp    $0x10,%ebx
jne    11f0 <test_hash+0xe0>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [27 x i8] c"hash dev=%d block=%d : %d\0A\00"
define void @test_hash() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
br label %3
3: ; preds = %22, %0
%4 = load i32, i32* %1
%5 = icmp sle i32 %4, 3
br i1 %5, label %6, label %25
6: ; preds = %3
store i32 0, i32* %2
br label %7
7: ; preds = %18, %6
%8 = load i32, i32* %2
%9 = icmp sle i32 %8, 15
br i1 %9, label %10, label %21
10: ; preds = %7
%11 = load i32, i32* %1
%12 = load i32, i32* %2
%13 = load i32, i32* %1
%14 = load i32, i32* %2
%15 = xor i32 %13, %14
%16 = srem i32 %15, 10
%17 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 %11, i32 %12, i32 %16)
br label %18
18: ; preds = %10
%19 = load i32, i32* %2
%20 = add nsw i32 %19, 1
store i32 %20, i32* %2
br label %7
21: ; preds = %7
br label %22
22: ; preds = %21
%23 = load i32, i32* %1
%24 = add nsw i32 %23, 1
store i32 %24, i32* %1
br label %3
25: ; preds = %3
ret void
}

LLVM IR (-O2):
@.str = [27 x i8] c"hash dev=%d block=%d : %d\0A\00"
define void @test_hash() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 0, %0 ], [ %5, %1 ]
%3 = urem i32 %2, 10
%4 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 0, i32 %2, i32 %3)
%5 = add nuw nsw i32 %2, 1
%6 = icmp eq i32 %5, 16
br i1 %6, label %7, label %1
7: ; preds = %1, %7
%8 = phi i32 [ %12, %7 ], [ 0, %1 ]
%9 = xor i32 %8, 1
%10 = urem i32 %9, 10
%11 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 1, i32 %8, i32 %10)
%12 = add nuw nsw i32 %8, 1
%13 = icmp eq i32 %12, 16
br i1 %13, label %14, label %7
14: ; preds = %7, %14
%15 = phi i32 [ %19, %14 ], [ 0, %7 ]
%16 = xor i32 %15, 2
%17 = urem i32 %16, 10
%18 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 2, i32 %15, i32 %17)
%19 = add nuw nsw i32 %15, 1
%20 = icmp eq i32 %19, 16
br i1 %20, label %21, label %14
21: ; preds = %14, %21
%22 = phi i32 [ %26, %21 ], [ 0, %14 ]
%23 = xor i32 %22, 3
%24 = urem i32 %23, 10
%25 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 3, i32 %22, i32 %24)
%26 = add nuw nsw i32 %22, 1
%27 = icmp eq i32 %26, 16
br i1 %27, label %28, label %21
28: ; preds = %21
ret void
}