#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ dbr_abort(int);
int /*<<< orphan*/ dbr_mesg(char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, double, double,
                           double);
int process_output_step(double pattern_from, double pattern_to,
                        double pattern_step, FILE *f) {
  int n = (pattern_to - pattern_from) / pattern_step;
  fprintf(f, "\n#from %g to %g step %g\n", pattern_from, pattern_to,
          pattern_step);
  if (n < 1) {
    dbr_mesg("Error: Incorrect values for pattern from/to/step.\n");
    dbr_abort(1);
  }
  return n;
}


x86 assembly (clang, -O0):
<process_output_step>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
mov    %rdi,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
subsd  -0x8(%rbp),%xmm0
divsd  -0x18(%rbp),%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%rdi
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
lea    0xe85(%rip),%rsi
call   1030 <fprintf@plt>
cmpl   $0x1,-0x24(%rbp)
jge    11a0 <process_output_step+0x70>
lea    0xe88(%rip),%rdi
call   1040 <dbr_mesg@plt>
mov    $0x1,%edi
call   1050 <dbr_abort@plt>
mov    -0x24(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<process_output_step>:
push   %rbx
movapd %xmm1,%xmm3
subsd  %xmm0,%xmm3
divsd  %xmm2,%xmm3
cvttsd2si %xmm3,%ebx
lea    0xeb8(%rip),%rsi
call   1030 <fprintf@plt>
test   %ebx,%ebx
jg     1167 <process_output_step+0x37>
lea    0xec1(%rip),%rdi
call   1040 <dbr_mesg@plt>
mov    $0x1,%edi
call   1050 <dbr_abort@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [25 x i8] c"\0A#from %g to %g step %g\0A\00"
@.str.1 = [51 x i8] c"Error: Incorrect values for pattern from/to/step.\0A\00"
define i32 @process_output_step(double %0, double %1, double %2, i32* %3) {
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca i32*
%9 = alloca i32
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
store i32* %3, i32** %8
%10 = load double, double* %6
%11 = load double, double* %5
%12 = fsub double %10, %11
%13 = load double, double* %7
%14 = fdiv double %12, %13
%15 = fptosi double %14 to i32
store i32 %15, i32* %9
%16 = load i32*, i32** %8
%17 = load double, double* %5
%18 = load double, double* %6
%19 = load double, double* %7
%20 = call i32 @fprintf(i32* %16, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), double %17, double %18, double %19)
%21 = load i32, i32* %9
%22 = icmp slt i32 %21, 1
br i1 %22, label %23, label %26
23: ; preds = %4
%24 = call i32 @dbr_mesg(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.1, i64 0, i64 0))
%25 = call i32 @dbr_abort(i32 1)
br label %26
26: ; preds = %23, %4
%27 = load i32, i32* %9
ret i32 %27
}

LLVM IR (-O2):
@.str = [25 x i8] c"\0A#from %g to %g step %g\0A\00"
@.str.1 = [51 x i8] c"Error: Incorrect values for pattern from/to/step.\0A\00"
define i32 @process_output_step(double %0, double %1, double %2, i32* nocapture %3) {
%5 = fsub double %1, %0
%6 = fdiv double %5, %2
%7 = fptosi double %6 to i32
%8 = tail call i32 @fprintf(i32* %3, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), double %0, double %1, double %2)
%9 = icmp slt i32 %7, 1
br i1 %9, label %10, label %13
10: ; preds = %4
%11 = tail call i32 @dbr_mesg(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.1, i64 0, i64 0))
%12 = tail call i32 @dbr_abort(i32 1)
br label %13
13: ; preds = %10, %4
ret i32 %7
}