#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 */
float n_t(float, float, float);
int /*<<< orphan*/ printf(char *, float, float);
void single_decay(float N0, float lambda, float dt) {
  float t_total = 5.0 / lambda;
  int n_points = (int)t_total / dt;
  int i;
  float t = 0.0;
  float n = n_t(t, N0, lambda);
  printf("%f %f\n", t, n);
  for (i = 0; i < n_points; i++) {
    t += dt;
    n = n_t(t, N0, lambda);
    printf("%f %f\n", t, n);
  }
}


x86 assembly (clang, -O0):
<single_decay>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xeb8(%rip),%xmm0
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
cvttss2si -0x10(%rbp),%eax
cvtsi2ss %eax,%xmm0
divss  -0xc(%rbp),%xmm0
cvttss2si %xmm0,%eax
mov    %eax,-0x14(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x1c(%rbp),%xmm0
movss  -0x4(%rbp),%xmm1
movss  -0x8(%rbp),%xmm2
call   1040 <n_t@plt>
movss  %xmm0,-0x20(%rbp)
movss  -0x1c(%rbp),%xmm0
movss  -0x20(%rbp),%xmm1
lea    0xe6c(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1200 <single_decay+0xe0>
movss  -0xc(%rbp),%xmm0
addss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x1c(%rbp),%xmm0
movss  -0x4(%rbp),%xmm1
movss  -0x8(%rbp),%xmm2
call   1040 <n_t@plt>
movss  %xmm0,-0x20(%rbp)
movss  -0x1c(%rbp),%xmm0
movss  -0x20(%rbp),%xmm1
lea    0xe1b(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11a8 <single_decay+0x88>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<single_decay>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
movaps %xmm1,%xmm3
movaps %xmm0,%xmm1
movss  0xecc(%rip),%xmm0
divss  %xmm3,%xmm0
cvttps2dq %xmm0,%xmm0
cvtdq2ps %xmm0,%xmm0
movss  %xmm2,0x14(%rsp)
divss  %xmm2,%xmm0
cvttss2si %xmm0,%ebp
xorps  %xmm0,%xmm0
movss  %xmm0,0x8(%rsp)
xorps  %xmm0,%xmm0
movss  %xmm1,0xc(%rsp)
movss  %xmm3,0x10(%rsp)
movaps %xmm3,%xmm2
call   1040 <n_t@plt>
movaps %xmm0,%xmm1
lea    0xe8d(%rip),%rdi
xorps  %xmm0,%xmm0
call   1030 <printf@plt>
test   %ebp,%ebp
jle    11c9 <single_decay+0xa9>
lea    0xe7a(%rip),%rbx
nopw   0x0(%rax,%rax,1)
movss  0x8(%rsp),%xmm0
addss  0x14(%rsp),%xmm0
movss  %xmm0,0x8(%rsp)
movss  0xc(%rsp),%xmm1
movss  0x10(%rsp),%xmm2
call   1040 <n_t@plt>
movaps %xmm0,%xmm1
mov    %rbx,%rdi
movss  0x8(%rsp),%xmm0
call   1030 <printf@plt>
add    $0xffffffff,%ebp
jne    1190 <single_decay+0x70>
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [7 x i8] c"%f %f\0A\00"
define void @single_decay(float %0, float %1, float %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca i32
%9 = alloca i32
%10 = alloca float
%11 = alloca float
store float %0, float* %4
store float %1, float* %5
store float %2, float* %6
%12 = load float, float* %5
%13 = fpext float %12 to double
%14 = fdiv double 5.000000e+00, %13
%15 = fptrunc double %14 to float
store float %15, float* %7
%16 = load float, float* %7
%17 = fptosi float %16 to i32
%18 = sitofp i32 %17 to float
%19 = load float, float* %6
%20 = fdiv float %18, %19
%21 = fptosi float %20 to i32
store i32 %21, i32* %8
store float 0.000000e+00, float* %10
%22 = load float, float* %10
%23 = load float, float* %4
%24 = load float, float* %5
%25 = call float @n_t(float %22, float %23, float %24)
store float %25, float* %11
%26 = load float, float* %10
%27 = load float, float* %11
%28 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), float %26, float %27)
store i32 0, i32* %9
br label %29
29: ; preds = %44, %3
%30 = load i32, i32* %9
%31 = load i32, i32* %8
%32 = icmp slt i32 %30, %31
br i1 %32, label %33, label %47
33: ; preds = %29
%34 = load float, float* %6
%35 = load float, float* %10
%36 = fadd float %35, %34
store float %36, float* %10
%37 = load float, float* %10
%38 = load float, float* %4
%39 = load float, float* %5
%40 = call float @n_t(float %37, float %38, float %39)
store float %40, float* %11
%41 = load float, float* %10
%42 = load float, float* %11
%43 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), float %41, float %42)
br label %44
44: ; preds = %33
%45 = load i32, i32* %9
%46 = add nsw i32 %45, 1
store i32 %46, i32* %9
br label %29
47: ; preds = %29
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"%f %f\0A\00"
define void @single_decay(float %0, float %1, float %2) {
%4 = fdiv float 5.000000e+00, %1
%5 = fptosi float %4 to i32
%6 = sitofp i32 %5 to float
%7 = fdiv float %6, %2
%8 = fptosi float %7 to i32
%9 = tail call float @n_t(float 0.000000e+00, float %0, float %1)
%10 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), float 0.000000e+00, float %9)
%11 = icmp sgt i32 %8, 0
br i1 %11, label %12, label %20
12: ; preds = %3, %12
%13 = phi float [ %15, %12 ], [ 0.000000e+00, %3 ]
%14 = phi i32 [ %18, %12 ], [ 0, %3 ]
%15 = fadd float %13, %2
%16 = tail call float @n_t(float %15, float %0, float %1)
%17 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), float %15, float %16)
%18 = add nuw nsw i32 %14, 1
%19 = icmp eq i32 %18, %8
br i1 %19, label %20, label %12
20: ; preds = %12, %3
ret void
}