#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*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int sscanf(char *, char *, int *, int *, int *);
int /*<<< orphan*/ stdin;
double vektor(int, int, int);
int main(void) {
  int dimension1 = 0;
  int dimension2 = 0;
  int dimension3 = 0;
  char buffer[9];
  printf("Bitte geben sie die 3 Dimensionen ihres Vektors wie folgt an\n");
  printf("Bitte geben sie Y,X und Z an: ");
  fgets(buffer, 9, stdin);
  if (sscanf(buffer, "%d %d %d", &dimension1, &dimension2, &dimension3) == 3) {
    printf("Der betrag des Vektors(%dy,%dx,%dz) betreagt: ", dimension1,
           dimension2, dimension3);
    printf("%f\n", vektor(dimension1, dimension2, dimension3));
  } else {
    printf("Falsche eingabe\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
lea    0xe95(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x19(%rbp),%rdi
mov    0x2e5d(%rip),%rax
mov    (%rax),%edx
mov    $0x9,%esi
call   1040 <fgets@plt>
lea    -0x19(%rbp),%rdi
lea    0xebb(%rip),%rsi
lea    -0x8(%rbp),%rdx
lea    -0xc(%rbp),%rcx
lea    -0x10(%rbp),%r8
call   1050 <sscanf@plt>
cmp    $0x3,%eax
jne    11f4 <main+0xb4>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1060 <vektor@plt>
lea    0xead(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    1202 <main+0xc2>
lea    0xe9e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
movl   $0x0,0x10(%rsp)
movl   $0x0,0xc(%rsp)
movl   $0x0,0x8(%rsp)
lea    0xee7(%rip),%rdi
call   1030 <puts@plt>
lea    0xe80(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x2e5a(%rip),%rax
mov    (%rax),%edx
lea    0x17(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x9,%esi
call   1050 <fgets@plt>
lea    0xe76(%rip),%rsi
lea    0x10(%rsp),%rdx
lea    0xc(%rsp),%rcx
lea    0x8(%rsp),%r8
mov    %rbx,%rdi
call   1060 <sscanf@plt>
cmp    $0x3,%eax
jne    1200 <main+0xb0>
mov    0x10(%rsp),%esi
mov    0xc(%rsp),%edx
mov    0x8(%rsp),%ecx
lea    0xe50(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x10(%rsp),%edi
mov    0xc(%rsp),%esi
mov    0x8(%rsp),%edx
call   1070 <vektor@plt>
lea    0xe60(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
jmp    120c <main+0xbc>
lea    0xe91(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [62 x i8] c"Bitte geben sie die 3 Dimensionen ihres Vektors wie folgt an\0A\00"
@.str.1 = [31 x i8] c"Bitte geben sie Y,X und Z an: \00"
@stdin = global i32 0
@.str.2 = [9 x i8] c"%d %d %d\00"
@.str.3 = [47 x i8] c"Der betrag des Vektors(%dy,%dx,%dz) betreagt: \00"
@.str.4 = [4 x i8] c"%f\0A\00"
@.str.5 = [17 x i8] c"Falsche eingabe\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca [9 x i8]
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
store i32 0, i32* %4
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str, i64 0, i64 0))
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0))
%8 = getelementptr inbounds [9 x i8], [9 x i8]* %5, i64 0, i64 0
%9 = load i32, i32* @stdin
%10 = call i32 @fgets(i8* %8, i32 9, i32 %9)
%11 = getelementptr inbounds [9 x i8], [9 x i8]* %5, i64 0, i64 0
%12 = call i32 @sscanf(i8* %11, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32* %2, i32* %3, i32* %4)
%13 = icmp eq i32 %12, 3
br i1 %13, label %14, label %24
14: ; preds = %0
%15 = load i32, i32* %2
%16 = load i32, i32* %3
%17 = load i32, i32* %4
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.3, i64 0, i64 0), i32 %15, i32 %16, i32 %17)
%19 = load i32, i32* %2
%20 = load i32, i32* %3
%21 = load i32, i32* %4
%22 = call double @vektor(i32 %19, i32 %20, i32 %21)
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), double %22)
br label %26
24: ; preds = %0
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0))
br label %26
26: ; preds = %24, %14
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [31 x i8] c"Bitte geben sie Y,X und Z an: \00"
@stdin = global i32 0
@.str.2 = [9 x i8] c"%d %d %d\00"
@.str.3 = [47 x i8] c"Der betrag des Vektors(%dy,%dx,%dz) betreagt: \00"
@.str.4 = [4 x i8] c"%f\0A\00"
@str = [61 x i8] c"Bitte geben sie die 3 Dimensionen ihres Vektors wie folgt an\00"
@str.6 = [16 x i8] c"Falsche eingabe\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [9 x i8]
%5 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%6 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%7 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%8 = getelementptr inbounds [9 x i8], [9 x i8]* %4, i64 0, i64 0
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @str, i64 0, i64 0))
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0))
%11 = load i32, i32* @stdin
%12 = call i32 @fgets(i8* %8, i32 9, i32 %11)
%13 = call i32 @sscanf(i8* %8, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32* %1, i32* %2, i32* %3)
%14 = icmp eq i32 %13, 3
br i1 %14, label %15, label %25
15: ; preds = %0
%16 = load i32, i32* %1
%17 = load i32, i32* %2
%18 = load i32, i32* %3
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @.str.3, i64 0, i64 0), i32 %16, i32 %17, i32 %18)
%20 = load i32, i32* %1
%21 = load i32, i32* %2
%22 = load i32, i32* %3
%23 = call double @vektor(i32 %20, i32 %21, i32 %22)
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), double %23)
br label %27
25: ; preds = %0
%26 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.6, i64 0, i64 0))
br label %27
27: ; preds = %25, %15
ret i32 0
}