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


x86 assembly (clang, -O0):
<haval_cert>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
lea    0xf65(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea3(%rip),%rdi
mov    $0x5,%esi
mov    $0x100,%edx
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf3f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf32(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1050 <haval_string@plt>
mov    -0x8(%rbp),%rsi
lea    0xe90(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x30(%rbp),%rdi
call   1040 <haval_print@plt>
lea    0xefe(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe70(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1050 <haval_string@plt>
mov    -0x8(%rbp),%rsi
lea    0xe4f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x30(%rbp),%rdi
call   1040 <haval_print@plt>
lea    0xebd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe31(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1050 <haval_string@plt>
mov    -0x8(%rbp),%rsi
lea    0xe0e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x30(%rbp),%rdi
call   1040 <haval_print@plt>
lea    0xe7c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe45(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1050 <haval_string@plt>
mov    -0x8(%rbp),%rsi
lea    0xdcd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x30(%rbp),%rdi
call   1040 <haval_print@plt>
lea    0xe3b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xdb5(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1050 <haval_string@plt>
mov    -0x8(%rbp),%rsi
lea    0xd8c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x30(%rbp),%rdi
call   1040 <haval_print@plt>
lea    0xdfa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xd8f(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1050 <haval_string@plt>
mov    -0x8(%rbp),%rsi
lea    0xd4b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x30(%rbp),%rdi
call   1040 <haval_print@plt>
lea    0xdb9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xd8d(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1060 <haval_file@plt>
cmp    $0x0,%rax
je     133b <haval_cert+0x1fb>
mov    -0x8(%rbp),%rsi
lea    0xd6f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1364 <haval_cert+0x224>
mov    -0x8(%rbp),%rsi
lea    0xce9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x30(%rbp),%rdi
call   1040 <haval_print@plt>
lea    0xd57(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<haval_cert>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe96(%rip),%rdi
mov    $0x5,%esi
mov    $0x100,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xf29(%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    0xe6d(%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    0xe3e(%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    0xe62(%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    0xde2(%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    0xdcc(%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    0xdda(%rip),%rdi
mov    %rbx,%rsi
call   1070 <haval_file@plt>
test   %rax,%rax
je     12e0 <haval_cert+0x190>
lea    0xdce(%rip),%rdi
lea    0xdbf(%rip),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1307 <haval_cert+0x1b7>
lea    0xd48(%rip),%rdi
lea    0xda8(%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    $0x20,%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 = [5 x i8] c"%s \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 = [8 x i8] c"pi.frac\00"
@.str.10 = [24 x i8] c"%s can not be opened !\0A\00"
define void @haval_cert() {
%1 = alloca i8*
%2 = alloca [32 x i8]
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0), i32 5, i32 256)
%5 = 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** %1
%6 = load i8*, i8** %1
%7 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 0
%8 = call i32 @haval_string(i8* %6, i8* %7)
%9 = load i8*, i8** %1
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* %9)
%11 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 0
%12 = call i32 @haval_print(i8* %11)
%13 = 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** %1
%14 = load i8*, i8** %1
%15 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 0
%16 = call i32 @haval_string(i8* %14, i8* %15)
%17 = load i8*, i8** %1
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* %17)
%19 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 0
%20 = call i32 @haval_print(i8* %19)
%21 = 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** %1
%22 = load i8*, i8** %1
%23 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 0
%24 = call i32 @haval_string(i8* %22, i8* %23)
%25 = load i8*, i8** %1
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* %25)
%27 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 0
%28 = call i32 @haval_print(i8* %27)
%29 = 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** %1
%30 = load i8*, i8** %1
%31 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 0
%32 = call i32 @haval_string(i8* %30, i8* %31)
%33 = load i8*, i8** %1
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* %33)
%35 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 0
%36 = call i32 @haval_print(i8* %35)
%37 = 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** %1
%38 = load i8*, i8** %1
%39 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 0
%40 = call i32 @haval_string(i8* %38, i8* %39)
%41 = load i8*, i8** %1
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* %41)
%43 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 0
%44 = call i32 @haval_print(i8* %43)
%45 = 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** %1
%46 = load i8*, i8** %1
%47 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 0
%48 = call i32 @haval_string(i8* %46, i8* %47)
%49 = load i8*, i8** %1
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* %49)
%51 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 0
%52 = call i32 @haval_print(i8* %51)
%53 = 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.9, i64 0, i64 0), i8** %1
%54 = load i8*, i8** %1
%55 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 0
%56 = call i64 @haval_file(i8* %54, i8* %55)
%57 = icmp ne i64 %56, 0
br i1 %57, label %58, label %61
58: ; preds = %0
%59 = load i8*, i8** %1
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.10, i64 0, i64 0), i8* %59)
br label %67
61: ; preds = %0
%62 = load i8*, i8** %1
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* %62)
%64 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 0
%65 = call i32 @haval_print(i8* %64)
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %67
67: ; preds = %61, %58
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 = [5 x i8] c"%s \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 = [8 x i8] c"pi.frac\00"
@.str.10 = [24 x i8] c"%s can not be opened !\0A\00"
define void @haval_cert() {
%1 = alloca [32 x i8]
%2 = getelementptr inbounds [32 x i8], [32 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 5, i32 256)
%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 ([5 x i8], [5 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 ([5 x i8], [5 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 ([5 x i8], [5 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 ([5 x i8], [5 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 ([5 x i8], [5 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 ([5 x i8], [5 x i8]* @.str.3, 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.9, 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.10, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0))
br label %38
34: ; preds = %0
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, 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
}