#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*/ allocate(unsigned char **, unsigned int *);
unsigned char getchar();
scalar_t__ isalpha(unsigned char);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ system(char *);
void eingabe2(unsigned char **ein) {
  unsigned char c = 0;
  unsigned int length = 0;
  int valid = 1;
  printf("Enter secret word: ");
  system("stty -echo > /dev/tty");
  allocate(ein, &length);
  c = getchar();
  system("stty echo > /dev/tty");
  while (c != '\n') {
    (*ein)[length - 1] = (char)c;
    allocate(ein, &length);
    c = getchar();
    if (isalpha(c) == 0 && c != '\n')
      valid = 0;
  }
  if (valid == 0) {
    printf("\n Wort ungültig\n");
    eingabe2(ein);
  }
}


x86 assembly (clang, -O0):
<eingabe2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movb   $0x0,-0x9(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
lea    0xe7b(%rip),%rdi
call   1050 <printf@plt>
lea    0xe83(%rip),%rdi
call   1040 <system@plt>
mov    -0x8(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   1080 <allocate@plt>
mov    $0x0,%al
call   1060 <getchar@plt>
mov    %al,-0x9(%rbp)
lea    0xe76(%rip),%rdi
call   1040 <system@plt>
movzbl -0x9(%rbp),%eax
cmp    $0xa,%eax
je     121e <eingabe2+0xbe>
mov    -0x9(%rbp),%dl
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    -0x10(%rbp),%ecx
sub    $0x1,%ecx
mov    %ecx,%ecx
mov    %dl,(%rax,%rcx,1)
mov    -0x8(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   1080 <allocate@plt>
mov    $0x0,%al
call   1060 <getchar@plt>
mov    %al,-0x9(%rbp)
movzbl -0x9(%rbp),%edi
call   1070 <isalpha@plt>
cmp    $0x0,%rax
jne    1219 <eingabe2+0xb9>
movzbl -0x9(%rbp),%eax
cmp    $0xa,%eax
je     1219 <eingabe2+0xb9>
movl   $0x0,-0x14(%rbp)
jmp    11b9 <eingabe2+0x59>
cmpl   $0x0,-0x14(%rbp)
jne    123d <eingabe2+0xdd>
lea    0xe10(%rip),%rdi
call   1050 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1030 <eingabe2@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<eingabe2>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r14
movl   $0x0,0x4(%rsp)
lea    0xe73(%rip),%rdi
call   1060 <printf@plt>
lea    0xe7b(%rip),%rdi
call   1050 <system@plt>
lea    0x4(%rsp),%rsi
mov    %r14,%rdi
call   1090 <allocate@plt>
xor    %eax,%eax
call   1070 <getchar@plt>
mov    %eax,%r13d
lea    0xe6e(%rip),%rdi
call   1050 <system@plt>
cmp    $0xa,%r13b
je     123d <eingabe2+0xcd>
mov    $0x1,%ebx
lea    0x4(%rsp),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %ebx,%r12d
mov    (%r14),%rax
mov    0x4(%rsp),%ecx
add    $0xffffffff,%ecx
mov    %r13b,(%rax,%rcx,1)
mov    %r14,%rdi
mov    %r15,%rsi
call   1090 <allocate@plt>
xor    %eax,%eax
call   1070 <getchar@plt>
mov    %eax,%r13d
movzbl %al,%ebp
mov    %ebp,%edi
call   1080 <isalpha@plt>
test   %rax,%rax
mov    $0x0,%eax
cmove  %eax,%ebx
cmp    $0xa,%bpl
cmove  %r12d,%ebx
jne    11e0 <eingabe2+0x70>
test   %ebx,%ebx
jne    123d <eingabe2+0xcd>
lea    0xe0f(%rip),%rdi
call   1030 <puts@plt>
mov    %r14,%rdi
call   1040 <eingabe2@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [20 x i8] c"Enter secret word: \00"
@.str.1 = [22 x i8] c"stty -echo > /dev/tty\00"
@.str.2 = [21 x i8] c"stty echo > /dev/tty\00"
@.str.3 = [18 x i8] c"\0A Wort ung\C3\BCltig\0A\00"
define void @eingabe2(i8** %0) {
%2 = alloca i8**
%3 = alloca i8
%4 = alloca i32
%5 = alloca i32
store i8** %0, i8*** %2
store i8 0, i8* %3
store i32 0, i32* %4
store i32 1, i32* %5
%6 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @system(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%8 = load i8**, i8*** %2
%9 = call i32 @allocate(i8** %8, i32* %4)
%10 = call zeroext i8 (...) @getchar()
store i8 %10, i8* %3
%11 = call i32 @system(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
br label %12
12: ; preds = %35, %1
%13 = load i8, i8* %3
%14 = zext i8 %13 to i32
%15 = icmp ne i32 %14, 10
br i1 %15, label %16, label %36
16: ; preds = %12
%17 = load i8, i8* %3
%18 = load i8**, i8*** %2
%19 = load i8*, i8** %18
%20 = load i32, i32* %4
%21 = sub i32 %20, 1
%22 = zext i32 %21 to i64
%23 = getelementptr inbounds i8, i8* %19, i64 %22
store i8 %17, i8* %23
%24 = load i8**, i8*** %2
%25 = call i32 @allocate(i8** %24, i32* %4)
%26 = call zeroext i8 (...) @getchar()
store i8 %26, i8* %3
%27 = load i8, i8* %3
%28 = call i64 @isalpha(i8 zeroext %27)
%29 = icmp eq i64 %28, 0
br i1 %29, label %30, label %35
30: ; preds = %16
%31 = load i8, i8* %3
%32 = zext i8 %31 to i32
%33 = icmp ne i32 %32, 10
br i1 %33, label %34, label %35
34: ; preds = %30
store i32 0, i32* %5
br label %35
35: ; preds = %34, %30, %16
br label %12
36: ; preds = %12
%37 = load i32, i32* %5
%38 = icmp eq i32 %37, 0
br i1 %38, label %39, label %42
39: ; preds = %36
%40 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
%41 = load i8**, i8*** %2
br label %42
42: ; preds = %39, %36
ret void
}

LLVM IR (-O2):
@.str = [20 x i8] c"Enter secret word: \00"
@.str.1 = [22 x i8] c"stty -echo > /dev/tty\00"
@.str.2 = [21 x i8] c"stty echo > /dev/tty\00"
@str = [17 x i8] c"\0A Wort ung\C3\BCltig\00"
define void @eingabe2(i8** %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%4 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 @system(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @allocate(i8** %0, i32* %2)
%7 = call zeroext i8 (...) @getchar()
%8 = call i32 @system(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
%9 = icmp eq i8 %7, 10
br i1 %9, label %30, label %10
10: ; preds = %1, %10
%11 = phi i32 [ %24, %10 ], [ 1, %1 ]
%12 = phi i8 [ %19, %10 ], [ %7, %1 ]
%13 = load i8*, i8** %0
%14 = load i32, i32* %2
%15 = add i32 %14, -1
%16 = zext i32 %15 to i64
%17 = getelementptr inbounds i8, i8* %13, i64 %16
store i8 %12, i8* %17
%18 = call i32 @allocate(i8** %0, i32* %2)
%19 = call zeroext i8 (...) @getchar()
%20 = call i64 @isalpha(i8 zeroext %19)
%21 = icmp eq i64 %20, 0
%22 = icmp ne i8 %19, 10
%23 = and i1 %22, %21
%24 = select i1 %23, i32 0, i32 %11
%25 = icmp eq i8 %19, 10
br i1 %25, label %26, label %10
26: ; preds = %10
%27 = icmp eq i32 %24, 0
br i1 %27, label %28, label %30
28: ; preds = %26
%29 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
br label %30
30: ; preds = %1, %28, %26
ret void
}