#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*/ gets(char *);
int /*<<< orphan*/ printf(char *, ...);
main() {
  char satz[100];
  float i = 0;
  float z = 0;
  int x = 0;
  printf("\tBitte einen Satz eingeben:\n");
  gets(satz);
  for (x = 0; satz[x] != '\0'; x++) {
    if (satz[x] == 'e')
      z++;
    if (satz[x] != ' ')
      i++;
  }
  printf("Der Satz enthält %.f mal den Buchstaben 'e'.\n", z);
  printf("Das sind %.2f %% der enthaltenen Buchstaben.\n", (z / i) * 100);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x74(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x78(%rbp)
movl   $0x0,-0x7c(%rbp)
lea    0xeb8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x70(%rbp),%rdi
call   1040 <gets@plt>
movl   $0x0,-0x7c(%rbp)
movslq -0x7c(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%eax
cmp    $0x0,%eax
je     11d4 <main+0xb4>
movslq -0x7c(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%eax
cmp    $0x65,%eax
jne    119d <main+0x7d>
movss  0xe71(%rip),%xmm0
addss  -0x78(%rbp),%xmm0
movss  %xmm0,-0x78(%rbp)
movslq -0x7c(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%eax
cmp    $0x20,%eax
je     11c1 <main+0xa1>
movss  0xe4d(%rip),%xmm0
addss  -0x74(%rbp),%xmm0
movss  %xmm0,-0x74(%rbp)
jmp    11c6 <main+0xa6>
mov    -0x7c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7c(%rbp)
jmp    1167 <main+0x47>
movss  -0x78(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe41(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  -0x78(%rbp),%xmm0
divss  -0x74(%rbp),%xmm0
movss  0xe03(%rip),%xmm1
mulss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe48(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x80,%rsp
lea    0xf26(%rip),%rdi
call   1030 <puts@plt>
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <gets@plt>
xorps  %xmm3,%xmm3
movss  0xea4(%rip),%xmm0
xorps  %xmm2,%xmm2
jmp    1174 <main+0x44>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%rbx
movzbl (%rbx),%eax
cmp    $0x65,%al
je     1190 <main+0x60>
test   %al,%al
jne    1194 <main+0x64>
jmp    11a4 <main+0x74>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
addss  %xmm0,%xmm2
movaps %xmm3,%xmm1
addss  %xmm0,%xmm1
cmp    $0x20,%al
je     1170 <main+0x40>
movaps %xmm1,%xmm3
jmp    1170 <main+0x40>
xorps  %xmm0,%xmm0
cvtss2sd %xmm2,%xmm0
lea    0xe56(%rip),%rdi
mov    $0x1,%al
movss  %xmm2,0x8(%rsp)
movss  %xmm3,0xc(%rsp)
call   1040 <printf@plt>
movss  0x8(%rsp),%xmm0
divss  0xc(%rsp),%xmm0
mulss  0xe2b(%rip),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe53(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [29 x i8] c"\09Bitte einen Satz eingeben:\0A\00"
@.str.1 = [47 x i8] c"Der Satz enth\C3\A4lt %.f mal den Buchstaben 'e'.\0A\00"
@.str.2 = [46 x i8] c"Das sind %.2f %% der enthaltenen Buchstaben.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i8]
%3 = alloca float
%4 = alloca float
%5 = alloca i32
store i32 0, i32* %1
store float 0.000000e+00, float* %3
store float 0.000000e+00, float* %4
store i32 0, i32* %5
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%7 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%8 = call i32 @gets(i8* %7)
store i32 0, i32* %5
br label %9
9: ; preds = %37, %0
%10 = load i32, i32* %5
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %11
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %40
16: ; preds = %9
%17 = load i32, i32* %5
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %18
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = icmp eq i32 %21, 101
br i1 %22, label %23, label %26
23: ; preds = %16
%24 = load float, float* %4
%25 = fadd float %24, 1.000000e+00
store float %25, float* %4
br label %26
26: ; preds = %23, %16
%27 = load i32, i32* %5
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %28
%30 = load i8, i8* %29
%31 = sext i8 %30 to i32
%32 = icmp ne i32 %31, 32
br i1 %32, label %33, label %36
33: ; preds = %26
%34 = load float, float* %3
%35 = fadd float %34, 1.000000e+00
store float %35, float* %3
br label %36
36: ; preds = %33, %26
br label %37
37: ; preds = %36
%38 = load i32, i32* %5
%39 = add nsw i32 %38, 1
store i32 %39, i32* %5
br label %9
40: ; preds = %9
%41 = load float, float* %4
%42 = fpext float %41 to double
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0), double %42)
%44 = load float, float* %4
%45 = load float, float* %3
%46 = fdiv float %44, %45
%47 = fmul float %46, 1.000000e+02
%48 = fpext float %47 to double
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.2, i64 0, i64 0), double %48)
%50 = load i32, i32* %1
ret i32 %50
}

LLVM IR (-O2):
@.str.1 = [47 x i8] c"Der Satz enth\C3\A4lt %.f mal den Buchstaben 'e'.\0A\00"
@.str.2 = [46 x i8] c"Das sind %.2f %% der enthaltenen Buchstaben.\0A\00"
@str = [28 x i8] c"\09Bitte einen Satz eingeben:\00"
define i32 @main() {
%1 = alloca [100 x i8]
%2 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
%4 = call i32 @gets(i8* %2)
br label %5
5: ; preds = %13, %0
%6 = phi i64 [ %18, %13 ], [ 0, %0 ]
%7 = phi float [ %17, %13 ], [ 0.000000e+00, %0 ]
%8 = phi float [ %14, %13 ], [ 0.000000e+00, %0 ]
%9 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 %6
%10 = load i8, i8* %9
switch i8 %10, label %13 [
i8 0, label %19
i8 101, label %11
]
11: ; preds = %5
%12 = fadd float %8, 1.000000e+00
br label %13
13: ; preds = %5, %11
%14 = phi float [ %12, %11 ], [ %8, %5 ]
%15 = icmp eq i8 %10, 32
%16 = fadd float %7, 1.000000e+00
%17 = select i1 %15, float %7, float %16
%18 = add nuw i64 %6, 1
br label %5
19: ; preds = %5
%20 = fpext float %8 to double
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0), double %20)
%22 = fdiv float %8, %7
%23 = fmul float %22, 1.000000e+02
%24 = fpext float %23 to double
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str.2, i64 0, i64 0), double %24)
ret i32 0
}