#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*/ data_getdiscards(int *);
int /*<<< orphan*/ io_printborder(int, int /*<<< orphan*/, int);
int io_printcard(int, int, int, int, int);
int io_printtext(int, int, int, char *);
int print_cards(int, int, int *, int);
int io_printdiscards(int x, int y, int player, int cursor) {
  int discards[150];
  data_getdiscards(discards);
  io_printborder(x, y++, 28);
  y = io_printtext(x, y, 28, "         Discards");
  y = print_cards(x, y, discards, cursor);
  y = io_printcard(x, y, discards[cursor * 2], discards[cursor * 2 + 1],
                   player);
  return y;
}


x86 assembly (clang, -O0):
<io_printdiscards>:
push   %rbp
mov    %rsp,%rbp
sub    $0x270,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
lea    -0x270(%rbp),%rdi
call   1060 <data_getdiscards@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    %esi,%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    $0x1c,%edx
call   1040 <io_printborder@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    $0x1c,%edx
lea    0xe63(%rip),%rcx
call   1030 <io_printtext@plt>
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
lea    -0x270(%rbp),%rdx
mov    -0x10(%rbp),%ecx
call   1070 <print_cards@plt>
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%eax
shl    $0x1,%eax
cltq
mov    -0x270(%rbp,%rax,4),%edx
mov    -0x10(%rbp),%eax
shl    $0x1,%eax
add    $0x1,%eax
cltq
mov    -0x270(%rbp,%rax,4),%ecx
mov    -0xc(%rbp),%r8d
call   1050 <io_printcard@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x270,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<io_printdiscards>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x258,%rsp
mov    %ecx,%r15d
mov    %edx,%r14d
mov    %esi,%ebx
mov    %edi,%ebp
mov    %rsp,%r12
mov    %r12,%rdi
call   1060 <data_getdiscards@plt>
lea    0x1(%rbx),%r13d
mov    %ebp,%edi
mov    %ebx,%esi
mov    $0x1c,%edx
call   1040 <io_printborder@plt>
lea    0xe71(%rip),%rcx
mov    %ebp,%edi
mov    %r13d,%esi
mov    $0x1c,%edx
call   1030 <io_printtext@plt>
mov    %ebp,%edi
mov    %eax,%esi
mov    %r12,%rdx
mov    %r15d,%ecx
call   1070 <print_cards@plt>
lea    (%r15,%r15,1),%ecx
movslq %ecx,%rcx
mov    (%rsp,%rcx,4),%edx
lea    (%r15,%r15,1),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rsp,%rcx,4),%ecx
mov    %ebp,%edi
mov    %eax,%esi
mov    %r14d,%r8d
call   1050 <io_printcard@plt>
add    $0x258,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [18 x i8] c" Discards\00"
define i32 @io_printdiscards(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca [150 x i32]
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%10 = getelementptr inbounds [150 x i32], [150 x i32]* %9, i64 0, i64 0
%11 = call i32 @data_getdiscards(i32* %10)
%12 = load i32, i32* %5
%13 = load i32, i32* %6
%14 = add nsw i32 %13, 1
store i32 %14, i32* %6
%15 = call i32 @io_printborder(i32 %12, i32 %13, i32 28)
%16 = load i32, i32* %5
%17 = load i32, i32* %6
%18 = call i32 @io_printtext(i32 %16, i32 %17, i32 28, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
store i32 %18, i32* %6
%19 = load i32, i32* %5
%20 = load i32, i32* %6
%21 = getelementptr inbounds [150 x i32], [150 x i32]* %9, i64 0, i64 0
%22 = load i32, i32* %8
%23 = call i32 @print_cards(i32 %19, i32 %20, i32* %21, i32 %22)
store i32 %23, i32* %6
%24 = load i32, i32* %5
%25 = load i32, i32* %6
%26 = load i32, i32* %8
%27 = mul nsw i32 %26, 2
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [150 x i32], [150 x i32]* %9, i64 0, i64 %28
%30 = load i32, i32* %29
%31 = load i32, i32* %8
%32 = mul nsw i32 %31, 2
%33 = add nsw i32 %32, 1
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [150 x i32], [150 x i32]* %9, i64 0, i64 %34
%36 = load i32, i32* %35
%37 = load i32, i32* %7
%38 = call i32 @io_printcard(i32 %24, i32 %25, i32 %30, i32 %36, i32 %37)
store i32 %38, i32* %6
%39 = load i32, i32* %6
ret i32 %39
}

LLVM IR (-O2):
@.str = [18 x i8] c" Discards\00"
define i32 @io_printdiscards(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca [150 x i32]
%6 = bitcast [150 x i32]* %5 to i8*
%7 = getelementptr inbounds [150 x i32], [150 x i32]* %5, i64 0, i64 0
%8 = call i32 @data_getdiscards(i32* %7)
%9 = add nsw i32 %1, 1
%10 = call i32 @io_printborder(i32 %0, i32 %1, i32 28)
%11 = call i32 @io_printtext(i32 %0, i32 %9, i32 28, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @print_cards(i32 %0, i32 %11, i32* %7, i32 %3)
%13 = shl nsw i32 %3, 1
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [150 x i32], [150 x i32]* %5, i64 0, i64 %14
%16 = load i32, i32* %15
%17 = or i32 %13, 1
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [150 x i32], [150 x i32]* %5, i64 0, i64 %18
%20 = load i32, i32* %19
%21 = call i32 @io_printcard(i32 %0, i32 %12, i32 %16, i32 %20, i32 %2)
ret i32 %21
}