#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 /*<<< orphan*/ Rprintf(char *, int);
int /*<<< orphan*/ downtoleave(int, int, double *, int *, int *, int);
int /*<<< orphan*/ swap(int, int, double *, int *, int *, int);
void wentouttwo(int k, double *window, int *outlist, int *nrlist,
                int print_level) {
  if (print_level >= 2)
    Rprintf("\nwentOUT_2(%d)\n  ", k);
  swap(k, k - 1, window, outlist, nrlist, print_level);
  downtoleave(-1, k, window, outlist, nrlist, print_level);
}


x86 assembly (clang, -O0):
<wentouttwo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
cmpl   $0x2,-0x24(%rbp)
jl     1164 <wentouttwo+0x34>
mov    -0x4(%rbp),%esi
lea    0xea1(%rip),%rdi
call   1030 <Rprintf@plt>
mov    -0x4(%rbp),%edi
mov    -0x4(%rbp),%esi
sub    $0x1,%esi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%r8
mov    -0x24(%rbp),%r9d
call   1050 <swap@plt>
mov    -0x4(%rbp),%esi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%r8
mov    -0x24(%rbp),%r9d
mov    $0xffffffff,%edi
call   1040 <downtoleave@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wentouttwo>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %r8d,%ebp
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%r12
mov    %edi,%ebx
cmp    $0x2,%r8d
jl     115a <wentouttwo+0x2a>
lea    0xead(%rip),%rdi
mov    %ebx,%esi
call   1030 <Rprintf@plt>
lea    -0x1(%rbx),%esi
mov    %ebx,%edi
mov    %r12,%rdx
mov    %r15,%rcx
mov    %r14,%r8
mov    %ebp,%r9d
call   1050 <swap@plt>
mov    $0xffffffff,%edi
mov    %ebx,%esi
mov    %r12,%rdx
mov    %r15,%rcx
mov    %r14,%r8
mov    %ebp,%r9d
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <downtoleave@plt>

LLVM IR (-O0):
@.str = [18 x i8] c"\0AwentOUT_2(%d)\0A \00"
define void @wentouttwo(i32 %0, double* %1, i32* %2, i32* %3, i32 %4) {
%6 = alloca i32
%7 = alloca double*
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca i32
store i32 %0, i32* %6
store double* %1, double** %7
store i32* %2, i32** %8
store i32* %3, i32** %9
store i32 %4, i32* %10
%11 = load i32, i32* %10
%12 = icmp sge i32 %11, 2
br i1 %12, label %13, label %16
13: ; preds = %5
%14 = load i32, i32* %6
%15 = call i32 @Rprintf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %14)
br label %16
16: ; preds = %13, %5
%17 = load i32, i32* %6
%18 = load i32, i32* %6
%19 = sub nsw i32 %18, 1
%20 = load double*, double** %7
%21 = load i32*, i32** %8
%22 = load i32*, i32** %9
%23 = load i32, i32* %10
%24 = call i32 @swap(i32 %17, i32 %19, double* %20, i32* %21, i32* %22, i32 %23)
%25 = load i32, i32* %6
%26 = load double*, double** %7
%27 = load i32*, i32** %8
%28 = load i32*, i32** %9
%29 = load i32, i32* %10
%30 = call i32 @downtoleave(i32 -1, i32 %25, double* %26, i32* %27, i32* %28, i32 %29)
ret void
}

LLVM IR (-O2):
@.str = [18 x i8] c"\0AwentOUT_2(%d)\0A \00"
define void @wentouttwo(i32 %0, double* %1, i32* %2, i32* %3, i32 %4) {
%6 = icmp sgt i32 %4, 1
br i1 %6, label %7, label %9
7: ; preds = %5
%8 = tail call i32 @Rprintf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %0)
br label %9
9: ; preds = %7, %5
%10 = add nsw i32 %0, -1
%11 = tail call i32 @swap(i32 %0, i32 %10, double* %1, i32* %2, i32* %3, i32 %4)
%12 = tail call i32 @downtoleave(i32 -1, i32 %0, double* %1, i32* %2, i32* %3, i32 %4)
ret void
}