#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 */
scalar_t__ haval_file(char *, unsigned char *);
int /*<<< orphan*/ haval_print(unsigned char *);
int /*<<< orphan*/ haval_string(char *, unsigned char *);
int /*<<< orphan*/ printf(char *, ...);
void haval_cert(void) {
  unsigned int i;
  char *str;
  unsigned char fingerprint[128 >> 3];
  printf("\n");
  printf("HAVAL certification data (PASS=%d, FPTLEN=%d):", 3, 128);
  printf("\n");
  str = "";
  haval_string(str, fingerprint);
  printf("HAVAL(\"%s\") = ", str);
  haval_print(fingerprint);
  printf("\n");
  str = "a";
  haval_string(str, fingerprint);
  printf("HAVAL(\"%s\") = ", str);
  haval_print(fingerprint);
  printf("\n");
  str = "HAVAL";
  haval_string(str, fingerprint);
  printf("HAVAL(\"%s\") = ", str);
  haval_print(fingerprint);
  printf("\n");
  str = "0123456789";
  haval_string(str, fingerprint);
  printf("HAVAL(\"%s\") = ", str);
  haval_print(fingerprint);
  printf("\n");
  str = "abcdefghijklmnopqrstuvwxyz";
  haval_string(str, fingerprint);
  printf("HAVAL(\"%s\") = ", str);
  haval_print(fingerprint);
  printf("\n");
  str = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
  haval_string(str, fingerprint);
  printf("HAVAL(\"%s\")\n      = ", str);
  haval_print(fingerprint);
  printf("\n");
  str = "pi.frac";
  if (haval_file(str, fingerprint)) {
    printf("%s can not be opened !\n", str);
  } else {
    printf("HAVAL(File %s) = ", str);
    haval_print(fingerprint);
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<haval_cert>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xf84(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea3(%rip),%rdi
mov    $0x3,%esi
mov    $0x80,%edx
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf5e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf51(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1050 <haval_string@plt>
mov    -0x10(%rbp),%rsi
lea    0xe90(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x20(%rbp),%rdi
call   1040 <haval_print@plt>
lea    0xf1d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe7a(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1050 <haval_string@plt>
mov    -0x10(%rbp),%rsi
lea    0xe4f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x20(%rbp),%rdi
call   1040 <haval_print@plt>
lea    0xedc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe3b(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1050 <haval_string@plt>
mov    -0x10(%rbp),%rsi
lea    0xe0e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x20(%rbp),%rdi
call   1040 <haval_print@plt>
lea    0xe9b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe4f(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1050 <haval_string@plt>
mov    -0x10(%rbp),%rsi
lea    0xdcd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x20(%rbp),%rdi
call   1040 <haval_print@plt>
lea    0xe5a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xdbf(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1050 <haval_string@plt>
mov    -0x10(%rbp),%rsi
lea    0xd8c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x20(%rbp),%rdi
call   1040 <haval_print@plt>
lea    0xe19(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xd99(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1050 <haval_string@plt>
mov    -0x10(%rbp),%rsi
lea    0xdbc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x20(%rbp),%rdi
call   1040 <haval_print@plt>
lea    0xdd8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xdac(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1060 <haval_file@plt>
cmp    $0x0,%rax
je     133b <haval_cert+0x1fb>
mov    -0x10(%rbp),%rsi
lea    0xd8e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1364 <haval_cert+0x224>
mov    -0x10(%rbp),%rsi
lea    0xd8f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x20(%rbp),%rdi
call   1040 <haval_print@plt>
lea    0xd76(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<haval_cert>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe96(%rip),%rdi
mov    $0x3,%esi
mov    $0x80,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xf48(%rip),%r15
mov    %rsp,%rbx
mov    %r15,%rdi
mov    %rbx,%rsi
call   1060 <haval_string@plt>
lea    0xe8e(%rip),%r14
mov    %r14,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1050 <haval_print@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe77(%rip),%r15
mov    %r15,%rdi
mov    %rbx,%rsi
call   1060 <haval_string@plt>
mov    %r14,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1050 <haval_print@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe48(%rip),%r15
mov    %r15,%rdi
mov    %rbx,%rsi
call   1060 <haval_string@plt>
mov    %r14,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1050 <haval_print@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe6c(%rip),%r15
mov    %r15,%rdi
mov    %rbx,%rsi
call   1060 <haval_string@plt>
mov    %r14,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1050 <haval_print@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xdec(%rip),%r15
mov    %r15,%rdi
mov    %rbx,%rsi
call   1060 <haval_string@plt>
mov    %r14,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1050 <haval_print@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xdd6(%rip),%r14
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <haval_string@plt>
lea    0xe03(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1050 <haval_print@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xdf5(%rip),%rdi
mov    %rbx,%rsi
call   1070 <haval_file@plt>
test   %rax,%rax
je     12e4 <haval_cert+0x194>
lea    0xde9(%rip),%rdi
lea    0xdda(%rip),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    130b <haval_cert+0x1bb>
lea    0xdea(%rip),%rdi
lea    0xdc3(%rip),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rsp,%rdi
call   1050 <haval_print@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
@.str.1 = [47 x i8] c"HAVAL certification data (PASS=%d, FPTLEN=%d):\00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [15 x i8] c"HAVAL(\22%s\22) = \00"
@.str.4 = [2 x i8] c"a\00"
@.str.5 = [6 x i8] c"HAVAL\00"
@.str.6 = [11 x i8] c"0123456789\00"
@.str.7 = [27 x i8] c"abcdefghijklmnopqrstuvwxyz\00"
@.str.8 = [63 x i8] c"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\00"
@.str.9 = [21 x i8] c"HAVAL(\22%s\22)\0A = \00"
@.str.10 = [8 x i8] c"pi.frac\00"
@.str.11 = [24 x i8] c"%s can not be opened !\0A\00"
@.str.12 = [18 x i8] c"HAVAL(File %s) = \00"
define void @haval_cert() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca [16 x i8]
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0), i32 3, i32 128)
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8** %2
%7 = load i8*, i8** %2
%8 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%9 = call i32 @haval_string(i8* %7, i8* %8)
%10 = load i8*, i8** %2
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i8* %10)
%12 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%13 = call i32 @haval_print(i8* %12)
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i8** %2
%15 = load i8*, i8** %2
%16 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%17 = call i32 @haval_string(i8* %15, i8* %16)
%18 = load i8*, i8** %2
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i8* %18)
%20 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%21 = call i32 @haval_print(i8* %20)
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i8** %2
%23 = load i8*, i8** %2
%24 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%25 = call i32 @haval_string(i8* %23, i8* %24)
%26 = load i8*, i8** %2
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i8* %26)
%28 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%29 = call i32 @haval_print(i8* %28)
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), i8** %2
%31 = load i8*, i8** %2
%32 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%33 = call i32 @haval_string(i8* %31, i8* %32)
%34 = load i8*, i8** %2
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i8* %34)
%36 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%37 = call i32 @haval_print(i8* %36)
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.7, i64 0, i64 0), i8** %2
%39 = load i8*, i8** %2
%40 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%41 = call i32 @haval_string(i8* %39, i8* %40)
%42 = load i8*, i8** %2
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i8* %42)
%44 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%45 = call i32 @haval_print(i8* %44)
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.8, i64 0, i64 0), i8** %2
%47 = load i8*, i8** %2
%48 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%49 = call i32 @haval_string(i8* %47, i8* %48)
%50 = load i8*, i8** %2
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.9, i64 0, i64 0), i8* %50)
%52 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%53 = call i32 @haval_print(i8* %52)
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.10, i64 0, i64 0), i8** %2
%55 = load i8*, i8** %2
%56 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%57 = call i64 @haval_file(i8* %55, i8* %56)
%58 = icmp ne i64 %57, 0
br i1 %58, label %59, label %62
59: ; preds = %0
%60 = load i8*, i8** %2
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.11, i64 0, i64 0), i8* %60)
br label %68
62: ; preds = %0
%63 = load i8*, i8** %2
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.12, i64 0, i64 0), i8* %63)
%65 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%66 = call i32 @haval_print(i8* %65)
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %68
68: ; preds = %62, %59
ret void
}

LLVM IR (-O2):
@.str.1 = [47 x i8] c"HAVAL certification data (PASS=%d, FPTLEN=%d):\00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [15 x i8] c"HAVAL(\22%s\22) = \00"
@.str.4 = [2 x i8] c"a\00"
@.str.5 = [6 x i8] c"HAVAL\00"
@.str.6 = [11 x i8] c"0123456789\00"
@.str.7 = [27 x i8] c"abcdefghijklmnopqrstuvwxyz\00"
@.str.8 = [63 x i8] c"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\00"
@.str.9 = [21 x i8] c"HAVAL(\22%s\22)\0A = \00"
@.str.10 = [8 x i8] c"pi.frac\00"
@.str.11 = [24 x i8] c"%s can not be opened !\0A\00"
@.str.12 = [18 x i8] c"HAVAL(File %s) = \00"
define void @haval_cert() {
%1 = alloca [16 x i8]
%2 = getelementptr inbounds [16 x i8], [16 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @putchar(i32 10)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0), i32 3, i32 128)
%5 = tail call i32 @putchar(i32 10)
%6 = call i32 @haval_string(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8* %2)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 @haval_print(i8* %2)
%9 = call i32 @putchar(i32 10)
%10 = call i32 @haval_string(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i8* %2)
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%12 = call i32 @haval_print(i8* %2)
%13 = call i32 @putchar(i32 10)
%14 = call i32 @haval_string(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i8* %2)
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
%16 = call i32 @haval_print(i8* %2)
%17 = call i32 @putchar(i32 10)
%18 = call i32 @haval_string(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), i8* %2)
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0))
%20 = call i32 @haval_print(i8* %2)
%21 = call i32 @putchar(i32 10)
%22 = call i32 @haval_string(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.7, i64 0, i64 0), i8* %2)
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.7, i64 0, i64 0))
%24 = call i32 @haval_print(i8* %2)
%25 = call i32 @putchar(i32 10)
%26 = call i32 @haval_string(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.8, i64 0, i64 0), i8* %2)
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.8, i64 0, i64 0))
%28 = call i32 @haval_print(i8* %2)
%29 = call i32 @putchar(i32 10)
%30 = call i64 @haval_file(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.10, i64 0, i64 0), i8* %2)
%31 = icmp eq i64 %30, 0
br i1 %31, label %34, label %32
32: ; preds = %0
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.10, i64 0, i64 0))
br label %38
34: ; preds = %0
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.10, i64 0, i64 0))
%36 = call i32 @haval_print(i8* %2)
%37 = call i32 @putchar(i32 10)
br label %38
38: ; preds = %34, %32
ret void
}