#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 /*<<< orphan*/ puts(char *);
int rec_string_laenge(char *, int /*<<< orphan*/);
int /*<<< orphan*/ rec_zaehle_buchstaben(int *, char *, int /*<<< orphan*/);
int rec_zaehle_umlaute(char *, int /*<<< orphan*/);
int main() {
  int i = 0;
  int result;
  char string1[] = "Ich bin ein String";
  int alphabet[26] = {};
  puts("\nAufgabe a)");
  result = rec_string_laenge(string1, 0);
  printf("Die Länge des Strings \"%s\" beträgt %d.\n", string1, result);
  puts("\nAufgabe b)");
  result = rec_zaehle_umlaute(string1, 0);
  printf("Der String \"%s\" beinhaltet %d Umlaute.\n", string1, result);
  puts("\nAufgabe c)");
  rec_zaehle_buchstaben(alphabet, string1, 0);
  for (i = 0; i < 26; i++) {
    printf("Der Buchstabe \"%c\" kommt %d mal vor.\n", 'a' + i, alphabet[i]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    0xe80(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xe7d(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xe7a(%rip),%ax
mov    %ax,-0x10(%rbp)
mov    0xe72(%rip),%al
mov    %al,-0xe(%rbp)
lea    -0x90(%rbp),%rdi
xor    %esi,%esi
mov    $0x68,%edx
call   1060 <memset@plt>
lea    0xe56(%rip),%rdi
call   1030 <puts@plt>
lea    -0x20(%rbp),%rdi
xor    %esi,%esi
call   1040 <rec_string_laenge@plt>
mov    %eax,-0xc(%rbp)
lea    -0x20(%rbp),%rsi
mov    -0xc(%rbp),%edx
lea    0xe41(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe5d(%rip),%rdi
call   1030 <puts@plt>
lea    -0x20(%rbp),%rdi
xor    %esi,%esi
call   1080 <rec_zaehle_umlaute@plt>
mov    %eax,-0xc(%rbp)
lea    -0x20(%rbp),%rsi
mov    -0xc(%rbp),%edx
lea    0xe48(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe62(%rip),%rdi
call   1030 <puts@plt>
lea    -0x90(%rbp),%rdi
lea    -0x20(%rbp),%rsi
xor    %edx,%edx
call   1070 <rec_zaehle_buchstaben@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x1a,-0x8(%rbp)
jge    1270 <main+0x110>
mov    -0x8(%rbp),%esi
add    $0x61,%esi
movslq -0x8(%rbp),%rax
mov    -0x90(%rbp,%rax,4),%edx
lea    0xe2e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1239 <main+0xd9>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x90,%rsp
movaps 0xea1(%rip),%xmm0
movaps %xmm0,0x70(%rsp)
movl   $0x676e69,0x7f(%rsp)
xorps  %xmm0,%xmm0
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
movq   $0x0,0x60(%rsp)
lea    0xe77(%rip),%rdi
call   1030 <puts@plt>
lea    0x70(%rsp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
call   1040 <rec_string_laenge@plt>
lea    0xe68(%rip),%rdi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe7f(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   1070 <rec_zaehle_umlaute@plt>
lea    0xe75(%rip),%rdi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe8a(%rip),%rdi
call   1030 <puts@plt>
mov    %rsp,%rdi
mov    %rbx,%rsi
xor    %edx,%edx
call   1060 <rec_zaehle_buchstaben@plt>
mov    (%rsp),%edx
lea    0xe7a(%rip),%rbx
mov    %rbx,%rdi
mov    $0x61,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x4(%rsp),%edx
mov    %rbx,%rdi
mov    $0x62,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x8(%rsp),%edx
mov    %rbx,%rdi
mov    $0x63,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0xc(%rsp),%edx
mov    %rbx,%rdi
mov    $0x64,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x10(%rsp),%edx
mov    %rbx,%rdi
mov    $0x65,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x14(%rsp),%edx
mov    %rbx,%rdi
mov    $0x66,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x18(%rsp),%edx
mov    %rbx,%rdi
mov    $0x67,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x1c(%rsp),%edx
mov    %rbx,%rdi
mov    $0x68,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x20(%rsp),%edx
mov    %rbx,%rdi
mov    $0x69,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x24(%rsp),%edx
mov    %rbx,%rdi
mov    $0x6a,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x28(%rsp),%edx
mov    %rbx,%rdi
mov    $0x6b,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x2c(%rsp),%edx
mov    %rbx,%rdi
mov    $0x6c,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x30(%rsp),%edx
mov    %rbx,%rdi
mov    $0x6d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x34(%rsp),%edx
mov    %rbx,%rdi
mov    $0x6e,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x38(%rsp),%edx
mov    %rbx,%rdi
mov    $0x6f,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x3c(%rsp),%edx
mov    %rbx,%rdi
mov    $0x70,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x40(%rsp),%edx
mov    %rbx,%rdi
mov    $0x71,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x44(%rsp),%edx
mov    %rbx,%rdi
mov    $0x72,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x48(%rsp),%edx
mov    %rbx,%rdi
mov    $0x73,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x4c(%rsp),%edx
mov    %rbx,%rdi
mov    $0x74,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x50(%rsp),%edx
mov    %rbx,%rdi
mov    $0x75,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x54(%rsp),%edx
mov    %rbx,%rdi
mov    $0x76,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x58(%rsp),%edx
mov    %rbx,%rdi
mov    $0x77,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x5c(%rsp),%edx
mov    %rbx,%rdi
mov    $0x78,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x60(%rsp),%edx
mov    %rbx,%rdi
mov    $0x79,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x64(%rsp),%edx
mov    %rbx,%rdi
mov    $0x7a,%esi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.string1 = [19 x i8] c"Ich bin ein String\00"
@.str = [12 x i8] c"\0AAufgabe a)\00"
@.str.1 = [42 x i8] c"Die L\C3\A4nge des Strings \22%s\22 betr\C3\A4gt %d.\0A\00"
@.str.2 = [12 x i8] c"\0AAufgabe b)\00"
@.str.3 = [40 x i8] c"Der String \22%s\22 beinhaltet %d Umlaute.\0A\00"
@.str.4 = [12 x i8] c"\0AAufgabe c)\00"
@.str.5 = [38 x i8] c"Der Buchstabe \22%c\22 kommt %d mal vor.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [19 x i8]
%5 = alloca [26 x i32]
store i32 0, i32* %1
store i32 0, i32* %2
%6 = bitcast [19 x i8]* %4 to i8*
%7 = bitcast [26 x i32]* %5 to i8*
%8 = call i32 @puts(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%9 = getelementptr inbounds [19 x i8], [19 x i8]* %4, i64 0, i64 0
%10 = call i32 @rec_string_laenge(i8* %9, i32 0)
store i32 %10, i32* %3
%11 = getelementptr inbounds [19 x i8], [19 x i8]* %4, i64 0, i64 0
%12 = load i32, i32* %3
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0), i8* %11, i32 %12)
%14 = call i32 @puts(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%15 = getelementptr inbounds [19 x i8], [19 x i8]* %4, i64 0, i64 0
%16 = call i32 @rec_zaehle_umlaute(i8* %15, i32 0)
store i32 %16, i32* %3
%17 = getelementptr inbounds [19 x i8], [19 x i8]* %4, i64 0, i64 0
%18 = load i32, i32* %3
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.3, i64 0, i64 0), i8* %17, i32 %18)
%20 = call i32 @puts(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0))
%21 = getelementptr inbounds [26 x i32], [26 x i32]* %5, i64 0, i64 0
%22 = getelementptr inbounds [19 x i8], [19 x i8]* %4, i64 0, i64 0
%23 = call i32 @rec_zaehle_buchstaben(i32* %21, i8* %22, i32 0)
store i32 0, i32* %2
br label %24
24: ; preds = %35, %0
%25 = load i32, i32* %2
%26 = icmp slt i32 %25, 26
br i1 %26, label %27, label %38
27: ; preds = %24
%28 = load i32, i32* %2
%29 = add nsw i32 97, %28
%30 = load i32, i32* %2
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [26 x i32], [26 x i32]* %5, i64 0, i64 %31
%33 = load i32, i32* %32
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.5, i64 0, i64 0), i32 %29, i32 %33)
br label %35
35: ; preds = %27
%36 = load i32, i32* %2
%37 = add nsw i32 %36, 1
store i32 %37, i32* %2
br label %24
38: ; preds = %24
ret i32 0
}

LLVM IR (-O2):
@__const.main.string1 = [19 x i8] c"Ich bin ein String\00"
@.str = [12 x i8] c"\0AAufgabe a)\00"
@.str.1 = [42 x i8] c"Die L\C3\A4nge des Strings \22%s\22 betr\C3\A4gt %d.\0A\00"
@.str.2 = [12 x i8] c"\0AAufgabe b)\00"
@.str.3 = [40 x i8] c"Der String \22%s\22 beinhaltet %d Umlaute.\0A\00"
@.str.4 = [12 x i8] c"\0AAufgabe c)\00"
@.str.5 = [38 x i8] c"Der Buchstabe \22%c\22 kommt %d mal vor.\0A\00"
define i32 @main() {
%1 = alloca [19 x i8]
%2 = alloca [26 x i32]
%3 = getelementptr inbounds [19 x i8], [19 x i8]* %1, i64 0, i64 0
%4 = bitcast [26 x i32]* %2 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @rec_string_laenge(i8* %3, i32 0)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0), i8* %3, i32 %6)
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 @rec_zaehle_umlaute(i8* %3, i32 0)
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.3, i64 0, i64 0), i8* %3, i32 %9)
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0))
%12 = getelementptr inbounds [26 x i32], [26 x i32]* %2, i64 0, i64 0
%13 = call i32 @rec_zaehle_buchstaben(i32* %12, i8* %3, i32 0)
%14 = load i32, i32* %12
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.5, i64 0, i64 0), i32 97, i32 %14)
%16 = getelementptr inbounds [26 x i32], [26 x i32]* %2, i64 0, i64 1
%17 = load i32, i32* %16
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.5, i64 0, i64 0), i32 98, i32 %17)
%19 = getelementptr inbounds [26 x i32], [26 x i32]* %2, i64 0, i64 2
%20 = load i32, i32* %19
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.5, i64 0, i64 0), i32 99, i32 %20)
%22 = getelementptr inbounds [26 x i32], [26 x i32]* %2, i64 0, i64 3
%23 = load i32, i32* %22
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.5, i64 0, i64 0), i32 100, i32 %23)
%25 = getelementptr inbounds [26 x i32], [26 x i32]* %2, i64 0, i64 4
%26 = load i32, i32* %25
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.5, i64 0, i64 0), i32 101, i32 %26)
%28 = getelementptr inbounds [26 x i32], [26 x i32]* %2, i64 0, i64 5
%29 = load i32, i32* %28
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.5, i64 0, i64 0), i32 102, i32 %29)
%31 = getelementptr inbounds [26 x i32], [26 x i32]* %2, i64 0, i64 6
%32 = load i32, i32* %31
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.5, i64 0, i64 0), i32 103, i32 %32)
%34 = getelementptr inbounds [26 x i32], [26 x i32]* %2, i64 0, i64 7
%35 = load i32, i32* %34
%36 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.5, i64 0, i64 0), i32 104, i32 %35)
%37 = getelementptr inbounds [26 x i32], [26 x i32]* %2, i64 0, i64 8
%38 = load i32, i32* %37
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.5, i64 0, i64 0), i32 105, i32 %38)
%40 = getelementptr inbounds [26 x i32], [26 x i32]* %2, i64 0, i64 9
%41 = load i32, i32* %40
%42 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.5, i64 0, i64 0), i32 106, i32 %41)
%43 = getelementptr inbounds [26 x i32], [26 x i32]* %2, i64 0, i64 10
%44 = load i32, i32* %43
%45 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.5, i64 0, i64 0), i32 107, i32 %44)
%46 = getelementptr inbounds [26 x i32], [26 x i32]* %2, i64 0, i64 11
%47 = load i32, i32* %46
%48 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.5, i64 0, i64 0), i32 108, i32 %47)
%49 = getelementptr inbounds [26 x i32], [26 x i32]* %2, i64 0, i64 12
%50 = load i32, i32* %49
%51 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.5, i64 0, i64 0), i32 109, i32 %50)
%52 = getelementptr inbounds [26 x i32], [26 x i32]* %2, i64 0, i64 13
%53 = load i32, i32* %52
%54 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.5, i64 0, i64 0), i32 110, i32 %53)
%55 = getelementptr inbounds [26 x i32], [26 x i32]* %2, i64 0, i64 14
%56 = load i32, i32* %55
%57 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.5, i64 0, i64 0), i32 111, i32 %56)
%58 = getelementptr inbounds [26 x i32], [26 x i32]* %2, i64 0, i64 15
%59 = load i32, i32* %58
%60 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.5, i64 0, i64 0), i32 112, i32 %59)
%61 = getelementptr inbounds [26 x i32], [26 x i32]* %2, i64 0, i64 16
%62 = load i32, i32* %61
%63 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.5, i64 0, i64 0), i32 113, i32 %62)
%64 = getelementptr inbounds [26 x i32], [26 x i32]* %2, i64 0, i64 17
%65 = load i32, i32* %64
%66 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.5, i64 0, i64 0), i32 114, i32 %65)
%67 = getelementptr inbounds [26 x i32], [26 x i32]* %2, i64 0, i64 18
%68 = load i32, i32* %67
%69 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.5, i64 0, i64 0), i32 115, i32 %68)
%70 = getelementptr inbounds [26 x i32], [26 x i32]* %2, i64 0, i64 19
%71 = load i32, i32* %70
%72 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.5, i64 0, i64 0), i32 116, i32 %71)
%73 = getelementptr inbounds [26 x i32], [26 x i32]* %2, i64 0, i64 20
%74 = load i32, i32* %73
%75 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.5, i64 0, i64 0), i32 117, i32 %74)
%76 = getelementptr inbounds [26 x i32], [26 x i32]* %2, i64 0, i64 21
%77 = load i32, i32* %76
%78 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.5, i64 0, i64 0), i32 118, i32 %77)
%79 = getelementptr inbounds [26 x i32], [26 x i32]* %2, i64 0, i64 22
%80 = load i32, i32* %79
%81 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.5, i64 0, i64 0), i32 119, i32 %80)
%82 = getelementptr inbounds [26 x i32], [26 x i32]* %2, i64 0, i64 23
%83 = load i32, i32* %82
%84 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.5, i64 0, i64 0), i32 120, i32 %83)
%85 = getelementptr inbounds [26 x i32], [26 x i32]* %2, i64 0, i64 24
%86 = load i32, i32* %85
%87 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.5, i64 0, i64 0), i32 121, i32 %86)
%88 = getelementptr inbounds [26 x i32], [26 x i32]* %2, i64 0, i64 25
%89 = load i32, i32* %88
%90 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.5, i64 0, i64 0), i32 122, i32 %89)
ret i32 0
}