#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*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, unsigned int *);
int /*<<< orphan*/ stdin;
int main(void) {
  unsigned int k1, k2, k3, k4, total;
  printf("Stimmen fuer den 1. Kandidat: ");
  scanf("%u", &k1);
  printf("Stimmen fuer den 2. Kandidat: ");
  scanf("%u", &k2);
  printf("Stimmen fuer den 3. Kandidat: ");
  scanf("%u", &k3);
  printf("Stimmen fuer den 4. Kandidat: ");
  scanf("%u", &k4);
  total = k1 + k2 + k3 + k4;
  double var = k1;
  printf("1. Kandidat: %.2lf%%\n", (double)k1 / total * 100);
  printf("1. Kandidat: %.2lf%%\n", (double)k2 / total * 100);
  printf("1. Kandidat: %.2lf%%\n", (double)k3 / total * 100);
  printf("1. Kandidat: %.2lf%%\n", (double)k4 / total * 100);
  fflush(stdin);
  getchar();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeb2(%rip),%rdi
xor    %eax,%eax
mov    %al,-0x41(%rbp)
call   1030 <printf@plt>
lea    0xec0(%rip),%rdi
mov    %rdi,-0x40(%rbp)
lea    -0x8(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0x41(%rbp),%al
lea    0xeac(%rip),%rdi
call   1030 <printf@plt>
mov    -0x40(%rbp),%rdi
lea    -0xc(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0x41(%rbp),%al
lea    0xeaf(%rip),%rdi
call   1030 <printf@plt>
mov    -0x40(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0x41(%rbp),%al
lea    0xeb2(%rip),%rdi
call   1030 <printf@plt>
mov    -0x40(%rbp),%rdi
lea    -0x14(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    -0xc(%rbp),%ecx
add    %ecx,%eax
mov    -0x10(%rbp),%ecx
add    %ecx,%eax
mov    -0x14(%rbp),%ecx
add    %ecx,%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
cvtsi2sd %rax,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%eax
cvtsi2sd %rax,%xmm0
mov    -0x18(%rbp),%eax
cvtsi2sd %rax,%xmm1
divsd  %xmm1,%xmm0
movsd  0xdfa(%rip),%xmm1
movsd  %xmm1,-0x38(%rbp)
mulsd  %xmm1,%xmm0
lea    0xe71(%rip),%rdi
mov    %rdi,-0x30(%rbp)
mov    $0x1,%al
mov    %al,-0x21(%rbp)
call   1030 <printf@plt>
movsd  -0x38(%rbp),%xmm1
mov    -0x30(%rbp),%rdi
mov    -0x21(%rbp),%al
mov    -0xc(%rbp),%ecx
cvtsi2sd %rcx,%xmm0
mov    -0x18(%rbp),%ecx
cvtsi2sd %rcx,%xmm2
divsd  %xmm2,%xmm0
mulsd  %xmm1,%xmm0
call   1030 <printf@plt>
movsd  -0x38(%rbp),%xmm1
mov    -0x30(%rbp),%rdi
mov    -0x21(%rbp),%al
mov    -0x10(%rbp),%ecx
cvtsi2sd %rcx,%xmm0
mov    -0x18(%rbp),%ecx
cvtsi2sd %rcx,%xmm2
divsd  %xmm2,%xmm0
mulsd  %xmm1,%xmm0
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
cvtsi2sd %rax,%xmm0
mov    -0x18(%rbp),%eax
cvtsi2sd %rax,%xmm1
divsd  %xmm1,%xmm0
movsd  0xd6e(%rip),%xmm1
mulsd  %xmm1,%xmm0
lea    0xdea(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    0x2d3d(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
lea    0xebc(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xecd(%rip),%rbx
lea    0x1c(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
lea    0xebc(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
lea    0xec0(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
lea    0xec4(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
mov    0x1c(%rsp),%eax
mov    0xc(%rsp),%ecx
add    %eax,%ecx
add    0x8(%rsp),%ecx
add    0x4(%rsp),%ecx
cvtsi2sd %rax,%xmm0
cvtsi2sd %rcx,%xmm1
movsd  %xmm1,0x10(%rsp)
divsd  %xmm1,%xmm0
mulsd  0xe1a(%rip),%xmm0
lea    0xe9a(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    0xc(%rsp),%eax
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
divsd  0x10(%rsp),%xmm0
mulsd  0xdef(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    0x8(%rsp),%eax
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
divsd  0x10(%rsp),%xmm0
mulsd  0xdcb(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    0x4(%rsp),%eax
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
divsd  0x10(%rsp),%xmm0
mulsd  0xda7(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    0x2d7e(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [31 x i8] c"Stimmen fuer den 1. Kandidat: \00"
@.str.1 = [3 x i8] c"%u\00"
@.str.2 = [31 x i8] c"Stimmen fuer den 2. Kandidat: \00"
@.str.3 = [31 x i8] c"Stimmen fuer den 3. Kandidat: \00"
@.str.4 = [31 x i8] c"Stimmen fuer den 4. Kandidat: \00"
@.str.5 = [22 x i8] c"1. Kandidat: %.2lf%%\0A\00"
@stdin = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca double
store i32 0, i32* %1
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0))
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %5)
%16 = load i32, i32* %2
%17 = load i32, i32* %3
%18 = add i32 %16, %17
%19 = load i32, i32* %4
%20 = add i32 %18, %19
%21 = load i32, i32* %5
%22 = add i32 %20, %21
store i32 %22, i32* %6
%23 = load i32, i32* %2
%24 = uitofp i32 %23 to double
store double %24, double* %7
%25 = load i32, i32* %2
%26 = uitofp i32 %25 to double
%27 = load i32, i32* %6
%28 = uitofp i32 %27 to double
%29 = fdiv double %26, %28
%30 = fmul double %29, 1.000000e+02
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), double %30)
%32 = load i32, i32* %3
%33 = uitofp i32 %32 to double
%34 = load i32, i32* %6
%35 = uitofp i32 %34 to double
%36 = fdiv double %33, %35
%37 = fmul double %36, 1.000000e+02
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), double %37)
%39 = load i32, i32* %4
%40 = uitofp i32 %39 to double
%41 = load i32, i32* %6
%42 = uitofp i32 %41 to double
%43 = fdiv double %40, %42
%44 = fmul double %43, 1.000000e+02
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), double %44)
%46 = load i32, i32* %5
%47 = uitofp i32 %46 to double
%48 = load i32, i32* %6
%49 = uitofp i32 %48 to double
%50 = fdiv double %47, %49
%51 = fmul double %50, 1.000000e+02
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), double %51)
%53 = load i32, i32* @stdin
%54 = call i32 @fflush(i32 %53)
%55 = call i32 (...) @getchar()
ret i32 0
}

LLVM IR (-O2):
@.str = [31 x i8] c"Stimmen fuer den 1. Kandidat: \00"
@.str.1 = [3 x i8] c"%u\00"
@.str.2 = [31 x i8] c"Stimmen fuer den 2. Kandidat: \00"
@.str.3 = [31 x i8] c"Stimmen fuer den 3. Kandidat: \00"
@.str.4 = [31 x i8] c"Stimmen fuer den 4. Kandidat: \00"
@.str.5 = [22 x i8] c"1. Kandidat: %.2lf%%\0A\00"
@stdin = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %1 to i8*
%6 = bitcast i32* %2 to i8*
%7 = bitcast i32* %3 to i8*
%8 = bitcast i32* %4 to i8*
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0))
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%17 = load i32, i32* %1
%18 = load i32, i32* %2
%19 = add i32 %18, %17
%20 = load i32, i32* %3
%21 = add i32 %19, %20
%22 = load i32, i32* %4
%23 = add i32 %21, %22
%24 = uitofp i32 %17 to double
%25 = uitofp i32 %23 to double
%26 = fdiv double %24, %25
%27 = fmul double %26, 1.000000e+02
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), double %27)
%29 = load i32, i32* %2
%30 = uitofp i32 %29 to double
%31 = fdiv double %30, %25
%32 = fmul double %31, 1.000000e+02
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), double %32)
%34 = load i32, i32* %3
%35 = uitofp i32 %34 to double
%36 = fdiv double %35, %25
%37 = fmul double %36, 1.000000e+02
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), double %37)
%39 = load i32, i32* %4
%40 = uitofp i32 %39 to double
%41 = fdiv double %40, %25
%42 = fmul double %41, 1.000000e+02
%43 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), double %42)
%44 = load i32, i32* @stdin
%45 = call i32 @fflush(i32 %44)
%46 = call i32 (...) @getchar()
ret i32 0
}