#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*/ printf(char *, int, int);
void reverse_PRINT_STATIONS(int *l1, int *l2, int way, int n) {
  int new_way;
  if (way == 1)
    new_way = l1[n - 2];
  else
    new_way = l2[n - 2];
  if (n >= 2)
    reverse_PRINT_STATIONS(l1, l2, new_way, n - 1);
  printf("line%d,station%d\n", way, n);
}


x86 assembly (clang, -O0):
<reverse_PRINT_STATIONS>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
cmpl   $0x1,-0x14(%rbp)
jne    1158 <reverse_PRINT_STATIONS+0x38>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%ecx
sub    $0x2,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x1c(%rbp)
jmp    116b <reverse_PRINT_STATIONS+0x4b>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%ecx
sub    $0x2,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x2,-0x18(%rbp)
jl     118b <reverse_PRINT_STATIONS+0x6b>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x1c(%rbp),%edx
mov    -0x18(%rbp),%ecx
sub    $0x1,%ecx
call   1030 <reverse_PRINT_STATIONS@plt>
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
lea    0xe68(%rip),%rdi
call   1040 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reverse_PRINT_STATIONS>:
push   %rbp
push   %rbx
push   %rax
mov    %ecx,%ebx
mov    %edx,%ebp
cmp    $0x2,%ecx
jl     1144 <reverse_PRINT_STATIONS+0x24>
lea    -0x2(%rbx),%eax
cmp    $0x1,%ebp
mov    %rsi,%rcx
cmove  %rdi,%rcx
mov    (%rcx,%rax,4),%edx
lea    -0x1(%rbx),%ecx
call   1030 <reverse_PRINT_STATIONS@plt>
lea    0xeb5(%rip),%rdi
mov    %ebp,%esi
mov    %ebx,%edx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [18 x i8] c"line%d,station%d\0A\00"
define void @reverse_PRINT_STATIONS(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* %7
%11 = icmp eq i32 %10, 1
br i1 %11, label %12, label %19
12: ; preds = %4
%13 = load i32*, i32** %5
%14 = load i32, i32* %8
%15 = sub nsw i32 %14, 2
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i32, i32* %13, i64 %16
%18 = load i32, i32* %17
store i32 %18, i32* %9
br label %26
19: ; preds = %4
%20 = load i32*, i32** %6
%21 = load i32, i32* %8
%22 = sub nsw i32 %21, 2
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i32, i32* %20, i64 %23
%25 = load i32, i32* %24
store i32 %25, i32* %9
br label %26
26: ; preds = %19, %12
%27 = load i32, i32* %8
%28 = icmp sge i32 %27, 2
br i1 %28, label %29, label %35
29: ; preds = %26
%30 = load i32*, i32** %5
%31 = load i32*, i32** %6
%32 = load i32, i32* %9
%33 = load i32, i32* %8
%34 = sub nsw i32 %33, 1
br label %35
35: ; preds = %29, %26
%36 = load i32, i32* %7
%37 = load i32, i32* %8
%38 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %36, i32 %37)
ret void
}

LLVM IR (-O2):
@.str = [18 x i8] c"line%d,station%d\0A\00"
define void @reverse_PRINT_STATIONS(i32* nocapture %0, i32* nocapture %1, i32 %2, i32 %3) {
%5 = icmp sgt i32 %3, 1
br i1 %5, label %6, label %14
6: ; preds = %4
%7 = icmp eq i32 %2, 1
%8 = add nsw i32 %3, -2
%9 = zext i32 %8 to i64
%10 = select i1 %7, i32* %0, i32* %1
%11 = getelementptr inbounds i32, i32* %10, i64 %9
%12 = load i32, i32* %11
%13 = add nsw i32 %3, -1
tail call void @reverse_PRINT_STATIONS(i32* %0, i32* %1, i32 %12, i32 %13)
br label %14
14: ; preds = %6, %4
%15 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %2, i32 %3)
ret void
}