#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 abs(int);
int /*<<< orphan*/ frect(int, int, int, int);
int /*<<< orphan*/ scale_to_screen(float, float, int *, int *);
void frect_abs(double x1, double y1, double w, double h) {
  int i1, i2, j1, j2;
  int ih, iw;
  float x2 = x1 + w;
  float y2 = y1 + h;
  scale_to_screen(x1, y1, &i1, &j1);
  scale_to_screen(x2, y2, &i2, &j2);
  iw = abs(i2 - i1);
  ih = abs(j2 - j1);
  frect(i1, j1, iw + 1, ih + 1);
}


x86 assembly (clang, -O0):
<frect_abs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
addsd  -0x18(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x3c(%rbp)
movsd  -0x10(%rbp),%xmm0
addsd  -0x20(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x40(%rbp)
movsd  -0x8(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
movsd  -0x10(%rbp),%xmm1
cvtsd2ss %xmm1,%xmm1
lea    -0x24(%rbp),%rdi
lea    -0x2c(%rbp),%rsi
call   1040 <scale_to_screen@plt>
movss  -0x3c(%rbp),%xmm0
movss  -0x40(%rbp),%xmm1
lea    -0x28(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1040 <scale_to_screen@plt>
mov    -0x28(%rbp),%edi
sub    -0x24(%rbp),%edi
call   1030 <abs@plt>
mov    %eax,-0x38(%rbp)
mov    -0x30(%rbp),%edi
sub    -0x2c(%rbp),%edi
call   1030 <abs@plt>
mov    %eax,-0x34(%rbp)
mov    -0x24(%rbp),%edi
mov    -0x2c(%rbp),%esi
mov    -0x38(%rbp),%edx
add    $0x1,%edx
mov    -0x34(%rbp),%ecx
add    $0x1,%ecx
call   1050 <frect@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<frect_abs>:
sub    $0x18,%rsp
addsd  %xmm0,%xmm2
cvtsd2ss %xmm2,%xmm2
movss  %xmm2,0x4(%rsp)
addsd  %xmm1,%xmm3
xorps  %xmm2,%xmm2
cvtsd2ss %xmm3,%xmm2
movss  %xmm2,(%rsp)
cvtsd2ss %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm1
lea    0x14(%rsp),%rdi
lea    0xc(%rsp),%rsi
call   1030 <scale_to_screen@plt>
lea    0x10(%rsp),%rdi
lea    0x8(%rsp),%rsi
movss  0x4(%rsp),%xmm0
movss  (%rsp),%xmm1
call   1030 <scale_to_screen@plt>
mov    0x10(%rsp),%eax
mov    0x14(%rsp),%edi
sub    %edi,%eax
mov    %eax,%edx
neg    %edx
cmovs  %eax,%edx
mov    0x8(%rsp),%eax
mov    0xc(%rsp),%esi
sub    %esi,%eax
mov    %eax,%ecx
neg    %ecx
cmovs  %eax,%ecx
add    $0x1,%edx
add    $0x1,%ecx
call   1040 <frect@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
define void @frect_abs(double %0, double %1, double %2, double %3) {
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca float
%16 = alloca float
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
store double %3, double* %8
%17 = load double, double* %5
%18 = load double, double* %7
%19 = fadd double %17, %18
%20 = fptrunc double %19 to float
store float %20, float* %15
%21 = load double, double* %6
%22 = load double, double* %8
%23 = fadd double %21, %22
%24 = fptrunc double %23 to float
store float %24, float* %16
%25 = load double, double* %5
%26 = fptrunc double %25 to float
%27 = load double, double* %6
%28 = fptrunc double %27 to float
%29 = call i32 @scale_to_screen(float %26, float %28, i32* %9, i32* %11)
%30 = load float, float* %15
%31 = load float, float* %16
%32 = call i32 @scale_to_screen(float %30, float %31, i32* %10, i32* %12)
%33 = load i32, i32* %10
%34 = load i32, i32* %9
%35 = sub nsw i32 %33, %34
%36 = call i32 @abs(i32 %35)
store i32 %36, i32* %14
%37 = load i32, i32* %12
%38 = load i32, i32* %11
%39 = sub nsw i32 %37, %38
%40 = call i32 @abs(i32 %39)
store i32 %40, i32* %13
%41 = load i32, i32* %9
%42 = load i32, i32* %11
%43 = load i32, i32* %14
%44 = add nsw i32 %43, 1
%45 = load i32, i32* %13
%46 = add nsw i32 %45, 1
%47 = call i32 @frect(i32 %41, i32 %42, i32 %44, i32 %46)
ret void
}

LLVM IR (-O2):
define void @frect_abs(double %0, double %1, double %2, double %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = bitcast i32* %5 to i8*
%10 = bitcast i32* %6 to i8*
%11 = bitcast i32* %7 to i8*
%12 = bitcast i32* %8 to i8*
%13 = fadd double %0, %2
%14 = fptrunc double %13 to float
%15 = fadd double %1, %3
%16 = fptrunc double %15 to float
%17 = fptrunc double %0 to float
%18 = fptrunc double %1 to float
%19 = call i32 @scale_to_screen(float %17, float %18, i32* %5, i32* %7)
%20 = call i32 @scale_to_screen(float %14, float %16, i32* %6, i32* %8)
%21 = load i32, i32* %6
%22 = load i32, i32* %5
%23 = sub nsw i32 %21, %22
%24 = call i32 @llvm.abs.i32(i32 %23, i1 true)
%25 = load i32, i32* %8
%26 = load i32, i32* %7
%27 = sub nsw i32 %25, %26
%28 = call i32 @llvm.abs.i32(i32 %27, i1 true)
%29 = add nuw nsw i32 %24, 1
%30 = add nuw nsw i32 %28, 1
%31 = call i32 @frect(i32 %22, i32 %26, i32 %29, i32 %30)
ret void
}