#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__ ist_zahl_im_char_array(char *, int, char);
int vergleiche_lottoziehung(char *lottoziehung_1, char *lottoziehung_2,
                            int anzahl_lottozahlen) {
  int uebereinstimmungen = 0;
  for (int i = 0; i < anzahl_lottozahlen; i++) {
    if (ist_zahl_im_char_array(lottoziehung_1, anzahl_lottozahlen,
                               lottoziehung_2[i])) {
      uebereinstimmungen = uebereinstimmungen + 1;
    }
  }
  return uebereinstimmungen;
}


x86 assembly (clang, -O0):
<vergleiche_lottoziehung>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    117b <vergleiche_lottoziehung+0x6b>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%edx
call   1030 <ist_zahl_im_char_array@plt>
cmp    $0x0,%rax
je     1168 <vergleiche_lottoziehung+0x58>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    116d <vergleiche_lottoziehung+0x5d>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1131 <vergleiche_lottoziehung+0x21>
mov    -0x18(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vergleiche_lottoziehung>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %edx,%edx
jle    1152 <vergleiche_lottoziehung+0x42>
mov    %edx,%r12d
mov    %rsi,%r14
mov    %rdi,%r15
mov    %edx,%r13d
xor    %ebx,%ebx
xor    %ebp,%ebp
nop
movsbl (%r14,%rbx,1),%edx
mov    %r15,%rdi
mov    %r12d,%esi
call   1030 <ist_zahl_im_char_array@plt>
cmp    $0x1,%rax
sbb    $0xffffffff,%ebp
add    $0x1,%rbx
cmp    %rbx,%r13
jne    1130 <vergleiche_lottoziehung+0x20>
jmp    1154 <vergleiche_lottoziehung+0x44>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @vergleiche_lottoziehung(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
store i32 0, i32* %7
store i32 0, i32* %8
br label %9
9: ; preds = %27, %3
%10 = load i32, i32* %8
%11 = load i32, i32* %6
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %30
13: ; preds = %9
%14 = load i8*, i8** %4
%15 = load i32, i32* %6
%16 = load i8*, i8** %5
%17 = load i32, i32* %8
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i8, i8* %16, i64 %18
%20 = load i8, i8* %19
%21 = call i64 @ist_zahl_im_char_array(i8* %14, i32 %15, i8 signext %20)
%22 = icmp ne i64 %21, 0
br i1 %22, label %23, label %26
23: ; preds = %13
%24 = load i32, i32* %7
%25 = add nsw i32 %24, 1
store i32 %25, i32* %7
br label %26
26: ; preds = %23, %13
br label %27
27: ; preds = %26
%28 = load i32, i32* %8
%29 = add nsw i32 %28, 1
store i32 %29, i32* %8
br label %9
30: ; preds = %9
%31 = load i32, i32* %7
ret i32 %31
}

LLVM IR (-O2):
define i32 @vergleiche_lottoziehung(i8* %0, i8* nocapture %1, i32 %2) {
%4 = icmp sgt i32 %2, 0
br i1 %4, label %5, label %7
5: ; preds = %3
%6 = zext i32 %2 to i64
br label %9
7: ; preds = %9, %3
%8 = phi i32 [ 0, %3 ], [ %17, %9 ]
ret i32 %8
9: ; preds = %5, %9
%10 = phi i64 [ 0, %5 ], [ %18, %9 ]
%11 = phi i32 [ 0, %5 ], [ %17, %9 ]
%12 = getelementptr inbounds i8, i8* %1, i64 %10
%13 = load i8, i8* %12
%14 = tail call i64 @ist_zahl_im_char_array(i8* %0, i32 %2, i8 signext %13)
%15 = icmp ne i64 %14, 0
%16 = zext i1 %15 to i32
%17 = add nuw nsw i32 %11, %16
%18 = add nuw nsw i64 %10, 1
%19 = icmp eq i64 %18, %6
br i1 %19, label %7, label %9
}