#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*/ GenExtendRegIfNeeded(int, int);
int /*<<< orphan*/ GenPrintInstr2Operands(int, int /*<<< orphan*/, int,
                                          int /*<<< orphan*/, int, int);
int /*<<< orphan*/ GenReadIndirect(int, int, int);
int /*<<< orphan*/ GenWriteIndirect(int, int, int);
void GenIncDecIndirect(int regDst, int regSrc, int opSz, int tok) {
  int instr = 0x0A;
  if (tok != 12)
    instr = 0x0B;
  GenReadIndirect(regDst, regSrc, opSz);
  GenPrintInstr2Operands(instr, 0, regDst, 0, 0x80, 1);
  GenWriteIndirect(regSrc, regDst, opSz);
  GenExtendRegIfNeeded(regDst, opSz);
}


x86 assembly (clang, -O0):
<GenIncDecIndirect>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
movl   $0xa,-0x14(%rbp)
cmpl   $0xc,-0x10(%rbp)
je     116c <GenIncDecIndirect+0x2c>
movl   $0xb,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1060 <GenReadIndirect@plt>
mov    -0x14(%rbp),%edi
mov    -0x4(%rbp),%edx
xor    %ecx,%ecx
mov    $0x80,%r8d
mov    $0x1,%r9d
mov    %ecx,%esi
call   1030 <GenPrintInstr2Operands@plt>
mov    -0x8(%rbp),%edi
mov    -0x4(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1050 <GenWriteIndirect@plt>
mov    -0x4(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1040 <GenExtendRegIfNeeded@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GenIncDecIndirect>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%r15d
mov    %esi,%r14d
mov    %edi,%ebp
xor    %ebx,%ebx
cmp    $0xc,%ecx
sete   %bl
xor    $0xb,%ebx
call   1060 <GenReadIndirect@plt>
mov    %ebx,%edi
xor    %esi,%esi
mov    %ebp,%edx
xor    %ecx,%ecx
mov    $0x80,%r8d
mov    $0x1,%r9d
call   1030 <GenPrintInstr2Operands@plt>
mov    %r14d,%edi
mov    %ebp,%esi
mov    %r15d,%edx
call   1050 <GenWriteIndirect@plt>
mov    %ebp,%edi
mov    %r15d,%esi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <GenExtendRegIfNeeded@plt>

LLVM IR (-O0):
define void @GenIncDecIndirect(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
store i32 10, i32* %9
%10 = load i32, i32* %8
%11 = icmp ne i32 %10, 12
br i1 %11, label %12, label %13
12: ; preds = %4
store i32 11, i32* %9
br label %13
13: ; preds = %12, %4
%14 = load i32, i32* %5
%15 = load i32, i32* %6
%16 = load i32, i32* %7
%17 = call i32 @GenReadIndirect(i32 %14, i32 %15, i32 %16)
%18 = load i32, i32* %9
%19 = load i32, i32* %5
%20 = call i32 @GenPrintInstr2Operands(i32 %18, i32 0, i32 %19, i32 0, i32 128, i32 1)
%21 = load i32, i32* %6
%22 = load i32, i32* %5
%23 = load i32, i32* %7
%24 = call i32 @GenWriteIndirect(i32 %21, i32 %22, i32 %23)
%25 = load i32, i32* %5
%26 = load i32, i32* %7
%27 = call i32 @GenExtendRegIfNeeded(i32 %25, i32 %26)
ret void
}

LLVM IR (-O2):
define void @GenIncDecIndirect(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = icmp eq i32 %3, 12
%6 = select i1 %5, i32 10, i32 11
%7 = tail call i32 @GenReadIndirect(i32 %0, i32 %1, i32 %2)
%8 = tail call i32 @GenPrintInstr2Operands(i32 %6, i32 0, i32 %0, i32 0, i32 128, i32 1)
%9 = tail call i32 @GenWriteIndirect(i32 %1, i32 %0, i32 %2)
%10 = tail call i32 @GenExtendRegIfNeeded(i32 %0, i32 %2)
ret void
}