#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 shash(char *);
scalar_t__ strlen(char *);
int main(int argc, char *argv[]) {
  int i;
  if (argc <= 1) {
    printf("Usage: shash <string> ...\n");
    return -1;
  }
  for (i = 1; i < argc; i++) {
    if (argv[i] && strlen(argv[i]) > 0)
      printf("0x%08x: /* \"%s\" */\r\n", shash(argv[i]), argv[i]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jg     116a <main+0x3a>
lea    0xea9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11f2 <main+0xc2>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11eb <main+0xbb>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     11d8 <main+0xa8>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <strlen@plt>
cmp    $0x0,%rax
jle    11d8 <main+0xa8>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1050 <shash@plt>
mov    %eax,%esi
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xe4a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11dd <main+0xad>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1171 <main+0x41>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
cmp    $0x2,%edi
jge    1161 <main+0x21>
lea    0xec0(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%eax
jmp    11bb <main+0x7b>
mov    %rsi,%r15
mov    %edi,%r12d
mov    $0x1,%ebx
lea    0xe8d(%rip),%r14
jmp    1189 <main+0x49>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%rbx
cmp    %rbx,%r12
je     11b9 <main+0x79>
mov    (%r15,%rbx,8),%r13
test   %r13,%r13
je     1180 <main+0x40>
mov    %r13,%rdi
call   1040 <strlen@plt>
test   %rax,%rax
jle    1180 <main+0x40>
mov    %r13,%rdi
call   1060 <shash@plt>
mov    (%r15,%rbx,8),%rdx
mov    %r14,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    1180 <main+0x40>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [27 x i8] c"Usage: shash <string> ...\0A\00"
@.str.1 = [21 x i8] c"0x%08x: /* \22%s\22 */\0D\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp sle i32 %7, 1
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %3
br label %49
11: ; preds = %2
store i32 1, i32* %6
br label %12
12: ; preds = %45, %11
%13 = load i32, i32* %6
%14 = load i32, i32* %4
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %48
16: ; preds = %12
%17 = load i8**, i8*** %5
%18 = load i32, i32* %6
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i8*, i8** %17, i64 %19
%21 = load i8*, i8** %20
%22 = icmp ne i8* %21, null
br i1 %22, label %23, label %44
23: ; preds = %16
%24 = load i8**, i8*** %5
%25 = load i32, i32* %6
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8*, i8** %24, i64 %26
%28 = load i8*, i8** %27
%29 = call i64 @strlen(i8* %28)
%30 = icmp sgt i64 %29, 0
br i1 %30, label %31, label %44
31: ; preds = %23
%32 = load i8**, i8*** %5
%33 = load i32, i32* %6
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds i8*, i8** %32, i64 %34
%36 = load i8*, i8** %35
%37 = call i32 @shash(i8* %36)
%38 = load i8**, i8*** %5
%39 = load i32, i32* %6
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds i8*, i8** %38, i64 %40
%42 = load i8*, i8** %41
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 %37, i8* %42)
br label %44
44: ; preds = %31, %23, %16
br label %45
45: ; preds = %44
%46 = load i32, i32* %6
%47 = add nsw i32 %46, 1
store i32 %47, i32* %6
br label %12
48: ; preds = %12
store i32 0, i32* %3
br label %49
49: ; preds = %48, %9
%50 = load i32, i32* %3
ret i32 %50
}

LLVM IR (-O2):
@.str.1 = [21 x i8] c"0x%08x: /* \22%s\22 */\0D\0A\00"
@str = [26 x i8] c"Usage: shash <string> ...\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = zext i32 %0 to i64
br label %8
6: ; preds = %2
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0))
br label %23
8: ; preds = %4, %20
%9 = phi i64 [ 1, %4 ], [ %21, %20 ]
%10 = getelementptr inbounds i8*, i8** %1, i64 %9
%11 = load i8*, i8** %10
%12 = icmp eq i8* %11, null
br i1 %12, label %20, label %13
13: ; preds = %8
%14 = tail call i64 @strlen(i8* %11)
%15 = icmp sgt i64 %14, 0
br i1 %15, label %16, label %20
16: ; preds = %13
%17 = tail call i32 @shash(i8* %11)
%18 = load i8*, i8** %10
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 %17, i8* %18)
br label %20
20: ; preds = %8, %13, %16
%21 = add nuw nsw i64 %9, 1
%22 = icmp eq i64 %21, %5
br i1 %22, label %23, label %8
23: ; preds = %20, %6
%24 = phi i32 [ -1, %6 ], [ 0, %20 ]
ret i32 %24
}