#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, float);
void chance(float *money, float chance) {
  int count = 0;
  while (*money - chance > 0) {
    *money = *money - chance;
    count++;
  }
  printf("%d * %f Euro\n", count, chance);
}


x86 assembly (clang, -O0):
<chance>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
subss  -0xc(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jbe    1164 <chance+0x54>
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
subss  -0xc(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1128 <chance+0x18>
mov    -0x10(%rbp),%esi
movss  -0xc(%rbp),%xmm0
lea    0xe8d(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<chance>:
movss  (%rdi),%xmm1
subss  %xmm0,%xmm1
xor    %esi,%esi
xorps  %xmm2,%xmm2
ucomiss %xmm2,%xmm1
jbe    1143 <chance+0x33>
xor    %esi,%esi
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movaps %xmm1,%xmm3
add    $0x1,%esi
subss  %xmm0,%xmm1
ucomiss %xmm2,%xmm1
ja     1130 <chance+0x20>
movss  %xmm3,(%rdi)
lea    0xeb6(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"%d * %f Euro\0A\00"
define void @chance(float* %0, float %1) {
%3 = alloca float*
%4 = alloca float
%5 = alloca i32
store float* %0, float** %3
store float %1, float* %4
store i32 0, i32* %5
br label %6
6: ; preds = %12, %2
%7 = load float*, float** %3
%8 = load float, float* %7
%9 = load float, float* %4
%10 = fsub float %8, %9
%11 = fcmp ogt float %10, 0.000000e+00
br i1 %11, label %12, label %20
12: ; preds = %6
%13 = load float*, float** %3
%14 = load float, float* %13
%15 = load float, float* %4
%16 = fsub float %14, %15
%17 = load float*, float** %3
store float %16, float* %17
%18 = load i32, i32* %5
%19 = add nsw i32 %18, 1
store i32 %19, i32* %5
br label %6
20: ; preds = %6
%21 = load i32, i32* %5
%22 = load float, float* %4
%23 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %21, float %22)
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"%d * %f Euro\0A\00"
define void @chance(float* nocapture %0, float %1) {
%3 = load float, float* %0
%4 = fsub float %3, %1
%5 = fcmp ogt float %4, 0.000000e+00
br i1 %5, label %6, label %13
6: ; preds = %2, %6
%7 = phi float [ %10, %6 ], [ %4, %2 ]
%8 = phi i32 [ %9, %6 ], [ 0, %2 ]
%9 = add nuw nsw i32 %8, 1
%10 = fsub float %7, %1
%11 = fcmp ogt float %10, 0.000000e+00
br i1 %11, label %6, label %12
12: ; preds = %6
store float %7, float* %0
br label %13
13: ; preds = %12, %2
%14 = phi i32 [ %9, %12 ], [ 0, %2 ]
%15 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %14, float %1)
ret void
}