#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*/ uint8_t;
typedef int uint32_t;

/* Variables and functions */
int hashlittle(int /*<<< orphan*/ *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, ...);
void driver4() {
  uint8_t buf[1];
  uint32_t h, i, state[1];
  buf[0] = ~0;
  for (i = 0; i < 1; ++i)
    state[i] = 1;
  printf("These should all be different\n");
  for (i = 0, h = 0; i < 8; ++i) {
    h = hashlittle(buf, 0, h);
    printf("%2ld  0-byte strings, hash is  %.8x\n", i, h);
  }
}


x86 assembly (clang, -O0):
<driver4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0xffffffff,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x1,-0xc(%rbp)
jge    115a <driver4+0x3a>
movslq -0xc(%rbp),%rax
movl   $0x1,-0x10(%rbp,%rax,4)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1136 <driver4+0x16>
lea    0xe9f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x8,-0xc(%rbp)
jge    11b3 <driver4+0x93>
lea    -0x4(%rbp),%rdi
mov    -0x8(%rbp),%edx
xor    %esi,%esi
call   1030 <hashlittle@plt>
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xe81(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1176 <driver4+0x56>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<driver4>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
movl   $0xffffffff,0xc(%rsp)
ff
lea    0xede(%rip),%rdi
call   1030 <puts@plt>
lea    0xc(%rsp),%r14
mov    %r14,%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1040 <hashlittle@plt>
mov    %eax,%ebp
lea    0xe9a(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r14,%rdi
xor    %esi,%esi
mov    %ebp,%edx
call   1040 <hashlittle@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
mov    $0x1,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r14,%rdi
xor    %esi,%esi
mov    %ebp,%edx
call   1040 <hashlittle@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
mov    $0x2,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r14,%rdi
xor    %esi,%esi
mov    %ebp,%edx
call   1040 <hashlittle@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
mov    $0x3,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r14,%rdi
xor    %esi,%esi
mov    %ebp,%edx
call   1040 <hashlittle@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
mov    $0x4,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r14,%rdi
xor    %esi,%esi
mov    %ebp,%edx
call   1040 <hashlittle@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
mov    $0x5,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r14,%rdi
xor    %esi,%esi
mov    %ebp,%edx
call   1040 <hashlittle@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
mov    $0x6,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r14,%rdi
xor    %esi,%esi
mov    %ebp,%edx
call   1040 <hashlittle@plt>
mov    %rbx,%rdi
mov    $0x7,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [31 x i8] c"These should all be different\0A\00"
@.str.1 = [37 x i8] c"%2ld 0-byte strings, hash is %.8x\0A\00"
define void @driver4() {
%1 = alloca [1 x i32]
%2 = alloca i32
%3 = alloca i32
%4 = alloca [1 x i32]
%5 = getelementptr inbounds [1 x i32], [1 x i32]* %1, i64 0, i64 0
store i32 -1, i32* %5
store i32 0, i32* %3
br label %6
6: ; preds = %13, %0
%7 = load i32, i32* %3
%8 = icmp slt i32 %7, 1
br i1 %8, label %9, label %16
9: ; preds = %6
%10 = load i32, i32* %3
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [1 x i32], [1 x i32]* %4, i64 0, i64 %11
store i32 1, i32* %12
br label %13
13: ; preds = %9
%14 = load i32, i32* %3
%15 = add nsw i32 %14, 1
store i32 %15, i32* %3
br label %6
16: ; preds = %6
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
store i32 0, i32* %2
br label %18
18: ; preds = %28, %16
%19 = load i32, i32* %3
%20 = icmp slt i32 %19, 8
br i1 %20, label %21, label %31
21: ; preds = %18
%22 = getelementptr inbounds [1 x i32], [1 x i32]* %1, i64 0, i64 0
%23 = load i32, i32* %2
%24 = call i32 @hashlittle(i32* %22, i32 0, i32 %23)
store i32 %24, i32* %2
%25 = load i32, i32* %3
%26 = load i32, i32* %2
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i32 %25, i32 %26)
br label %28
28: ; preds = %21
%29 = load i32, i32* %3
%30 = add nsw i32 %29, 1
store i32 %30, i32* %3
br label %18
31: ; preds = %18
ret void
}

LLVM IR (-O2):
@.str.1 = [37 x i8] c"%2ld 0-byte strings, hash is %.8x\0A\00"
@str = [30 x i8] c"These should all be different\00"
define void @driver4() {
%1 = alloca [1 x i32]
%2 = bitcast [1 x i32]* %1 to i8*
%3 = getelementptr inbounds [1 x i32], [1 x i32]* %1, i64 0, i64 0
store i32 -1, i32* %3
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
%5 = call i32 @hashlittle(i32* %3, i32 0, i32 0)
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i32 0, i32 %5)
%7 = call i32 @hashlittle(i32* %3, i32 0, i32 %5)
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i32 1, i32 %7)
%9 = call i32 @hashlittle(i32* %3, i32 0, i32 %7)
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i32 2, i32 %9)
%11 = call i32 @hashlittle(i32* %3, i32 0, i32 %9)
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i32 3, i32 %11)
%13 = call i32 @hashlittle(i32* %3, i32 0, i32 %11)
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i32 4, i32 %13)
%15 = call i32 @hashlittle(i32* %3, i32 0, i32 %13)
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i32 5, i32 %15)
%17 = call i32 @hashlittle(i32* %3, i32 0, i32 %15)
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i32 6, i32 %17)
%19 = call i32 @hashlittle(i32* %3, i32 0, i32 %17)
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i32 7, i32 %19)
ret void
}