#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 mqc_decode();
int /*<<< orphan*/ mqc_setcurctx(int /*<<< orphan*/);
int /*<<< orphan*/ t1_getctxno_sc(int);
int /*<<< orphan*/ t1_getctxno_zc(int, int);
int t1_getspb(int);
int /*<<< orphan*/ t1_updateflags(int *, int);
void t1_dec_sigpass_step(int *fp, int *dp, int orient, int oneplushalf) {
  int v;
  if ((*fp & (0x0010 | 0x0001 | 0x0020 | 0x0002 | 0x0040 | 0x0004 | 0x0080 |
              0x0008)) &&
      !(*fp & (0x1000 | 0x4000))) {
    mqc_setcurctx(t1_getctxno_zc(*fp, orient));
    if (mqc_decode()) {
      mqc_setcurctx(t1_getctxno_sc(*fp));
      v = mqc_decode() ^ t1_getspb(*fp);
      *dp = v ? -oneplushalf : oneplushalf;
      t1_updateflags(fp, v);
      *fp |= 0x1000;
    }
    *fp |= 0x4000;
  }
}


x86 assembly (clang, -O0):
<t1_dec_sigpass_step>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
and    $0xff,%eax
cmp    $0x0,%eax
je     1242 <t1_dec_sigpass_step+0xe2>
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
and    $0x5000,%eax
cmp    $0x0,%eax
jne    1242 <t1_dec_sigpass_step+0xe2>
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
mov    -0x14(%rbp),%esi
call   1050 <t1_getctxno_zc@plt>
mov    %eax,%edi
call   1070 <mqc_setcurctx@plt>
mov    $0x0,%al
call   1040 <mqc_decode@plt>
cmp    $0x0,%eax
je     1234 <t1_dec_sigpass_step+0xd4>
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
call   1030 <t1_getctxno_sc@plt>
mov    %eax,%edi
call   1070 <mqc_setcurctx@plt>
mov    $0x0,%al
call   1040 <mqc_decode@plt>
mov    %eax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
call   1080 <t1_getspb@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%eax
xor    %ecx,%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
je     120b <t1_dec_sigpass_step+0xab>
xor    %eax,%eax
sub    -0x18(%rbp),%eax
mov    %eax,-0x24(%rbp)
jmp    1211 <t1_dec_sigpass_step+0xb1>
mov    -0x18(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rdi
mov    -0x1c(%rbp),%esi
call   1060 <t1_updateflags@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
or     $0x1000,%ecx
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
or     $0x4000,%ecx
mov    %ecx,(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<t1_dec_sigpass_step>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    (%rdi),%edi
test   %dil,%dil
je     11de <t1_dec_sigpass_step+0x7e>
mov    %edi,%eax
and    $0x5000,%eax
jne    11de <t1_dec_sigpass_step+0x7e>
mov    %ecx,%r15d
mov    %rsi,%r14
mov    %edx,%esi
call   1050 <t1_getctxno_zc@plt>
mov    %eax,%edi
call   1070 <mqc_setcurctx@plt>
xor    %eax,%eax
call   1040 <mqc_decode@plt>
mov    (%rbx),%edi
test   %eax,%eax
je     11d6 <t1_dec_sigpass_step+0x76>
call   1030 <t1_getctxno_sc@plt>
mov    %eax,%edi
call   1070 <mqc_setcurctx@plt>
xor    %eax,%eax
call   1040 <mqc_decode@plt>
mov    %eax,%ebp
mov    (%rbx),%edi
call   1080 <t1_getspb@plt>
mov    %r15d,%ecx
neg    %ecx
xor    %eax,%ebp
cmove  %r15d,%ecx
mov    %ecx,(%r14)
mov    %rbx,%rdi
mov    %ebp,%esi
call   1060 <t1_updateflags@plt>
mov    $0x1000,%edi
or     (%rbx),%edi
or     $0x4000,%edi
mov    %edi,(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @t1_dec_sigpass_step(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** %5
%11 = load i32, i32* %10
%12 = and i32 %11, 255
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %57
14: ; preds = %4
%15 = load i32*, i32** %5
%16 = load i32, i32* %15
%17 = and i32 %16, 20480
%18 = icmp ne i32 %17, 0
br i1 %18, label %57, label %19
19: ; preds = %14
%20 = load i32*, i32** %5
%21 = load i32, i32* %20
%22 = load i32, i32* %7
%23 = call i32 @t1_getctxno_zc(i32 %21, i32 %22)
%24 = call i32 @mqc_setcurctx(i32 %23)
%25 = call i32 (...) @mqc_decode()
%26 = icmp ne i32 %25, 0
br i1 %26, label %27, label %53
27: ; preds = %19
%28 = load i32*, i32** %5
%29 = load i32, i32* %28
%30 = call i32 @t1_getctxno_sc(i32 %29)
%31 = call i32 @mqc_setcurctx(i32 %30)
%32 = call i32 (...) @mqc_decode()
%33 = load i32*, i32** %5
%34 = load i32, i32* %33
%35 = call i32 @t1_getspb(i32 %34)
%36 = xor i32 %32, %35
store i32 %36, i32* %9
%37 = load i32, i32* %9
%38 = icmp ne i32 %37, 0
br i1 %38, label %39, label %42
39: ; preds = %27
%40 = load i32, i32* %8
%41 = sub nsw i32 0, %40
br label %44
42: ; preds = %27
%43 = load i32, i32* %8
br label %44
44: ; preds = %42, %39
%45 = phi i32 [ %41, %39 ], [ %43, %42 ]
%46 = load i32*, i32** %6
store i32 %45, i32* %46
%47 = load i32*, i32** %5
%48 = load i32, i32* %9
%49 = call i32 @t1_updateflags(i32* %47, i32 %48)
%50 = load i32*, i32** %5
%51 = load i32, i32* %50
%52 = or i32 %51, 4096
store i32 %52, i32* %50
br label %53
53: ; preds = %44, %19
%54 = load i32*, i32** %5
%55 = load i32, i32* %54
%56 = or i32 %55, 16384
store i32 %56, i32* %54
br label %57
57: ; preds = %53, %14, %4
ret void
}

LLVM IR (-O2):
define void @t1_dec_sigpass_step(i32* %0, i32* nocapture writeonly %1, i32 %2, i32 %3) {
%5 = load i32, i32* %0
%6 = and i32 %5, 255
%7 = icmp ne i32 %6, 0
%8 = and i32 %5, 20480
%9 = icmp eq i32 %8, 0
%10 = and i1 %7, %9
br i1 %10, label %11, label %33
11: ; preds = %4
%12 = tail call i32 @t1_getctxno_zc(i32 %5, i32 %2)
%13 = tail call i32 @mqc_setcurctx(i32 %12)
%14 = tail call i32 (...) @mqc_decode()
%15 = icmp eq i32 %14, 0
%16 = load i32, i32* %0
br i1 %15, label %30, label %17
17: ; preds = %11
%18 = tail call i32 @t1_getctxno_sc(i32 %16)
%19 = tail call i32 @mqc_setcurctx(i32 %18)
%20 = tail call i32 (...) @mqc_decode()
%21 = load i32, i32* %0
%22 = tail call i32 @t1_getspb(i32 %21)
%23 = xor i32 %22, %20
%24 = icmp eq i32 %23, 0
%25 = sub nsw i32 0, %3
%26 = select i1 %24, i32 %3, i32 %25
store i32 %26, i32* %1
%27 = tail call i32 @t1_updateflags(i32* %0, i32 %23)
%28 = load i32, i32* %0
%29 = or i32 %28, 4096
br label %30
30: ; preds = %11, %17
%31 = phi i32 [ %29, %17 ], [ %16, %11 ]
%32 = or i32 %31, 16384
store i32 %32, i32* %0
br label %33
33: ; preds = %30, %4
ret void
}