#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 laglist_sep_pos(int const *);
void get_lstart_lmax(const int *llist, int gotsep, int *lstart, int *lmax) {
  int spos = laglist_sep_pos(llist);
  if (spos == 0) {
    *lstart = 1;
    *lmax = llist[0];
  } else if (!gotsep) {
    if (spos == 1) {
      *lstart = 2;
      *lmax = 0;
    } else {
      *lstart = 1;
      *lmax = spos - 1;
    }
  } else {
    *lstart = spos + 1;
    *lmax = llist[0];
  }
}


x86 assembly (clang, -O0):
<get_lstart_lmax>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <laglist_sep_pos@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jne    1158 <get_lstart_lmax+0x48>
mov    -0x18(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
jmp    11bd <get_lstart_lmax+0xad>
cmpl   $0x0,-0xc(%rbp)
jne    11a0 <get_lstart_lmax+0x90>
cmpl   $0x1,-0x24(%rbp)
jne    1185 <get_lstart_lmax+0x75>
mov    -0x18(%rbp),%rax
movl   $0x2,(%rax)
mov    -0x20(%rbp),%rax
movl   $0x0,(%rax)
jmp    119b <get_lstart_lmax+0x8b>
mov    -0x18(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x24(%rbp),%ecx
sub    $0x1,%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
jmp    11b8 <get_lstart_lmax+0xa8>
mov    -0x24(%rbp),%ecx
add    $0x1,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
jmp    11bd <get_lstart_lmax+0xad>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_lstart_lmax>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %rdx,%r15
mov    %esi,%ebp
mov    %rdi,%rbx
call   1030 <laglist_sep_pos@plt>
test   %eax,%eax
je     1137 <get_lstart_lmax+0x27>
test   %ebp,%ebp
je     114e <get_lstart_lmax+0x3e>
add    $0x1,%eax
mov    %eax,(%r15)
jmp    113e <get_lstart_lmax+0x2e>
movl   $0x1,(%r15)
mov    (%rbx),%eax
mov    %eax,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
cmp    $0x1,%eax
jne    115e <get_lstart_lmax+0x4e>
movl   $0x2,(%r15)
xor    %eax,%eax
jmp    1140 <get_lstart_lmax+0x30>
movl   $0x1,(%r15)
add    $0xffffffff,%eax
jmp    1140 <get_lstart_lmax+0x30>

LLVM IR (-O0):
define void @get_lstart_lmax(i32* %0, i32 %1, i32* %2, i32* %3) {
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32
store i32* %0, i32** %5
store i32 %1, i32* %6
store i32* %2, i32** %7
store i32* %3, i32** %8
%10 = load i32*, i32** %5
%11 = call i32 @laglist_sep_pos(i32* %10)
store i32 %11, i32* %9
%12 = load i32, i32* %9
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %20
14: ; preds = %4
%15 = load i32*, i32** %7
store i32 1, i32* %15
%16 = load i32*, i32** %5
%17 = getelementptr inbounds i32, i32* %16, i64 0
%18 = load i32, i32* %17
%19 = load i32*, i32** %8
store i32 %18, i32* %19
br label %44
20: ; preds = %4
%21 = load i32, i32* %6
%22 = icmp ne i32 %21, 0
br i1 %22, label %35, label %23
23: ; preds = %20
%24 = load i32, i32* %9
%25 = icmp eq i32 %24, 1
br i1 %25, label %26, label %29
26: ; preds = %23
%27 = load i32*, i32** %7
store i32 2, i32* %27
%28 = load i32*, i32** %8
store i32 0, i32* %28
br label %34
29: ; preds = %23
%30 = load i32*, i32** %7
store i32 1, i32* %30
%31 = load i32, i32* %9
%32 = sub nsw i32 %31, 1
%33 = load i32*, i32** %8
store i32 %32, i32* %33
br label %34
34: ; preds = %29, %26
br label %43
35: ; preds = %20
%36 = load i32, i32* %9
%37 = add nsw i32 %36, 1
%38 = load i32*, i32** %7
store i32 %37, i32* %38
%39 = load i32*, i32** %5
%40 = getelementptr inbounds i32, i32* %39, i64 0
%41 = load i32, i32* %40
%42 = load i32*, i32** %8
store i32 %41, i32* %42
br label %43
43: ; preds = %35, %34
br label %44
44: ; preds = %43, %14
ret void
}

LLVM IR (-O2):
define void @get_lstart_lmax(i32* %0, i32 %1, i32* nocapture writeonly %2, i32* nocapture writeonly %3) {
%5 = tail call i32 @laglist_sep_pos(i32* %0)
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %4
store i32 1, i32* %2
%8 = load i32, i32* %0
br label %19
9: ; preds = %4
%10 = icmp eq i32 %1, 0
br i1 %10, label %11, label %16
11: ; preds = %9
%12 = icmp eq i32 %5, 1
br i1 %12, label %13, label %14
13: ; preds = %11
store i32 2, i32* %2
br label %19
14: ; preds = %11
store i32 1, i32* %2
%15 = add nsw i32 %5, -1
br label %19
16: ; preds = %9
%17 = add nsw i32 %5, 1
store i32 %17, i32* %2
%18 = load i32, i32* %0
br label %19
19: ; preds = %16, %14, %13, %7
%20 = phi i32 [ %18, %16 ], [ %15, %14 ], [ 0, %13 ], [ %8, %7 ]
store i32 %20, i32* %3
ret void
}