#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 v {
  int dummy;
};
struct file {
  int dummy;
};
struct cslb {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ csl_add(struct cslb *, int, int, int);
int /*<<< orphan*/ find_common(struct file *, struct file *, int *, int *,
                               int *, int *, struct v *, int);
void lcsl(struct file *a, int alo, int ahi, struct file *b, int blo, int bhi,
          struct cslb *cslb, struct v *v, int shortcut) {
  int alo1 = alo;
  int ahi1 = ahi;
  int blo1 = blo;
  int bhi1 = bhi;
  if (ahi <= alo || bhi <= blo)
    return;
  if (!find_common(a, b, &alo1, &ahi1, &blo1, &bhi1, v, shortcut))
    return;
  lcsl(a, alo, alo1, b, blo, blo1, cslb, v, 0);
  if (ahi1 > alo1)
    csl_add(cslb, alo1, blo1, ahi1 - alo1);
  lcsl(a, ahi1, ahi, b, bhi1, bhi, cslb, v, shortcut);
}


x86 assembly (clang, -O0):
<lcsl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    %r9d,-0x20(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    1189 <lcsl+0x59>
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jg     118e <lcsl+0x5e>
jmp    1253 <lcsl+0x123>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    0x18(%rbp),%r10
mov    0x20(%rbp),%eax
lea    -0x24(%rbp),%rdx
lea    -0x28(%rbp),%rcx
lea    -0x2c(%rbp),%r8
lea    -0x30(%rbp),%r9
mov    %r10,(%rsp)
mov    %eax,0x8(%rsp)
call   1030 <find_common@plt>
cmp    $0x0,%eax
jne    11c8 <lcsl+0x98>
jmp    1253 <lcsl+0x123>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x24(%rbp),%edx
mov    -0x18(%rbp),%rcx
mov    -0x1c(%rbp),%r8d
mov    -0x2c(%rbp),%r9d
mov    0x10(%rbp),%r10
mov    0x18(%rbp),%rax
xor    %r11d,%r11d
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
movl   $0x0,0x10(%rsp)
call   1040 <lcsl@plt>
mov    -0x28(%rbp),%eax
cmp    -0x24(%rbp),%eax
jle    1220 <lcsl+0xf0>
mov    0x10(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    -0x2c(%rbp),%edx
mov    -0x28(%rbp),%ecx
sub    -0x24(%rbp),%ecx
call   1050 <csl_add@plt>
mov    -0x8(%rbp),%rdi
mov    -0x28(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x18(%rbp),%rcx
mov    -0x30(%rbp),%r8d
mov    -0x20(%rbp),%r9d
mov    0x10(%rbp),%r11
mov    0x18(%rbp),%r10
mov    0x20(%rbp),%eax
mov    %r11,(%rsp)
mov    %r10,0x8(%rsp)
mov    %eax,0x10(%rsp)
call   1040 <lcsl@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lcsl>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %esi,0x10(%rsp)
mov    %edx,0xc(%rsp)
mov    %r8d,0x8(%rsp)
mov    %r9d,0x14(%rsp)
cmp    %esi,%edx
jle    1217 <lcsl+0xe7>
mov    %r9d,%r13d
mov    %r8d,%ebx
cmp    %r8d,%r9d
jle    1217 <lcsl+0xe7>
mov    %rcx,%r14
mov    %edx,%ebp
mov    %esi,%r12d
mov    %rdi,%r15
mov    0x60(%rsp),%eax
lea    0x10(%rsp),%rdx
lea    0xc(%rsp),%rcx
lea    0x8(%rsp),%r8
lea    0x14(%rsp),%r9
mov    %r14,%rsi
push   %rax
push   0x60(%rsp)
call   1030 <find_common@plt>
add    $0x10,%rsp
test   %eax,%eax
je     1217 <lcsl+0xe7>
mov    0x50(%rsp),%rax
mov    0x10(%rsp),%edx
mov    0x8(%rsp),%r9d
sub    $0x8,%rsp
mov    %r15,%rdi
mov    %r12d,%esi
mov    %rax,%r12
mov    %r14,%rcx
mov    %ebx,%r8d
push   $0x0
mov    0x68(%rsp),%rbx
push   %rbx
push   %rax
call   1040 <lcsl@plt>
add    $0x20,%rsp
mov    0xc(%rsp),%esi
mov    0x10(%rsp),%eax
mov    %esi,%ecx
sub    %eax,%ecx
jle    11f2 <lcsl+0xc2>
mov    0x8(%rsp),%edx
mov    %r12,%rdi
mov    %eax,%esi
call   1050 <csl_add@plt>
mov    0xc(%rsp),%esi
mov    0x14(%rsp),%r8d
sub    $0x8,%rsp
mov    %r15,%rdi
mov    %ebp,%edx
mov    %r14,%rcx
mov    %r13d,%r9d
mov    0x68(%rsp),%eax
push   %rax
push   %rbx
push   %r12
call   1040 <lcsl@plt>
add    $0x20,%rsp
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.file = type { i32 }
%struct.cslb = type { i32 }
%struct.v = type { i32 }
define void @lcsl(%struct.file* %0, i32 %1, i32 %2, %struct.file* %3, i32 %4, i32 %5, %struct.cslb* %6, %struct.v* %7, i32 %8) {
%10 = alloca %struct.file*
%11 = alloca i32
%12 = alloca i32
%13 = alloca %struct.file*
%14 = alloca i32
%15 = alloca i32
%16 = alloca %struct.cslb*
%17 = alloca %struct.v*
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
store %struct.file* %0, %struct.file** %10
store i32 %1, i32* %11
store i32 %2, i32* %12
store %struct.file* %3, %struct.file** %13
store i32 %4, i32* %14
store i32 %5, i32* %15
store %struct.cslb* %6, %struct.cslb** %16
store %struct.v* %7, %struct.v** %17
store i32 %8, i32* %18
%23 = load i32, i32* %11
store i32 %23, i32* %19
%24 = load i32, i32* %12
store i32 %24, i32* %20
%25 = load i32, i32* %14
store i32 %25, i32* %21
%26 = load i32, i32* %15
store i32 %26, i32* %22
%27 = load i32, i32* %12
%28 = load i32, i32* %11
%29 = icmp sle i32 %27, %28
br i1 %29, label %34, label %30
30: ; preds = %9
%31 = load i32, i32* %15
%32 = load i32, i32* %14
%33 = icmp sle i32 %31, %32
br i1 %33, label %34, label %35
34: ; preds = %30, %9
br label %73
35: ; preds = %30
%36 = load %struct.file*, %struct.file** %10
%37 = load %struct.file*, %struct.file** %13
%38 = load %struct.v*, %struct.v** %17
%39 = load i32, i32* %18
%40 = call i32 @find_common(%struct.file* %36, %struct.file* %37, i32* %19, i32* %20, i32* %21, i32* %22, %struct.v* %38, i32 %39)
%41 = icmp ne i32 %40, 0
br i1 %41, label %43, label %42
42: ; preds = %35
br label %73
43: ; preds = %35
%44 = load %struct.file*, %struct.file** %10
%45 = load i32, i32* %11
%46 = load i32, i32* %19
%47 = load %struct.file*, %struct.file** %13
%48 = load i32, i32* %14
%49 = load i32, i32* %21
%50 = load %struct.cslb*, %struct.cslb** %16
%51 = load %struct.v*, %struct.v** %17
%52 = load i32, i32* %20
%53 = load i32, i32* %19
%54 = icmp sgt i32 %52, %53
br i1 %54, label %55, label %63
55: ; preds = %43
%56 = load %struct.cslb*, %struct.cslb** %16
%57 = load i32, i32* %19
%58 = load i32, i32* %21
%59 = load i32, i32* %20
%60 = load i32, i32* %19
%61 = sub nsw i32 %59, %60
%62 = call i32 @csl_add(%struct.cslb* %56, i32 %57, i32 %58, i32 %61)
br label %63
63: ; preds = %55, %43
%64 = load %struct.file*, %struct.file** %10
%65 = load i32, i32* %20
%66 = load i32, i32* %12
%67 = load %struct.file*, %struct.file** %13
%68 = load i32, i32* %22
%69 = load i32, i32* %15
%70 = load %struct.cslb*, %struct.cslb** %16
%71 = load %struct.v*, %struct.v** %17
%72 = load i32, i32* %18
br label %73
73: ; preds = %63, %42, %34
ret void
}

LLVM IR (-O2):
%struct.file = type { i32 }
%struct.cslb = type { i32 }
%struct.v = type { i32 }
define void @lcsl(%struct.file* %0, i32 %1, i32 %2, %struct.file* %3, i32 %4, i32 %5, %struct.cslb* %6, %struct.v* %7, i32 %8) {
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = bitcast i32* %10 to i8*
store i32 %1, i32* %10
%15 = bitcast i32* %11 to i8*
store i32 %2, i32* %11
%16 = bitcast i32* %12 to i8*
store i32 %4, i32* %12
%17 = bitcast i32* %13 to i8*
store i32 %5, i32* %13
%18 = icmp sgt i32 %2, %1
%19 = icmp sgt i32 %5, %4
%20 = and i1 %18, %19
br i1 %20, label %21, label %38
21: ; preds = %9
%22 = call i32 @find_common(%struct.file* %0, %struct.file* %3, i32* %10, i32* %11, i32* %12, i32* %13, %struct.v* %7, i32 %8)
%23 = icmp eq i32 %22, 0
br i1 %23, label %38, label %24
24: ; preds = %21
%25 = load i32, i32* %10
%26 = load i32, i32* %12
%27 = load i32, i32* %11
%28 = load i32, i32* %10
%29 = icmp sgt i32 %27, %28
br i1 %29, label %30, label %35
30: ; preds = %24
%31 = load i32, i32* %12
%32 = sub nsw i32 %27, %28
%33 = call i32 @csl_add(%struct.cslb* %6, i32 %28, i32 %31, i32 %32)
%34 = load i32, i32* %11
br label %35
35: ; preds = %30, %24
%36 = phi i32 [ %34, %30 ], [ %27, %24 ]
%37 = load i32, i32* %13
br label %38
38: ; preds = %21, %9, %35
ret void
}