#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 vergleiche_fingerprint(char *fingerprint, char *eigener_fingerprint,
                           int laenge) {
  int i;
  for (i = 0; i < laenge - 1; i++) {
    if (fingerprint[i] != eigener_fingerprint[i]) {
      printf("FEHLER: Der aus dem Schlüssel errechnete Fingerprint stimmt "
             "nicht mit dem Eingegebenen ueberein\n");
      return 3;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<vergleiche_fingerprint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    -0x1c(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1186 <vergleiche_fingerprint+0x76>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
mov    -0x18(%rbp),%rcx
movslq -0x20(%rbp),%rdx
movsbl (%rcx,%rdx,1),%ecx
cmp    %ecx,%eax
je     1173 <vergleiche_fingerprint+0x63>
lea    0xe9e(%rip),%rdi
call   1030 <printf@plt>
movl   $0x3,-0x4(%rbp)
jmp    118d <vergleiche_fingerprint+0x7d>
jmp    1178 <vergleiche_fingerprint+0x68>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    112a <vergleiche_fingerprint+0x1a>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vergleiche_fingerprint>:
push   %rax
xor    %eax,%eax
cmp    $0x2,%edx
jl     1147 <vergleiche_fingerprint+0x37>
add    $0xffffffff,%edx
xor    %eax,%eax
nopl   (%rax)
movzbl (%rdi,%rax,1),%ecx
cmp    (%rsi,%rax,1),%cl
jne    1136 <vergleiche_fingerprint+0x26>
add    $0x1,%rax
cmp    %rax,%rdx
jne    1120 <vergleiche_fingerprint+0x10>
xor    %eax,%eax
pop    %rcx
ret
lea    0xec3(%rip),%rdi
call   1030 <puts@plt>
mov    $0x3,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [98 x i8] c"FEHLER: Der aus dem Schl\C3\BCssel errechnete Fingerprint stimmt nicht mit dem Eingegebenen ueberein\0A\00"
define i32 @vergleiche_fingerprint(i8* %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
store i32 0, i32* %8
br label %9
9: ; preds = %31, %3
%10 = load i32, i32* %8
%11 = load i32, i32* %7
%12 = sub nsw i32 %11, 1
%13 = icmp slt i32 %10, %12
br i1 %13, label %14, label %34
14: ; preds = %9
%15 = load i8*, i8** %5
%16 = load i32, i32* %8
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8, i8* %15, i64 %17
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = load i8*, i8** %6
%22 = load i32, i32* %8
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i8, i8* %21, i64 %23
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = icmp ne i32 %20, %26
br i1 %27, label %28, label %30
28: ; preds = %14
%29 = call i32 @printf(i8* getelementptr inbounds ([98 x i8], [98 x i8]* @.str, i64 0, i64 0))
store i32 3, i32* %4
br label %35
30: ; preds = %14
br label %31
31: ; preds = %30
%32 = load i32, i32* %8
%33 = add nsw i32 %32, 1
store i32 %33, i32* %8
br label %9
34: ; preds = %9
store i32 0, i32* %4
br label %35
35: ; preds = %34, %28
%36 = load i32, i32* %4
ret i32 %36
}

LLVM IR (-O2):
@str = [97 x i8] c"FEHLER: Der aus dem Schl\C3\BCssel errechnete Fingerprint stimmt nicht mit dem Eingegebenen ueberein\00"
define i32 @vergleiche_fingerprint(i8* nocapture %0, i8* nocapture %1, i32 %2) {
%4 = icmp sgt i32 %2, 1
br i1 %4, label %5, label %20
5: ; preds = %3
%6 = add nsw i32 %2, -1
%7 = zext i32 %6 to i64
br label %10
8: ; preds = %10
%9 = icmp eq i64 %17, %7
br i1 %9, label %20, label %10
10: ; preds = %5, %8
%11 = phi i64 [ 0, %5 ], [ %17, %8 ]
%12 = getelementptr inbounds i8, i8* %0, i64 %11
%13 = load i8, i8* %12
%14 = getelementptr inbounds i8, i8* %1, i64 %11
%15 = load i8, i8* %14
%16 = icmp eq i8 %13, %15
%17 = add nuw nsw i64 %11, 1
br i1 %16, label %8, label %18
18: ; preds = %10
%19 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([97 x i8], [97 x i8]* @str, i64 0, i64 0))
br label %20
20: ; preds = %8, %3, %18
%21 = phi i32 [ 3, %18 ], [ 0, %3 ], [ 0, %8 ]
ret i32 %21
}