#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 floor(double);
unsigned char *get_byte_map(float slope, float offset, int outmin, int outmax) {
  static unsigned char map[256];
  int i, ival;
  float fpixel;
  for (i = 0; i < 256; i++) {
    fpixel = i;
    fpixel *= slope;
    fpixel += offset;
    ival = floor((double)fpixel + 0.5);
    if (ival < outmin)
      ival = outmin;
    if (ival > outmax)
      ival = outmax;
    map[i] = ival;
  }
  return (map);
}


x86 assembly (clang, -O0):
<get_byte_map>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
mov    %edi,-0xc(%rbp)
mov    %esi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x100,-0x14(%rbp)
jge    11c6 <get_byte_map+0xb6>
cvtsi2ssl -0x14(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x4(%rbp),%xmm0
mulss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x8(%rbp),%xmm0
addss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe8b(%rip),%xmm1
addsd  %xmm1,%xmm0
call   1030 <floor@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1193 <get_byte_map+0x83>
mov    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x10(%rbp),%eax
jle    11a5 <get_byte_map+0x95>
mov    -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    %al,%dl
movslq -0x14(%rbp),%rcx
lea    0x2e8b(%rip),%rax
mov    %dl,(%rax,%rcx,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    112f <get_byte_map+0x1f>
lea    0x2e73(%rip),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_byte_map>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %esi,%r14d
mov    %edi,%ebp
movss  %xmm1,0x4(%rsp)
movss  %xmm0,(%rsp)
xor    %ebx,%ebx
lea    0x2f10(%rip),%r15
jmp    1152 <get_byte_map+0x42>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %al,0x1(%rbx,%r15,1)
add    $0x2,%rbx
cmp    $0x100,%rbx
je     11cc <get_byte_map+0xbc>
xorps  %xmm0,%xmm0
cvtsi2ss %ebx,%xmm0
mulss  (%rsp),%xmm0
addss  0x4(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
addsd  0xe90(%rip),%xmm0
call   1030 <floor@plt>
mov    %ebp,%ecx
cmp    %ebp,%eax
jl     117d <get_byte_map+0x6d>
mov    %eax,%ecx
mov    %r14d,%eax
cmp    %r14d,%ecx
jg     1187 <get_byte_map+0x77>
mov    %ecx,%eax
mov    %al,(%rbx,%r15,1)
lea    0x1(%rbx),%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
mulss  (%rsp),%xmm0
addss  0x4(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
addsd  0xe54(%rip),%xmm0
call   1030 <floor@plt>
mov    %ebp,%ecx
cmp    %ebp,%eax
jl     11b9 <get_byte_map+0xa9>
mov    %eax,%ecx
mov    %r14d,%eax
cmp    %r14d,%ecx
jg     1140 <get_byte_map+0x30>
mov    %ecx,%eax
jmp    1140 <get_byte_map+0x30>
lea    0x2e6d(%rip),%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@get_byte_map.map = internal global [256 x i8] zeroinitializer
define i8* @get_byte_map(float %0, float %1, i32 %2, i32 %3) {
%5 = alloca float
%6 = alloca float
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca float
store float %0, float* %5
store float %1, float* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
store i32 0, i32* %9
br label %12
12: ; preds = %45, %4
%13 = load i32, i32* %9
%14 = icmp slt i32 %13, 256
br i1 %14, label %15, label %48
15: ; preds = %12
%16 = load i32, i32* %9
%17 = sitofp i32 %16 to float
store float %17, float* %11
%18 = load float, float* %5
%19 = load float, float* %11
%20 = fmul float %19, %18
store float %20, float* %11
%21 = load float, float* %6
%22 = load float, float* %11
%23 = fadd float %22, %21
store float %23, float* %11
%24 = load float, float* %11
%25 = fpext float %24 to double
%26 = fadd double %25, 5.000000e-01
%27 = call i32 @floor(double %26)
store i32 %27, i32* %10
%28 = load i32, i32* %10
%29 = load i32, i32* %7
%30 = icmp slt i32 %28, %29
br i1 %30, label %31, label %33
31: ; preds = %15
%32 = load i32, i32* %7
store i32 %32, i32* %10
br label %33
33: ; preds = %31, %15
%34 = load i32, i32* %10
%35 = load i32, i32* %8
%36 = icmp sgt i32 %34, %35
br i1 %36, label %37, label %39
37: ; preds = %33
%38 = load i32, i32* %8
store i32 %38, i32* %10
br label %39
39: ; preds = %37, %33
%40 = load i32, i32* %10
%41 = trunc i32 %40 to i8
%42 = load i32, i32* %9
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds [256 x i8], [256 x i8]* @get_byte_map.map, i64 0, i64 %43
store i8 %41, i8* %44
br label %45
45: ; preds = %39
%46 = load i32, i32* %9
%47 = add nsw i32 %46, 1
store i32 %47, i32* %9
br label %12
48: ; preds = %12
ret i8* getelementptr inbounds ([256 x i8], [256 x i8]* @get_byte_map.map, i64 0, i64 0)
}

LLVM IR (-O2):
@get_byte_map.map = internal global [256 x i8] zeroinitializer
define i8* @get_byte_map(float %0, float %1, i32 %2, i32 %3) {
br label %5
5: ; preds = %5, %4
%6 = phi i64 [ 0, %4 ], [ %34, %5 ]
%7 = trunc i64 %6 to i32
%8 = sitofp i32 %7 to float
%9 = fmul float %8, %0
%10 = fadd float %9, %1
%11 = fpext float %10 to double
%12 = fadd double %11, 5.000000e-01
%13 = tail call i32 @floor(double %12)
%14 = icmp slt i32 %13, %2
%15 = select i1 %14, i32 %2, i32 %13
%16 = icmp sgt i32 %15, %3
%17 = select i1 %16, i32 %3, i32 %15
%18 = trunc i32 %17 to i8
%19 = getelementptr inbounds [256 x i8], [256 x i8]* @get_byte_map.map, i64 0, i64 %6
store i8 %18, i8* %19
%20 = or i64 %6, 1
%21 = trunc i64 %20 to i32
%22 = sitofp i32 %21 to float
%23 = fmul float %22, %0
%24 = fadd float %23, %1
%25 = fpext float %24 to double
%26 = fadd double %25, 5.000000e-01
%27 = tail call i32 @floor(double %26)
%28 = icmp slt i32 %27, %2
%29 = select i1 %28, i32 %2, i32 %27
%30 = icmp sgt i32 %29, %3
%31 = select i1 %30, i32 %3, i32 %29
%32 = trunc i32 %31 to i8
%33 = getelementptr inbounds [256 x i8], [256 x i8]* @get_byte_map.map, i64 0, i64 %20
store i8 %32, i8* %33
%34 = add nuw nsw i64 %6, 2
%35 = icmp eq i64 %34, 256
br i1 %35, label %36, label %5
36: ; preds = %5
ret i8* getelementptr inbounds ([256 x i8], [256 x i8]* @get_byte_map.map, i64 0, i64 0)
}