#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*/ ulong;
typedef int /*<<< orphan*/ loff_t;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
scalar_t__ file_crc(char *, int /*<<< orphan*/, int /*<<< orphan*/,
                    int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, char *, ...);
int main(int argc, char *argv[]) {
  loff_t start = 0, size = ~0;
  ulong crc = 0, total = 0;
  char *filename = NULL;
  int i;
  if (!filename && argc < 2) {
    printf("usage: %s filename\n", argv[0]);
    exit(1);
  }
  for (i = 1; i < argc; i++) {
    filename = argv[i];
    if (file_crc(filename, start, size, &crc, &total) < 0)
      exit(1);
    printf("%08lx\t%s\n", crc, filename);
  }
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0xffffffff,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    119e <main+0x6e>
cmpl   $0x2,-0x8(%rbp)
jge    119e <main+0x6e>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe73(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
movl   $0x1,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1210 <main+0xe0>
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
lea    -0x1c(%rbp),%rcx
lea    -0x20(%rbp),%r8
call   1040 <file_crc@plt>
cmp    $0x0,%rax
jge    11ec <main+0xbc>
mov    $0x1,%edi
call   1050 <exit@plt>
movslq -0x1c(%rbp),%rsi
mov    -0x28(%rbp),%rdx
lea    0xe19(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    11a5 <main+0x75>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r13
movl   $0x0,(%rsp)
movl   $0x0,0x4(%rsp)
cmp    $0x2,%edi
jge    116e <main+0x3e>
mov    0x0(%r13),%rsi
lea    0xea3(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    %edi,%ebp
mov    $0x1,%r14d
lea    0x4(%rsp),%r15
lea    0xe92(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    0x0(%r13,%r14,8),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0xffffffff,%edx
mov    %rsp,%rcx
mov    %r15,%r8
call   1040 <file_crc@plt>
test   %rax,%rax
js     1164 <main+0x34>
movslq (%rsp),%rsi
mov    %r12,%rdi
mov    %rbx,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x1,%r14
cmp    %r14,%rbp
jne    1190 <main+0x60>
xor    %edi,%edi
call   1050 <exit@plt>

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

LLVM IR (-O2):
@.str = [20 x i8] c"usage: %s filename\0A\00"
@.str.1 = [10 x i8] c"%08lx\09%s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%6 = bitcast i32* %4 to i8*
store i32 0, i32* %4
%7 = icmp slt i32 %0, 2
br i1 %7, label %10, label %8
8: ; preds = %2
%9 = zext i32 %0 to i64
br label %14
10: ; preds = %2
%11 = load i8*, i8** %1
%12 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %11)
%13 = tail call i32 @exit(i32 1)
unreachable
14: ; preds = %8, %22
%15 = phi i64 [ 1, %8 ], [ %27, %22 ]
%16 = getelementptr inbounds i8*, i8** %1, i64 %15
%17 = load i8*, i8** %16
%18 = call i64 @file_crc(i8* %17, i32 0, i32 -1, i32* %3, i32* %4)
%19 = icmp slt i64 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %14
%21 = call i32 @exit(i32 1)
unreachable
22: ; preds = %14
%23 = load i32, i32* %3
%24 = sext i32 %23 to i64
%25 = inttoptr i64 %24 to i8*
%26 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* %25, i8* %17)
%27 = add nuw nsw i64 %15, 1
%28 = icmp eq i64 %27, %9
br i1 %28, label %29, label %14
29: ; preds = %22
%30 = call i32 @exit(i32 0)
unreachable
}