#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 */
double *LineSegmentDetection(int *, double *, int, int, double, double, double,
                             double, double, double, double, int, double, int,
                             int, int **, int *, int *, double, double);
double *lsd_scale_region(int *n_out, double *img, int X, int Y, double scale,
                         int **reg_img, int *reg_x, int *reg_y) {
  double sigma_scale = 0.6;
  double quant = 2.0;
  double ang_th = 22.5;
  double log_eps = 0.0;
  double density_th = 0.7;
  int n_bins = 1024;
  int need_to_union = 0;
  double union_ang_th = 7;
  int union_use_NFA = 0;
  double union_log_eps = 0.0;
  double length_threshold = 5;
  double dist_threshold = 5;
  return LineSegmentDetection(
      n_out, img, X, Y, scale, sigma_scale, quant, ang_th, log_eps, density_th,
      union_ang_th, union_use_NFA, union_log_eps, n_bins, need_to_union,
      reg_img, reg_x, reg_y, length_threshold, dist_threshold);
}


x86 assembly (clang, -O0):
<lsd_scale_region>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
sub    $0xb8,%rsp
mov    0x10(%rbp),%rax
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %ecx,-0x20(%rbp)
movsd  %xmm0,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    %r9,-0x38(%rbp)
movsd  0xee5(%rip),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xed0(%rip),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  0xebb(%rip),%xmm0
movsd  %xmm0,-0x50(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  0xe9e(%rip),%xmm0
movsd  %xmm0,-0x60(%rbp)
movl   $0x400,-0x64(%rbp)
movl   $0x0,-0x68(%rbp)
movsd  0xe7b(%rip),%xmm0
movsd  %xmm0,-0x70(%rbp)
movl   $0x0,-0x74(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  0xe57(%rip),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  0xe47(%rip),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
mov    -0x20(%rbp),%ecx
movsd  -0x28(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm1
movsd  -0x48(%rbp),%xmm2
movsd  -0x50(%rbp),%xmm3
movsd  -0x58(%rbp),%xmm4
movsd  -0x60(%rbp),%xmm5
movsd  -0x70(%rbp),%xmm6
mov    -0x74(%rbp),%r8d
movsd  -0x80(%rbp),%xmm7
mov    -0x64(%rbp),%r9d
mov    -0x68(%rbp),%ebx
mov    -0x30(%rbp),%r11
mov    -0x38(%rbp),%r10
mov    0x10(%rbp),%rax
movsd  -0x88(%rbp),%xmm9
ff ff
movsd  -0x90(%rbp),%xmm8
ff ff
mov    %ebx,(%rsp)
mov    %r11,0x8(%rsp)
mov    %r10,0x10(%rsp)
mov    %rax,0x18(%rsp)
movsd  %xmm9,0x20(%rsp)
movsd  %xmm8,0x28(%rsp)
call   1030 <LineSegmentDetection@plt>
add    $0xb8,%rsp
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<lsd_scale_region>:
push   %rax
mov    %r9,%r10
mov    %r8,%rax
movabs $0x4014000000000000,%r11
movsd  0xed7(%rip),%xmm1
movsd  0xed7(%rip),%xmm2
movsd  0xed7(%rip),%xmm3
movsd  0xed7(%rip),%xmm5
movsd  0xed7(%rip),%xmm6
xorps  %xmm4,%xmm4
xorps  %xmm7,%xmm7
mov    $0x0,%r8d
mov    $0x400,%r9d
push   %r11
push   %r11
push   0x20(%rsp)
push   %r10
push   %rax
push   $0x0
call   1030 <LineSegmentDetection@plt>
add    $0x30,%rsp
pop    %rcx
ret

LLVM IR (-O0):
define double* @lsd_scale_region(i32* %0, double* %1, i32 %2, i32 %3, double %4, i32** %5, i32* %6, i32* %7) {
%9 = alloca i32*
%10 = alloca double*
%11 = alloca i32
%12 = alloca i32
%13 = alloca double
%14 = alloca i32**
%15 = alloca i32*
%16 = alloca i32*
%17 = alloca double
%18 = alloca double
%19 = alloca double
%20 = alloca double
%21 = alloca double
%22 = alloca i32
%23 = alloca i32
%24 = alloca double
%25 = alloca i32
%26 = alloca double
%27 = alloca double
%28 = alloca double
store i32* %0, i32** %9
store double* %1, double** %10
store i32 %2, i32* %11
store i32 %3, i32* %12
store double %4, double* %13
store i32** %5, i32*** %14
store i32* %6, i32** %15
store i32* %7, i32** %16
store double 6.000000e-01, double* %17
store double 2.000000e+00, double* %18
store double 2.250000e+01, double* %19
store double 0.000000e+00, double* %20
store double 0x3FE6666666666666, double* %21
store i32 1024, i32* %22
store i32 0, i32* %23
store double 7.000000e+00, double* %24
store i32 0, i32* %25
store double 0.000000e+00, double* %26
store double 5.000000e+00, double* %27
store double 5.000000e+00, double* %28
%29 = load i32*, i32** %9
%30 = load double*, double** %10
%31 = load i32, i32* %11
%32 = load i32, i32* %12
%33 = load double, double* %13
%34 = load double, double* %17
%35 = load double, double* %18
%36 = load double, double* %19
%37 = load double, double* %20
%38 = load double, double* %21
%39 = load double, double* %24
%40 = load i32, i32* %25
%41 = load double, double* %26
%42 = load i32, i32* %22
%43 = load i32, i32* %23
%44 = load i32**, i32*** %14
%45 = load i32*, i32** %15
%46 = load i32*, i32** %16
%47 = load double, double* %27
%48 = load double, double* %28
%49 = call double* @LineSegmentDetection(i32* %29, double* %30, i32 %31, i32 %32, double %33, double %34, double %35, double %36, double %37, double %38, double %39, i32 %40, double %41, i32 %42, i32 %43, i32** %44, i32* %45, i32* %46, double %47, double %48)
ret double* %49
}

LLVM IR (-O2):
define double* @lsd_scale_region(i32* %0, double* %1, i32 %2, i32 %3, double %4, i32** %5, i32* %6, i32* %7) {
%9 = tail call double* @LineSegmentDetection(i32* %0, double* %1, i32 %2, i32 %3, double %4, double 6.000000e-01, double 2.000000e+00, double 2.250000e+01, double 0.000000e+00, double 0x3FE6666666666666, double 7.000000e+00, i32 0, double 0.000000e+00, i32 1024, i32 0, i32** %5, i32* %6, i32* %7, double 5.000000e+00, double 5.000000e+00)
ret double* %9
}