#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 unsigned int uint32_t;

/* Variables and functions */
unsigned int decompose(unsigned int const, unsigned int *);
uint32_t use_hint(const uint32_t a, const unsigned int hint) {
  uint32_t a0, a1;
  a1 = decompose(a, &a0);
  if (hint == 0)
    return a1;
  else if (a0 > 8380417U)
    return (a1 == (8380417U - 1) / (2U * (((8380417U - 1U) / 16U) / 2U)) - 1)
               ? 0
               : a1 + 1;
  else
    return (a1 == 0)
               ? (8380417U - 1) / (2U * (((8380417U - 1U) / 16U) / 2U)) - 1
               : a1 - 1;
}


x86 assembly (clang, -O0):
<use_hint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x10(%rbp),%rsi
call   1030 <decompose@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    1142 <use_hint+0x32>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    119d <use_hint+0x8d>
cmpl   $0x7fe001,-0x10(%rbp)
jbe    1177 <use_hint+0x67>
cmpl   $0xf,-0x14(%rbp)
jne    1163 <use_hint+0x53>
xor    %eax,%eax
mov    %eax,-0x18(%rbp)
jmp    116c <use_hint+0x5c>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    119d <use_hint+0x8d>
cmpl   $0x0,-0x14(%rbp)
jne    118e <use_hint+0x7e>
mov    $0xf,%eax
mov    %eax,-0x1c(%rbp)
jmp    1197 <use_hint+0x87>
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<use_hint>:
push   %rbx
sub    $0x10,%rsp
mov    %esi,%ebx
lea    0xc(%rsp),%rsi
call   1030 <decompose@plt>
test   %ebx,%ebx
je     114b <use_hint+0x3b>
cmpl   $0x7fe002,0xc(%rsp)
jb     113e <use_hint+0x2e>
lea    0x1(%rax),%ecx
xor    %edx,%edx
cmp    $0xf,%eax
cmovne %ecx,%edx
mov    %edx,%eax
jmp    114b <use_hint+0x3b>
sub    $0x1,%eax
mov    $0xf,%ecx
cmovae %eax,%ecx
mov    %ecx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @use_hint(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%8 = load i32, i32* %4
%9 = call i32 @decompose(i32 %8, i32* %6)
store i32 %9, i32* %7
%10 = load i32, i32* %5
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = load i32, i32* %7
store i32 %13, i32* %3
br label %35
14: ; preds = %2
%15 = load i32, i32* %6
%16 = icmp ugt i32 %15, 8380417
br i1 %16, label %17, label %26
17: ; preds = %14
%18 = load i32, i32* %7
%19 = icmp eq i32 %18, 15
br i1 %19, label %20, label %21
20: ; preds = %17
br label %24
21: ; preds = %17
%22 = load i32, i32* %7
%23 = add i32 %22, 1
br label %24
24: ; preds = %21, %20
%25 = phi i32 [ 0, %20 ], [ %23, %21 ]
store i32 %25, i32* %3
br label %35
26: ; preds = %14
%27 = load i32, i32* %7
%28 = icmp eq i32 %27, 0
br i1 %28, label %29, label %30
29: ; preds = %26
br label %33
30: ; preds = %26
%31 = load i32, i32* %7
%32 = sub i32 %31, 1
br label %33
33: ; preds = %30, %29
%34 = phi i32 [ 15, %29 ], [ %32, %30 ]
store i32 %34, i32* %3
br label %35
35: ; preds = %33, %24, %12
%36 = load i32, i32* %3
ret i32 %36
}

LLVM IR (-O2):
define i32 @use_hint(i32 %0, i32 %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = call i32 @decompose(i32 %0, i32* %3)
%6 = icmp eq i32 %1, 0
br i1 %6, label %18, label %7
7: ; preds = %2
%8 = load i32, i32* %3
%9 = icmp ugt i32 %8, 8380417
br i1 %9, label %10, label %14
10: ; preds = %7
%11 = icmp eq i32 %5, 15
%12 = add i32 %5, 1
%13 = select i1 %11, i32 0, i32 %12
br label %18
14: ; preds = %7
%15 = icmp eq i32 %5, 0
%16 = add i32 %5, -1
%17 = select i1 %15, i32 15, i32 %16
br label %18
18: ; preds = %2, %14, %10
%19 = phi i32 [ %13, %10 ], [ %17, %14 ], [ %5, %2 ]
ret i32 %19
}