#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*/ step(double);
int /*<<< orphan*/ write_step(int);
void run(int steps, double dt) {
  double time = 0.0;
  write_step(0);
  double sdt = dt / (double)5;
  for (int i = 1; i <= steps; ++i) {
    for (int j = 0; j < 5; ++j) {
      step(sdt);
      time += sdt;
    }
    write_step(i);
  }
}


x86 assembly (clang, -O0):
<run>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
movsd  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
xor    %edi,%edi
call   1030 <write_step@plt>
movsd  -0x10(%rbp),%xmm0
movsd  0xeb4(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movl   $0x1,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     11b6 <run+0x96>
movl   $0x0,-0x28(%rbp)
cmpl   $0x5,-0x28(%rbp)
jge    11a0 <run+0x80>
movsd  -0x20(%rbp),%xmm0
call   1040 <step@plt>
movsd  -0x20(%rbp),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    116f <run+0x4f>
mov    -0x24(%rbp),%edi
call   1030 <write_step@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    115c <run+0x3c>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<run>:
push   %r14
push   %rbx
push   %rax
movsd  %xmm0,(%rsp)
mov    %edi,%r14d
xor    %edi,%edi
call   1030 <write_step@plt>
test   %r14d,%r14d
jle    11ac <run+0x8c>
movsd  (%rsp),%xmm0
divsd  0xebb(%rip),%xmm0
movsd  %xmm0,(%rsp)
neg    %r14d
mov    $0x1,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsd  (%rsp),%xmm0
call   1040 <step@plt>
movsd  (%rsp),%xmm0
call   1040 <step@plt>
movsd  (%rsp),%xmm0
call   1040 <step@plt>
movsd  (%rsp),%xmm0
call   1040 <step@plt>
movsd  (%rsp),%xmm0
call   1040 <step@plt>
mov    %ebx,%edi
call   1030 <write_step@plt>
lea    (%r14,%rbx,1),%eax
add    $0x1,%eax
mov    %ebx,%ecx
add    $0x1,%ecx
mov    %ecx,%ebx
cmp    $0x1,%eax
jne    1160 <run+0x40>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @run(i32 %0, double %1) {
%3 = alloca i32
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %3
store double %1, double* %4
store double 0.000000e+00, double* %5
%9 = call i32 @write_step(i32 0)
%10 = load double, double* %4
%11 = fdiv double %10, 5.000000e+00
store double %11, double* %6
store i32 1, i32* %7
br label %12
12: ; preds = %32, %2
%13 = load i32, i32* %7
%14 = load i32, i32* %3
%15 = icmp sle i32 %13, %14
br i1 %15, label %16, label %35
16: ; preds = %12
store i32 0, i32* %8
br label %17
17: ; preds = %26, %16
%18 = load i32, i32* %8
%19 = icmp slt i32 %18, 5
br i1 %19, label %20, label %29
20: ; preds = %17
%21 = load double, double* %6
%22 = call i32 @step(double %21)
%23 = load double, double* %6
%24 = load double, double* %5
%25 = fadd double %24, %23
store double %25, double* %5
br label %26
26: ; preds = %20
%27 = load i32, i32* %8
%28 = add nsw i32 %27, 1
store i32 %28, i32* %8
br label %17
29: ; preds = %17
%30 = load i32, i32* %7
%31 = call i32 @write_step(i32 %30)
br label %32
32: ; preds = %29
%33 = load i32, i32* %7
%34 = add nsw i32 %33, 1
store i32 %34, i32* %7
br label %12
35: ; preds = %12
ret void
}

LLVM IR (-O2):
define void @run(i32 %0, double %1) {
%3 = tail call i32 @write_step(i32 0)
%4 = fdiv double %1, 5.000000e+00
%5 = icmp slt i32 %0, 1
br i1 %5, label %16, label %6
6: ; preds = %2, %6
%7 = phi i32 [ %14, %6 ], [ 1, %2 ]
%8 = tail call i32 @step(double %4)
%9 = tail call i32 @step(double %4)
%10 = tail call i32 @step(double %4)
%11 = tail call i32 @step(double %4)
%12 = tail call i32 @step(double %4)
%13 = tail call i32 @write_step(i32 %7)
%14 = add nuw i32 %7, 1
%15 = icmp eq i32 %7, %0
br i1 %15, label %16, label %6
16: ; preds = %6, %2
ret void
}