#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*/ scanf(char *, int *);
int main() {
  int i;
  int Potenza = 1;
  int CurrentCoin = 0;
  int AmountCoins[8];
  int CashValue = 0;
  double offset_2 = 0.25;
  int offset_10 = 0;
  int n = 0;
  int offset = 10;
  for (i = 0; i < 8; i++) {
    CurrentCoin = Potenza + offset_2 + offset_10;
    if (CurrentCoin < 100) {
      if (CurrentCoin == 1)
        printf("Please enter the sum of %d cent coin\n", CurrentCoin);
      else
        printf("Please enter the sum of %d cent coins\n", CurrentCoin);
    } else {
      if (CurrentCoin == 100)
        printf("Please enter the sum of %d Euro coin\n", CurrentCoin / 100);
      else
        printf("Please enter the sum of %d Euros coins\n", CurrentCoin / 100);
    }
    scanf("%d", &AmountCoins[i]);
    CashValue += AmountCoins[i] * CurrentCoin;
    Potenza += Potenza;
    offset_2 += offset_2;
    n++;
    offset_10 += offset_10;
    if (n == 5) {
      offset_10 += offset;
      n = 2;
      offset *= 10;
    }
  }
  printf("Thx you for entring the sum of coins!\n\n");
  printf("The sum of all coins is: %d in Cents and %d,%d in Euros\n", CashValue,
         CashValue / 100, CashValue - (CashValue / 100) * 100);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x34(%rbp)
movsd  0xeb4(%rip),%xmm0
movsd  %xmm0,-0x40(%rbp)
movl   $0x0,-0x44(%rbp)
movl   $0x0,-0x48(%rbp)
movl   $0xa,-0x4c(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x8,-0x8(%rbp)
jge    12a6 <main+0x186>
cvtsi2sdl -0xc(%rbp),%xmm0
addsd  -0x40(%rbp),%xmm0
cvtsi2sdl -0x44(%rbp),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x64,-0x10(%rbp)
jge    11d1 <main+0xb1>
cmpl   $0x1,-0x10(%rbp)
jne    11bb <main+0x9b>
mov    -0x10(%rbp),%esi
lea    0xe59(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11cc <main+0xac>
mov    -0x10(%rbp),%esi
lea    0xe69(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    121b <main+0xfb>
cmpl   $0x64,-0x10(%rbp)
jne    11fb <main+0xdb>
mov    -0x10(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
lea    0xe66(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1216 <main+0xf6>
mov    -0x10(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
lea    0xe6c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    121b <main+0xfb>
movslq -0x8(%rbp),%rax
lea    -0x30(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe72(%rip),%rdi
call   1040 <scanf@plt>
movslq -0x8(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
imul   -0x10(%rbp),%eax
add    -0x34(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0xc(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
movsd  -0x40(%rbp),%xmm0
addsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
mov    -0x44(%rbp),%eax
add    -0x44(%rbp),%eax
mov    %eax,-0x44(%rbp)
cmpl   $0x5,-0x48(%rbp)
jne    1293 <main+0x173>
mov    -0x4c(%rbp),%eax
add    -0x44(%rbp),%eax
mov    %eax,-0x44(%rbp)
movl   $0x2,-0x48(%rbp)
imul   $0xa,-0x4c(%rbp),%eax
mov    %eax,-0x4c(%rbp)
jmp    1298 <main+0x178>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    116d <main+0x4d>
lea    0xdf9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x34(%rbp),%esi
mov    -0x34(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %eax,-0x50(%rbp)
mov    -0x34(%rbp),%ecx
mov    -0x34(%rbp),%eax
mov    $0x64,%edi
cltd
idiv   %edi
mov    -0x50(%rbp),%edx
imul   $0x64,%eax,%eax
sub    %eax,%ecx
lea    0xdec(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    $0x1,%r14d
movsd  0xeb4(%rip),%xmm2
mov    $0xa,%eax
xor    %r15d,%r15d
xor    %ebx,%ebx
xor    %r12d,%r12d
xor    %r13d,%r13d
jmp    11d6 <main+0xa6>
xchg   %ax,%ax
mov    %ebp,%eax
imul   $0x51eb851f,%rax,%rsi
shr    $0x25,%rsi
lea    0xf07(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    (%rsp,%r15,1),%rsi
add    $0x10,%rsi
lea    0xf19(%rip),%rdi
call   1050 <scanf@plt>
imul   0x10(%rsp,%r15,1),%ebp
add    %ebp,%r13d
add    %r14d,%r14d
movsd  0x8(%rsp),%xmm2
addsd  %xmm2,%xmm2
add    $0x1,%ebx
mov    (%rsp),%rdx
lea    (%rdx,%rdx,1),%eax
cmp    $0x5,%ebx
mov    $0x0,%ecx
cmove  %edx,%ecx
lea    (%rax,%rax,4),%eax
lea    (%rcx,%r12,2),%r12d
mov    $0x2,%ecx
cmove  %ecx,%ebx
cmovne %edx,%eax
add    $0x4,%r15
cmp    $0x20,%r15
je     124e <main+0x11e>
xorps  %xmm0,%xmm0
cvtsi2sd %r14d,%xmm0
addsd  %xmm2,%xmm0
xorps  %xmm1,%xmm1
cvtsi2sd %r12d,%xmm1
addsd  %xmm0,%xmm1
cvttsd2si %xmm1,%ebp
cmp    $0x63,%ebp
movsd  %xmm2,0x8(%rsp)
mov    %rax,(%rsp)
jg     1220 <main+0xf0>
cmp    $0x1,%ebp
jne    1240 <main+0x110>
lea    0xdfb(%rip),%rdi
mov    $0x1,%esi
jmp    1174 <main+0x44>
nopw   0x0(%rax,%rax,1)
cmp    $0x64,%ebp
jne    1160 <main+0x30>
lea    0xe25(%rip),%rdi
mov    $0x1,%esi
jmp    1174 <main+0x44>
nopw   0x0(%rax,%rax,1)
lea    0xde7(%rip),%rdi
mov    %ebp,%esi
jmp    1174 <main+0x44>
lea    0xe8a(%rip),%rdi
call   1030 <puts@plt>
movslq %r13d,%rsi
imul   $0x51eb851f,%rsi,%rdx
mov    %rdx,%rax
shr    $0x3f,%rax
sar    $0x25,%rdx
add    %eax,%edx
imul   $0xffffff9c,%edx,%ecx
add    %esi,%ecx
lea    0xe29(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [38 x i8] c"Please enter the sum of %d cent coin\0A\00"
@.str.1 = [39 x i8] c"Please enter the sum of %d cent coins\0A\00"
@.str.2 = [38 x i8] c"Please enter the sum of %d Euro coin\0A\00"
@.str.3 = [40 x i8] c"Please enter the sum of %d Euros coins\0A\00"
@.str.4 = [3 x i8] c"%d\00"
@.str.5 = [40 x i8] c"Thx you for entring the sum of coins!\0A\0A\00"
@.str.6 = [57 x i8] c"The sum of all coins is: %d in Cents and %d,%d in Euros\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca [8 x i32]
%6 = alloca i32
%7 = alloca double
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %3
store i32 0, i32* %4
store i32 0, i32* %6
store double 2.500000e-01, double* %7
store i32 0, i32* %8
store i32 0, i32* %9
store i32 10, i32* %10
store i32 0, i32* %2
br label %11
11: ; preds = %80, %0
%12 = load i32, i32* %2
%13 = icmp slt i32 %12, 8
br i1 %13, label %14, label %83
14: ; preds = %11
%15 = load i32, i32* %3
%16 = sitofp i32 %15 to double
%17 = load double, double* %7
%18 = fadd double %16, %17
%19 = load i32, i32* %8
%20 = sitofp i32 %19 to double
%21 = fadd double %18, %20
%22 = fptosi double %21 to i32
store i32 %22, i32* %4
%23 = load i32, i32* %4
%24 = icmp slt i32 %23, 100
br i1 %24, label %25, label %35
25: ; preds = %14
%26 = load i32, i32* %4
%27 = icmp eq i32 %26, 1
br i1 %27, label %28, label %31
28: ; preds = %25
%29 = load i32, i32* %4
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i32 %29)
br label %34
31: ; preds = %25
%32 = load i32, i32* %4
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), i32 %32)
br label %34
34: ; preds = %31, %28
br label %47
35: ; preds = %14
%36 = load i32, i32* %4
%37 = icmp eq i32 %36, 100
br i1 %37, label %38, label %42
38: ; preds = %35
%39 = load i32, i32* %4
%40 = sdiv i32 %39, 100
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0), i32 %40)
br label %46
42: ; preds = %35
%43 = load i32, i32* %4
%44 = sdiv i32 %43, 100
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.3, i64 0, i64 0), i32 %44)
br label %46
46: ; preds = %42, %38
br label %47
47: ; preds = %46, %34
%48 = load i32, i32* %2
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds [8 x i32], [8 x i32]* %5, i64 0, i64 %49
%51 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %50)
%52 = load i32, i32* %2
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds [8 x i32], [8 x i32]* %5, i64 0, i64 %53
%55 = load i32, i32* %54
%56 = load i32, i32* %4
%57 = mul nsw i32 %55, %56
%58 = load i32, i32* %6
%59 = add nsw i32 %58, %57
store i32 %59, i32* %6
%60 = load i32, i32* %3
%61 = load i32, i32* %3
%62 = add nsw i32 %61, %60
store i32 %62, i32* %3
%63 = load double, double* %7
%64 = load double, double* %7
%65 = fadd double %64, %63
store double %65, double* %7
%66 = load i32, i32* %9
%67 = add nsw i32 %66, 1
store i32 %67, i32* %9
%68 = load i32, i32* %8
%69 = load i32, i32* %8
%70 = add nsw i32 %69, %68
store i32 %70, i32* %8
%71 = load i32, i32* %9
%72 = icmp eq i32 %71, 5
br i1 %72, label %73, label %79
73: ; preds = %47
%74 = load i32, i32* %10
%75 = load i32, i32* %8
%76 = add nsw i32 %75, %74
store i32 %76, i32* %8
store i32 2, i32* %9
%77 = load i32, i32* %10
%78 = mul nsw i32 %77, 10
store i32 %78, i32* %10
br label %79
79: ; preds = %73, %47
br label %80
80: ; preds = %79
%81 = load i32, i32* %2
%82 = add nsw i32 %81, 1
store i32 %82, i32* %2
br label %11
83: ; preds = %11
%84 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.5, i64 0, i64 0))
%85 = load i32, i32* %6
%86 = load i32, i32* %6
%87 = sdiv i32 %86, 100
%88 = load i32, i32* %6
%89 = load i32, i32* %6
%90 = sdiv i32 %89, 100
%91 = mul nsw i32 %90, 100
%92 = sub nsw i32 %88, %91
%93 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.6, i64 0, i64 0), i32 %85, i32 %87, i32 %92)
ret i32 0
}

LLVM IR (-O2):
@.str = [38 x i8] c"Please enter the sum of %d cent coin\0A\00"
@.str.1 = [39 x i8] c"Please enter the sum of %d cent coins\0A\00"
@.str.2 = [38 x i8] c"Please enter the sum of %d Euro coin\0A\00"
@.str.3 = [40 x i8] c"Please enter the sum of %d Euros coins\0A\00"
@.str.4 = [3 x i8] c"%d\00"
@.str.6 = [57 x i8] c"The sum of all coins is: %d in Cents and %d,%d in Euros\0A\00"
@str = [39 x i8] c"Thx you for entring the sum of coins!\0A\00"
define i32 @main() {
%1 = alloca [8 x i32]
%2 = bitcast [8 x i32]* %1 to i8*
br label %3
3: ; preds = %0, %30
%4 = phi i64 [ 0, %0 ], [ %46, %30 ]
%5 = phi i32 [ 10, %0 ], [ %45, %30 ]
%6 = phi i32 [ 0, %0 ], [ %44, %30 ]
%7 = phi i32 [ 0, %0 ], [ %43, %30 ]
%8 = phi double [ 2.500000e-01, %0 ], [ %37, %30 ]
%9 = phi i32 [ 0, %0 ], [ %35, %30 ]
%10 = phi i32 [ 1, %0 ], [ %36, %30 ]
%11 = sitofp i32 %10 to double
%12 = fadd double %8, %11
%13 = sitofp i32 %7 to double
%14 = fadd double %12, %13
%15 = fptosi double %14 to i32
%16 = icmp slt i32 %15, 100
br i1 %16, label %17, label %23
17: ; preds = %3
%18 = icmp eq i32 %15, 1
br i1 %18, label %19, label %21
19: ; preds = %17
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i32 1)
br label %30
21: ; preds = %17
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), i32 %15)
br label %30
23: ; preds = %3
%24 = icmp eq i32 %15, 100
br i1 %24, label %25, label %27
25: ; preds = %23
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0), i32 1)
br label %30
27: ; preds = %23
%28 = udiv i32 %15, 100
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.3, i64 0, i64 0), i32 %28)
br label %30
30: ; preds = %25, %27, %19, %21
%31 = getelementptr inbounds [8 x i32], [8 x i32]* %1, i64 0, i64 %4
%32 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %31)
%33 = load i32, i32* %31
%34 = mul nsw i32 %33, %15
%35 = add nsw i32 %34, %9
%36 = shl nsw i32 %10, 1
%37 = fadd double %8, %8
%38 = add nsw i32 %6, 1
%39 = shl nsw i32 %7, 1
%40 = icmp eq i32 %38, 5
%41 = mul nsw i32 %5, 10
%42 = select i1 %40, i32 %5, i32 0
%43 = add nsw i32 %42, %39
%44 = select i1 %40, i32 2, i32 %38
%45 = select i1 %40, i32 %41, i32 %5
%46 = add nuw nsw i64 %4, 1
%47 = icmp eq i64 %46, 8
br i1 %47, label %48, label %3
48: ; preds = %30
%49 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str, i64 0, i64 0))
%50 = sdiv i32 %35, 100
%51 = mul nsw i32 %50, -100
%52 = add i32 %51, %35
%53 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @.str.6, i64 0, i64 0), i32 %35, i32 %50, i32 %52)
ret i32 0
}