#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 */
struct f_struct {
  int dummy;
};

/* Variables and functions */
int FLOCAL_ALIGN(unsigned char const *, unsigned char const *, int, int, int,
                 int, int **, int, int, int, struct f_struct *);
int dmatch(const unsigned char *aa0, int n0, const unsigned char *aa1, int n1,
           int hoff, int window, int **pam2, int gdelval, int ggapval,
           struct f_struct *f_str) {
  int low, up;
  window = (((n1) < (window)) ? (n1) : (window));
  low = -window / 2 - hoff;
  up = low + window;
  return FLOCAL_ALIGN(aa0 - 1, aa1 - 1, n0, n1, low, up, pam2, -gdelval,
                      -ggapval, window, f_str);
}


x86 assembly (clang, -O0):
<dmatch>:
push   %rbp
mov    %rsp,%rbp
push   %r14
push   %rbx
sub    $0x60,%rsp
mov    0x28(%rbp),%rax
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%rax
mov    %rdi,-0x18(%rbp)
mov    %esi,-0x1c(%rbp)
mov    %rdx,-0x28(%rbp)
mov    %ecx,-0x2c(%rbp)
mov    %r8d,-0x30(%rbp)
mov    %r9d,-0x34(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x34(%rbp),%eax
jge    1156 <dmatch+0x46>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x40(%rbp)
jmp    115c <dmatch+0x4c>
mov    -0x34(%rbp),%eax
mov    %eax,-0x40(%rbp)
mov    -0x40(%rbp),%eax
mov    %eax,-0x34(%rbp)
xor    %eax,%eax
sub    -0x34(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
sub    -0x30(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    -0x38(%rbp),%eax
add    -0x34(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x18(%rbp),%rdi
add    $0xffffffffffffffff,%rdi
mov    -0x28(%rbp),%rsi
add    $0xffffffffffffffff,%rsi
mov    -0x1c(%rbp),%edx
mov    -0x2c(%rbp),%ecx
mov    -0x38(%rbp),%r8d
mov    -0x3c(%rbp),%r9d
mov    0x10(%rbp),%r14
xor    %ebx,%ebx
sub    0x18(%rbp),%ebx
xor    %r11d,%r11d
sub    0x20(%rbp),%r11d
mov    -0x34(%rbp),%r10d
mov    0x28(%rbp),%rax
mov    %r14,(%rsp)
mov    %ebx,0x8(%rsp)
mov    %r11d,0x10(%rsp)
mov    %r10d,0x18(%rsp)
mov    %rax,0x20(%rsp)
call   1030 <FLOCAL_ALIGN@plt>
add    $0x60,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

x86 assembly (clang, -O2):
<dmatch>:
push   %r14
push   %rbx
push   %rax
mov    %r9d,%r10d
mov    %esi,%r11d
cmp    %r9d,%ecx
cmovl  %ecx,%r10d
mov    %r10d,%eax
shr    $0x1f,%eax
add    %r10d,%eax
sar    %eax
add    %r8d,%eax
mov    %r10d,%r9d
sub    %eax,%r9d
neg    %eax
add    $0xffffffffffffffff,%rdi
lea    -0x1(%rdx),%rsi
xor    %ebx,%ebx
xor    %r14d,%r14d
sub    0x28(%rsp),%r14d
sub    0x30(%rsp),%ebx
sub    $0x8,%rsp
mov    %r11d,%edx
mov    %eax,%r8d
push   0x40(%rsp)
push   %r10
push   %rbx
push   %r14
push   0x48(%rsp)
call   1030 <FLOCAL_ALIGN@plt>
add    $0x38,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.f_struct = type { i32 }
define i32 @dmatch(i8* %0, i32 %1, i8* %2, i32 %3, i32 %4, i32 %5, i32** %6, i32 %7, i32 %8, %struct.f_struct* %9) {
%11 = alloca i8*
%12 = alloca i32
%13 = alloca i8*
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32**
%18 = alloca i32
%19 = alloca i32
%20 = alloca %struct.f_struct*
%21 = alloca i32
%22 = alloca i32
store i8* %0, i8** %11
store i32 %1, i32* %12
store i8* %2, i8** %13
store i32 %3, i32* %14
store i32 %4, i32* %15
store i32 %5, i32* %16
store i32** %6, i32*** %17
store i32 %7, i32* %18
store i32 %8, i32* %19
store %struct.f_struct* %9, %struct.f_struct** %20
%23 = load i32, i32* %14
%24 = load i32, i32* %16
%25 = icmp slt i32 %23, %24
br i1 %25, label %26, label %28
26: ; preds = %10
%27 = load i32, i32* %14
br label %30
28: ; preds = %10
%29 = load i32, i32* %16
br label %30
30: ; preds = %28, %26
%31 = phi i32 [ %27, %26 ], [ %29, %28 ]
store i32 %31, i32* %16
%32 = load i32, i32* %16
%33 = sub nsw i32 0, %32
%34 = sdiv i32 %33, 2
%35 = load i32, i32* %15
%36 = sub nsw i32 %34, %35
store i32 %36, i32* %21
%37 = load i32, i32* %21
%38 = load i32, i32* %16
%39 = add nsw i32 %37, %38
store i32 %39, i32* %22
%40 = load i8*, i8** %11
%41 = getelementptr inbounds i8, i8* %40, i64 -1
%42 = load i8*, i8** %13
%43 = getelementptr inbounds i8, i8* %42, i64 -1
%44 = load i32, i32* %12
%45 = load i32, i32* %14
%46 = load i32, i32* %21
%47 = load i32, i32* %22
%48 = load i32**, i32*** %17
%49 = load i32, i32* %18
%50 = sub nsw i32 0, %49
%51 = load i32, i32* %19
%52 = sub nsw i32 0, %51
%53 = load i32, i32* %16
%54 = load %struct.f_struct*, %struct.f_struct** %20
%55 = call i32 @FLOCAL_ALIGN(i8* %41, i8* %43, i32 %44, i32 %45, i32 %46, i32 %47, i32** %48, i32 %50, i32 %52, i32 %53, %struct.f_struct* %54)
ret i32 %55
}

LLVM IR (-O2):
%struct.f_struct = type { i32 }
define i32 @dmatch(i8* %0, i32 %1, i8* %2, i32 %3, i32 %4, i32 %5, i32** %6, i32 %7, i32 %8, %struct.f_struct* %9) {
%11 = icmp slt i32 %3, %5
%12 = select i1 %11, i32 %3, i32 %5
%13 = sdiv i32 %12, -2
%14 = sub nsw i32 %13, %4
%15 = add nsw i32 %14, %12
%16 = getelementptr inbounds i8, i8* %0, i64 -1
%17 = getelementptr inbounds i8, i8* %2, i64 -1
%18 = sub nsw i32 0, %7
%19 = sub nsw i32 0, %8
%20 = tail call i32 @FLOCAL_ALIGN(i8* %16, i8* %17, i32 %1, i32 %3, i32 %14, i32 %15, i32** %6, i32 %18, i32 %19, i32 %12, %struct.f_struct* %9)
ret i32 %20
}