#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 */
typedef int /*<<< orphan*/ uint8_t;
typedef int uint32_t;
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int /*<<< orphan*/ *_hs_text_decode_utf8_int(int /*<<< orphan*/ *const,
                                             size_t *,
                                             int /*<<< orphan*/ const **,
                                             int /*<<< orphan*/ const *, int *,
                                             int *);
uint8_t const *_hs_text_decode_utf8_state(uint16_t *const dest, size_t *destoff,
                                          const uint8_t **src,
                                          const uint8_t *srcend,
                                          uint32_t *codepoint0,
                                          uint32_t *state0) {
  uint8_t const *ret =
      _hs_text_decode_utf8_int(dest, destoff, src, srcend, codepoint0, state0);
  if (*state0 == 12)
    ret -= 1;
  return ret;
}


x86 assembly (clang, -O0):
<_hs_text_decode_utf8_state>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
mov    -0x30(%rbp),%r9
call   1030 <_hs_text_decode_utf8_int@plt>
mov    %rax,-0x38(%rbp)
mov    -0x30(%rbp),%rax
cmpl   $0xc,(%rax)
jne    116a <_hs_text_decode_utf8_state+0x5a>
mov    -0x38(%rbp),%rax
add    $0xfffffffffffffffc,%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_hs_text_decode_utf8_state>:
push   %rbx
mov    %r9,%rbx
call   1030 <_hs_text_decode_utf8_int@plt>
xor    %ecx,%ecx
cmpl   $0xc,(%rbx)
sete   %cl
shl    $0x2,%rcx
sub    %rcx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i32* @_hs_text_decode_utf8_state(i32* %0, i64* %1, i32** %2, i32* %3, i32* %4, i32* %5) {
%7 = alloca i32*
%8 = alloca i64*
%9 = alloca i32**
%10 = alloca i32*
%11 = alloca i32*
%12 = alloca i32*
%13 = alloca i32*
store i32* %0, i32** %7
store i64* %1, i64** %8
store i32** %2, i32*** %9
store i32* %3, i32** %10
store i32* %4, i32** %11
store i32* %5, i32** %12
%14 = load i32*, i32** %7
%15 = load i64*, i64** %8
%16 = load i32**, i32*** %9
%17 = load i32*, i32** %10
%18 = load i32*, i32** %11
%19 = load i32*, i32** %12
%20 = call i32* @_hs_text_decode_utf8_int(i32* %14, i64* %15, i32** %16, i32* %17, i32* %18, i32* %19)
store i32* %20, i32** %13
%21 = load i32*, i32** %12
%22 = load i32, i32* %21
%23 = icmp eq i32 %22, 12
br i1 %23, label %24, label %27
24: ; preds = %6
%25 = load i32*, i32** %13
%26 = getelementptr inbounds i32, i32* %25, i64 -1
store i32* %26, i32** %13
br label %27
27: ; preds = %24, %6
%28 = load i32*, i32** %13
ret i32* %28
}

LLVM IR (-O2):
define i32* @_hs_text_decode_utf8_state(i32* %0, i64* %1, i32** %2, i32* %3, i32* %4, i32* %5) {
%7 = tail call i32* @_hs_text_decode_utf8_int(i32* %0, i64* %1, i32** %2, i32* %3, i32* %4, i32* %5)
%8 = load i32, i32* %5
%9 = icmp eq i32 %8, 12
%10 = sext i1 %9 to i64
%11 = getelementptr i32, i32* %7, i64 %10
ret i32* %11
}