#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*/ adc(int, int);
int /*<<< orphan*/ asl(int, int);
scalar_t__ bcc();
scalar_t__ bcs();
int /*<<< orphan*/ clc();
int /*<<< orphan*/ cmp(int /*<<< orphan*/, int);
int /*<<< orphan*/ lda(int, int);
int /*<<< orphan*/ ldx(int /*<<< orphan*/, int);
int /*<<< orphan*/ lsr(int, int);
int /*<<< orphan*/ pha();
int /*<<< orphan*/ pla();
int /*<<< orphan*/ sbc(int /*<<< orphan*/, int);
int /*<<< orphan*/ sec();
int /*<<< orphan*/ sta(int, int);
int /*<<< orphan*/ sty(int, int);
int /*<<< orphan*/ txa();
void jsr_y_to_addr() {
  lda(1, 0xf5);
  and(0, 0x7);
  asl(3, 1);
  asl(3, 1);
  clc();
  adc(0, 0x20);
  sta(1, 0xf7);
  sty(1, 0xf6);
  lda(1, 0xf5);
  cmp(0, 64);
  if (bcs())
    goto less_than_128;
  ldx(0, 0);
  goto ready_to_add;
less_than_128:
  cmp(0, 128);
  if (bcs())
    goto more_than_128;
  ldx(0, 0x28);
  sec();
  sbc(0, 64);
  goto ready_to_add;
more_than_128:
  ldx(0, 0x50);
  sec();
  sbc(0, 128);
ready_to_add:
  lsr(3, 1);
  lsr(3, 1);
  lsr(3, 1);
  lsr(3, 1);
  if (bcc())
    goto no_bottom_add;
  pha();
  clc();
  lda(1, 0xf6);
  adc(0, 0x80);
  sta(1, 0xf6);
  pla();
no_bottom_add:
  adc(1, 0xf7);
  sta(1, 0xf7);
  clc();
  txa();
  adc(1, 0xf6);
  sta(1, 0xf6);
}


x86 assembly (clang, -O0):
<jsr_y_to_addr>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
mov    $0xf5,%esi
call   1130 <lda@plt>
xor    %edi,%edi
mov    $0x7,%esi
mov    $0x0,%al
call   1060 <and@plt>
mov    $0x3,%edi
mov    $0x1,%esi
call   1110 <asl@plt>
mov    $0x3,%edi
mov    $0x1,%esi
call   1110 <asl@plt>
mov    $0x0,%al
call   1100 <clc@plt>
xor    %edi,%edi
mov    $0x20,%esi
call   10f0 <adc@plt>
mov    $0x1,%edi
mov    $0xf7,%esi
call   1040 <sta@plt>
mov    $0x1,%edi
mov    $0xf6,%esi
call   1050 <sty@plt>
mov    $0x1,%edi
mov    $0xf5,%esi
call   1130 <lda@plt>
xor    %edi,%edi
mov    $0x40,%esi
call   10a0 <cmp@plt>
mov    $0x0,%al
call   1090 <bcs@plt>
cmp    $0x0,%rax
je     12b1 <jsr_y_to_addr+0xa1>
jmp    12bf <jsr_y_to_addr+0xaf>
xor    %esi,%esi
mov    %esi,%edi
call   1080 <ldx@plt>
jmp    1324 <jsr_y_to_addr+0x114>
xor    %edi,%edi
mov    $0x80,%esi
call   10a0 <cmp@plt>
mov    $0x0,%al
call   1090 <bcs@plt>
cmp    $0x0,%rax
je     12e1 <jsr_y_to_addr+0xd1>
jmp    1305 <jsr_y_to_addr+0xf5>
xor    %edi,%edi
mov    $0x28,%esi
call   1080 <ldx@plt>
mov    $0x0,%al
call   10c0 <sec@plt>
xor    %edi,%edi
mov    $0x40,%esi
call   1070 <sbc@plt>
jmp    1324 <jsr_y_to_addr+0x114>
xor    %edi,%edi
mov    $0x50,%esi
call   1080 <ldx@plt>
mov    $0x0,%al
call   10c0 <sec@plt>
xor    %edi,%edi
mov    $0x80,%esi
call   1070 <sbc@plt>
mov    $0x3,%edi
mov    $0x1,%esi
call   1120 <lsr@plt>
mov    $0x3,%edi
mov    $0x1,%esi
call   1120 <lsr@plt>
mov    $0x3,%edi
mov    $0x1,%esi
call   1120 <lsr@plt>
mov    $0x3,%edi
mov    $0x1,%esi
call   1120 <lsr@plt>
mov    $0x0,%al
call   10b0 <bcc@plt>
cmp    $0x0,%rax
je     1376 <jsr_y_to_addr+0x166>
jmp    13b5 <jsr_y_to_addr+0x1a5>
mov    $0x0,%al
call   10d0 <pha@plt>
mov    $0x0,%al
call   1100 <clc@plt>
mov    $0x1,%edi
mov    $0xf6,%esi
call   1130 <lda@plt>
xor    %edi,%edi
mov    $0x80,%esi
call   10f0 <adc@plt>
mov    $0x1,%edi
mov    $0xf6,%esi
call   1040 <sta@plt>
mov    $0x0,%al
call   1030 <pla@plt>
mov    $0x1,%edi
mov    $0xf7,%esi
call   10f0 <adc@plt>
mov    $0x1,%edi
mov    $0xf7,%esi
call   1040 <sta@plt>
mov    $0x0,%al
call   1100 <clc@plt>
mov    $0x0,%al
call   10e0 <txa@plt>
mov    $0x1,%edi
mov    $0xf6,%esi
call   10f0 <adc@plt>
mov    $0x1,%edi
mov    $0xf6,%esi
call   1040 <sta@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<jsr_y_to_addr>:
push   %rax
mov    $0x1,%edi
mov    $0xf5,%esi
call   1130 <lda@plt>
xor    %edi,%edi
mov    $0x7,%esi
xor    %eax,%eax
call   1060 <and@plt>
mov    $0x3,%edi
mov    $0x1,%esi
call   1110 <asl@plt>
mov    $0x3,%edi
mov    $0x1,%esi
call   1110 <asl@plt>
xor    %eax,%eax
call   1100 <clc@plt>
xor    %edi,%edi
mov    $0x20,%esi
call   10f0 <adc@plt>
mov    $0x1,%edi
mov    $0xf7,%esi
call   1040 <sta@plt>
mov    $0x1,%edi
mov    $0xf6,%esi
call   1050 <sty@plt>
mov    $0x1,%edi
mov    $0xf5,%esi
call   1130 <lda@plt>
xor    %edi,%edi
mov    $0x40,%esi
call   10a0 <cmp@plt>
xor    %eax,%eax
call   1090 <bcs@plt>
xor    %edi,%edi
test   %rax,%rax
je     12d8 <jsr_y_to_addr+0xc8>
mov    $0x80,%esi
call   10a0 <cmp@plt>
xor    %eax,%eax
call   1090 <bcs@plt>
xor    %edi,%edi
test   %rax,%rax
je     12e1 <jsr_y_to_addr+0xd1>
mov    $0x50,%esi
call   1080 <ldx@plt>
xor    %eax,%eax
call   10c0 <sec@plt>
xor    %edi,%edi
mov    $0x80,%esi
jmp    12f9 <jsr_y_to_addr+0xe9>
xor    %esi,%esi
call   1080 <ldx@plt>
jmp    12fe <jsr_y_to_addr+0xee>
mov    $0x28,%esi
call   1080 <ldx@plt>
xor    %eax,%eax
call   10c0 <sec@plt>
xor    %edi,%edi
mov    $0x40,%esi
call   1070 <sbc@plt>
mov    $0x3,%edi
mov    $0x1,%esi
call   1120 <lsr@plt>
mov    $0x3,%edi
mov    $0x1,%esi
call   1120 <lsr@plt>
mov    $0x3,%edi
mov    $0x1,%esi
call   1120 <lsr@plt>
mov    $0x3,%edi
mov    $0x1,%esi
call   1120 <lsr@plt>
xor    %eax,%eax
call   10b0 <bcc@plt>
test   %rax,%rax
jne    1385 <jsr_y_to_addr+0x175>
xor    %eax,%eax
call   10d0 <pha@plt>
xor    %eax,%eax
call   1100 <clc@plt>
mov    $0x1,%edi
mov    $0xf6,%esi
call   1130 <lda@plt>
xor    %edi,%edi
mov    $0x80,%esi
call   10f0 <adc@plt>
mov    $0x1,%edi
mov    $0xf6,%esi
call   1040 <sta@plt>
xor    %eax,%eax
call   1030 <pla@plt>
mov    $0x1,%edi
mov    $0xf7,%esi
call   10f0 <adc@plt>
mov    $0x1,%edi
mov    $0xf7,%esi
call   1040 <sta@plt>
xor    %eax,%eax
call   1100 <clc@plt>
xor    %eax,%eax
call   10e0 <txa@plt>
mov    $0x1,%edi
mov    $0xf6,%esi
call   10f0 <adc@plt>
mov    $0x1,%edi
mov    $0xf6,%esi
pop    %rax
jmp    1040 <sta@plt>

LLVM IR (-O0):
define void @jsr_y_to_addr() {
%1 = call i32 @lda(i32 1, i32 245)
%2 = call i32 (i32, i32, ...) bitcast (i32 (...)* @and to i32 (i32, i32, ...)*)(i32 0, i32 7)
%3 = call i32 @asl(i32 3, i32 1)
%4 = call i32 @asl(i32 3, i32 1)
%5 = call i32 (...) @clc()
%6 = call i32 @adc(i32 0, i32 32)
%7 = call i32 @sta(i32 1, i32 247)
%8 = call i32 @sty(i32 1, i32 246)
%9 = call i32 @lda(i32 1, i32 245)
%10 = call i32 @cmp(i32 0, i32 64)
%11 = call i64 (...) @bcs()
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %0
br label %16
14: ; preds = %0
%15 = call i32 @ldx(i32 0, i32 0)
br label %29
16: ; preds = %13
%17 = call i32 @cmp(i32 0, i32 128)
%18 = call i64 (...) @bcs()
%19 = icmp ne i64 %18, 0
br i1 %19, label %20, label %21
20: ; preds = %16
br label %25
21: ; preds = %16
%22 = call i32 @ldx(i32 0, i32 40)
%23 = call i32 (...) @sec()
%24 = call i32 @sbc(i32 0, i32 64)
br label %29
25: ; preds = %20
%26 = call i32 @ldx(i32 0, i32 80)
%27 = call i32 (...) @sec()
%28 = call i32 @sbc(i32 0, i32 128)
br label %29
29: ; preds = %25, %21, %14
%30 = call i32 @lsr(i32 3, i32 1)
%31 = call i32 @lsr(i32 3, i32 1)
%32 = call i32 @lsr(i32 3, i32 1)
%33 = call i32 @lsr(i32 3, i32 1)
%34 = call i64 (...) @bcc()
%35 = icmp ne i64 %34, 0
br i1 %35, label %36, label %37
36: ; preds = %29
br label %44
37: ; preds = %29
%38 = call i32 (...) @pha()
%39 = call i32 (...) @clc()
%40 = call i32 @lda(i32 1, i32 246)
%41 = call i32 @adc(i32 0, i32 128)
%42 = call i32 @sta(i32 1, i32 246)
%43 = call i32 (...) @pla()
br label %44
44: ; preds = %37, %36
%45 = call i32 @adc(i32 1, i32 247)
%46 = call i32 @sta(i32 1, i32 247)
%47 = call i32 (...) @clc()
%48 = call i32 (...) @txa()
%49 = call i32 @adc(i32 1, i32 246)
%50 = call i32 @sta(i32 1, i32 246)
ret void
}

LLVM IR (-O2):
define void @jsr_y_to_addr() {
%1 = tail call i32 @lda(i32 1, i32 245)
%2 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @and to i32 (i32, i32, ...)*)(i32 0, i32 7)
%3 = tail call i32 @asl(i32 3, i32 1)
%4 = tail call i32 @asl(i32 3, i32 1)
%5 = tail call i32 (...) @clc()
%6 = tail call i32 @adc(i32 0, i32 32)
%7 = tail call i32 @sta(i32 1, i32 247)
%8 = tail call i32 @sty(i32 1, i32 246)
%9 = tail call i32 @lda(i32 1, i32 245)
%10 = tail call i32 @cmp(i32 0, i32 64)
%11 = tail call i64 (...) @bcs()
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %0
%14 = tail call i32 @ldx(i32 0, i32 0)
br label %27
15: ; preds = %0
%16 = tail call i32 @cmp(i32 0, i32 128)
%17 = tail call i64 (...) @bcs()
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %23
19: ; preds = %15
%20 = tail call i32 @ldx(i32 0, i32 40)
%21 = tail call i32 (...) @sec()
%22 = tail call i32 @sbc(i32 0, i32 64)
br label %27
23: ; preds = %15
%24 = tail call i32 @ldx(i32 0, i32 80)
%25 = tail call i32 (...) @sec()
%26 = tail call i32 @sbc(i32 0, i32 128)
br label %27
27: ; preds = %23, %19, %13
%28 = tail call i32 @lsr(i32 3, i32 1)
%29 = tail call i32 @lsr(i32 3, i32 1)
%30 = tail call i32 @lsr(i32 3, i32 1)
%31 = tail call i32 @lsr(i32 3, i32 1)
%32 = tail call i64 (...) @bcc()
%33 = icmp eq i64 %32, 0
br i1 %33, label %34, label %41
34: ; preds = %27
%35 = tail call i32 (...) @pha()
%36 = tail call i32 (...) @clc()
%37 = tail call i32 @lda(i32 1, i32 246)
%38 = tail call i32 @adc(i32 0, i32 128)
%39 = tail call i32 @sta(i32 1, i32 246)
%40 = tail call i32 (...) @pla()
br label %41
41: ; preds = %27, %34
%42 = tail call i32 @adc(i32 1, i32 247)
%43 = tail call i32 @sta(i32 1, i32 247)
%44 = tail call i32 (...) @clc()
%45 = tail call i32 (...) @txa()
%46 = tail call i32 @adc(i32 1, i32 246)
%47 = tail call i32 @sta(i32 1, i32 246)
ret void
}