btl_proof_NEXT_SEQ_OBJ(cc, ss, oc, os) int *cc, *ss, oc, os;
{
  int c, i, b;
  c = oc - 1;
  if (c != 0) {
    i = os - 1;
    btl_proof_XST_SEQ_OBJ(&b, i);
    while (b != 1 && i != 0) {
      i = i - 1;
      btl_proof_XST_SEQ_OBJ(&b, i);
    }
    *ss = i;
    *cc = c;
  } else {
    *ss = 0;
    *cc = 0;
  }
}


x86 assembly (clang, -O0):
<btl_proof_NEXT_SEQ_OBJ>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %ecx,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
je     11ac <btl_proof_NEXT_SEQ_OBJ+0x9c>
mov    -0x20(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%esi
lea    -0x2c(%rbp),%rdi
mov    $0x0,%al
call   1030 <btl_proof_XST_SEQ_OBJ@plt>
xor    %eax,%eax
cmpl   $0x1,-0x2c(%rbp)
mov    %al,-0x2d(%rbp)
je     1169 <btl_proof_NEXT_SEQ_OBJ+0x59>
cmpl   $0x0,-0x28(%rbp)
setne  %al
mov    %al,-0x2d(%rbp)
mov    -0x2d(%rbp),%al
test   $0x1,%al
jne    1179 <btl_proof_NEXT_SEQ_OBJ+0x69>
jmp    1195 <btl_proof_NEXT_SEQ_OBJ+0x85>
mov    -0x28(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%esi
lea    -0x2c(%rbp),%rdi
mov    $0x0,%al
call   1030 <btl_proof_XST_SEQ_OBJ@plt>
jmp    1150 <btl_proof_NEXT_SEQ_OBJ+0x40>
mov    -0x28(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x24(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
jmp    11c0 <btl_proof_NEXT_SEQ_OBJ+0xb0>
mov    -0x18(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x10(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<btl_proof_NEXT_SEQ_OBJ>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edx,%r12d
mov    %rsi,%r15
mov    %rdi,%r14
add    $0xffffffff,%r12d
je     117d <btl_proof_NEXT_SEQ_OBJ+0x6d>
mov    %ecx,%r13d
lea    -0x1(%r13),%esi
lea    0x4(%rsp),%rdi
xor    %eax,%eax
call   1030 <btl_proof_XST_SEQ_OBJ@plt>
mov    %r13d,%ebp
add    $0xffffffff,%ebp
je     117f <btl_proof_NEXT_SEQ_OBJ+0x6f>
cmpl   $0x1,0x4(%rsp)
je     117f <btl_proof_NEXT_SEQ_OBJ+0x6f>
add    $0xfffffffe,%r13d
lea    0x4(%rsp),%rbx
mov    %r13d,%ebp
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1030 <btl_proof_XST_SEQ_OBJ@plt>
add    $0xffffffff,%ebp
jae    1178 <btl_proof_NEXT_SEQ_OBJ+0x68>
cmpl   $0x1,0x4(%rsp)
jne    1160 <btl_proof_NEXT_SEQ_OBJ+0x50>
add    $0x1,%ebp
jmp    117f <btl_proof_NEXT_SEQ_OBJ+0x6f>
xor    %ebp,%ebp
mov    %ebp,(%r15)
mov    %r12d,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @btl_proof_NEXT_SEQ_OBJ(i32* nocapture writeonly %0, i32* nocapture writeonly %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = bitcast i32* %5 to i8*
%7 = add nsw i32 %2, -1
%8 = icmp eq i32 %7, 0
br i1 %8, label %24, label %9
9: ; preds = %4
%10 = add nsw i32 %3, -1
%11 = call i32 (i32*, i32, ...) bitcast (i32 (...)* @btl_proof_XST_SEQ_OBJ to i32 (i32*, i32, ...)*)(i32* %5, i32 %10)
%12 = load i32, i32* %5
%13 = icmp ne i32 %12, 1
%14 = icmp ne i32 %10, 0
%15 = and i1 %14, %13
br i1 %15, label %16, label %24
16: ; preds = %9, %16
%17 = phi i32 [ %18, %16 ], [ %10, %9 ]
%18 = add nsw i32 %17, -1
%19 = call i32 (i32*, i32, ...) bitcast (i32 (...)* @btl_proof_XST_SEQ_OBJ to i32 (i32*, i32, ...)*)(i32* %5, i32 %18)
%20 = load i32, i32* %5
%21 = icmp ne i32 %20, 1
%22 = icmp ne i32 %18, 0
%23 = and i1 %22, %21
br i1 %23, label %16, label %24
24: ; preds = %16, %9, %4
%25 = phi i32 [ 0, %4 ], [ %10, %9 ], [ %18, %16 ]
store i32 %25, i32* %1
store i32 %7, i32* %0
ret i32 undef
}