#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 int32_t;

/* Variables and functions */
__attribute__((always_)) void tclod_tcclamp(int32_t *sss, int32_t *sst) {
  int32_t tempanded, temps = *sss, tempt = *sst;
  if (!(temps & 0x40000)) {
    if (!(temps & 0x20000)) {
      tempanded = temps & 0x18000;
      if (tempanded != 0x8000) {
        if (tempanded != 0x10000)
          *sss &= 0xffff;
        else
          *sss = 0x8000;
      } else
        *sss = 0x7fff;
    } else
      *sss = 0x8000;
  } else
    *sss = 0x7fff;
  if (!(tempt & 0x40000)) {
    if (!(tempt & 0x20000)) {
      tempanded = tempt & 0x18000;
      if (tempanded != 0x8000) {
        if (tempanded != 0x10000)
          *sst &= 0xffff;
        else
          *sst = 0x8000;
      } else
        *sst = 0x7fff;
    } else
      *sst = 0x8000;
  } else
    *sst = 0x7fff;
}


x86 assembly (clang, -O0):
<tclod_tcclamp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
and    $0x40000,%eax
cmp    $0x0,%eax
jne    11a5 <tclod_tcclamp+0xa5>
mov    -0x18(%rbp),%eax
and    $0x20000,%eax
cmp    $0x0,%eax
jne    1196 <tclod_tcclamp+0x96>
mov    -0x18(%rbp),%eax
and    $0x18000,%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x8000,-0x14(%rbp)
je     1187 <tclod_tcclamp+0x87>
cmpl   $0x10000,-0x14(%rbp)
je     1178 <tclod_tcclamp+0x78>
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
and    $0xffff,%ecx
mov    %ecx,(%rax)
jmp    1182 <tclod_tcclamp+0x82>
mov    -0x8(%rbp),%rax
movl   $0x8000,(%rax)
jmp    1191 <tclod_tcclamp+0x91>
mov    -0x8(%rbp),%rax
movl   $0x7fff,(%rax)
jmp    11a0 <tclod_tcclamp+0xa0>
mov    -0x8(%rbp),%rax
movl   $0x8000,(%rax)
jmp    11af <tclod_tcclamp+0xaf>
mov    -0x8(%rbp),%rax
movl   $0x7fff,(%rax)
mov    -0x1c(%rbp),%eax
and    $0x40000,%eax
cmp    $0x0,%eax
jne    1236 <tclod_tcclamp+0x136>
mov    -0x1c(%rbp),%eax
and    $0x20000,%eax
cmp    $0x0,%eax
jne    1227 <tclod_tcclamp+0x127>
mov    -0x1c(%rbp),%eax
and    $0x18000,%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x8000,-0x14(%rbp)
je     1218 <tclod_tcclamp+0x118>
cmpl   $0x10000,-0x14(%rbp)
je     1209 <tclod_tcclamp+0x109>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
and    $0xffff,%ecx
mov    %ecx,(%rax)
jmp    1213 <tclod_tcclamp+0x113>
mov    -0x10(%rbp),%rax
movl   $0x8000,(%rax)
jmp    1222 <tclod_tcclamp+0x122>
mov    -0x10(%rbp),%rax
movl   $0x7fff,(%rax)
jmp    1231 <tclod_tcclamp+0x131>
mov    -0x10(%rbp),%rax
movl   $0x8000,(%rax)
jmp    1240 <tclod_tcclamp+0x140>
mov    -0x10(%rbp),%rax
movl   $0x7fff,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<tclod_tcclamp>:
mov    (%rdi),%eax
mov    (%rsi),%ecx
mov    $0x7fff,%r8d
mov    $0x7fff,%edx
test   $0x40000,%eax
jne    1148 <tclod_tcclamp+0x48>
mov    $0x8000,%edx
test   $0x20000,%eax
jne    1148 <tclod_tcclamp+0x48>
mov    %eax,%r9d
and    $0x18000,%r9d
cmp    $0x8000,%r9d
je     1143 <tclod_tcclamp+0x43>
cmp    $0x10000,%r9d
je     1148 <tclod_tcclamp+0x48>
movzwl %ax,%edx
jmp    1148 <tclod_tcclamp+0x48>
mov    $0x7fff,%edx
mov    %edx,(%rdi)
test   $0x40000,%ecx
jne    1184 <tclod_tcclamp+0x84>
mov    $0x8000,%r8d
test   $0x20000,%ecx
jne    1184 <tclod_tcclamp+0x84>
and    $0x18000,%ecx
cmp    $0x8000,%ecx
je     117e <tclod_tcclamp+0x7e>
cmp    $0x10000,%ecx
je     1184 <tclod_tcclamp+0x84>
movzwl (%rsi),%r8d
mov    %r8d,(%rsi)
ret
mov    $0x7fff,%r8d
mov    %r8d,(%rsi)
ret

LLVM IR (-O0):
define void @tclod_tcclamp(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32* %0, i32** %3
store i32* %1, i32** %4
%8 = load i32*, i32** %3
%9 = load i32, i32* %8
store i32 %9, i32* %6
%10 = load i32*, i32** %4
%11 = load i32, i32* %10
store i32 %11, i32* %7
%12 = load i32, i32* %6
%13 = and i32 %12, 262144
%14 = icmp ne i32 %13, 0
br i1 %14, label %40, label %15
15: ; preds = %2
%16 = load i32, i32* %6
%17 = and i32 %16, 131072
%18 = icmp ne i32 %17, 0
br i1 %18, label %37, label %19
19: ; preds = %15
%20 = load i32, i32* %6
%21 = and i32 %20, 98304
store i32 %21, i32* %5
%22 = load i32, i32* %5
%23 = icmp ne i32 %22, 32768
br i1 %23, label %24, label %34
24: ; preds = %19
%25 = load i32, i32* %5
%26 = icmp ne i32 %25, 65536
br i1 %26, label %27, label %31
27: ; preds = %24
%28 = load i32*, i32** %3
%29 = load i32, i32* %28
%30 = and i32 %29, 65535
store i32 %30, i32* %28
br label %33
31: ; preds = %24
%32 = load i32*, i32** %3
store i32 32768, i32* %32
br label %33
33: ; preds = %31, %27
br label %36
34: ; preds = %19
%35 = load i32*, i32** %3
store i32 32767, i32* %35
br label %36
36: ; preds = %34, %33
br label %39
37: ; preds = %15
%38 = load i32*, i32** %3
store i32 32768, i32* %38
br label %39
39: ; preds = %37, %36
br label %42
40: ; preds = %2
%41 = load i32*, i32** %3
store i32 32767, i32* %41
br label %42
42: ; preds = %40, %39
%43 = load i32, i32* %7
%44 = and i32 %43, 262144
%45 = icmp ne i32 %44, 0
br i1 %45, label %71, label %46
46: ; preds = %42
%47 = load i32, i32* %7
%48 = and i32 %47, 131072
%49 = icmp ne i32 %48, 0
br i1 %49, label %68, label %50
50: ; preds = %46
%51 = load i32, i32* %7
%52 = and i32 %51, 98304
store i32 %52, i32* %5
%53 = load i32, i32* %5
%54 = icmp ne i32 %53, 32768
br i1 %54, label %55, label %65
55: ; preds = %50
%56 = load i32, i32* %5
%57 = icmp ne i32 %56, 65536
br i1 %57, label %58, label %62
58: ; preds = %55
%59 = load i32*, i32** %4
%60 = load i32, i32* %59
%61 = and i32 %60, 65535
store i32 %61, i32* %59
br label %64
62: ; preds = %55
%63 = load i32*, i32** %4
store i32 32768, i32* %63
br label %64
64: ; preds = %62, %58
br label %67
65: ; preds = %50
%66 = load i32*, i32** %4
store i32 32767, i32* %66
br label %67
67: ; preds = %65, %64
br label %70
68: ; preds = %46
%69 = load i32*, i32** %4
store i32 32768, i32* %69
br label %70
70: ; preds = %68, %67
br label %73
71: ; preds = %42
%72 = load i32*, i32** %4
store i32 32767, i32* %72
br label %73
73: ; preds = %71, %70
ret void
}

LLVM IR (-O2):
define void @tclod_tcclamp(i32* nocapture %0, i32* nocapture %1) {
%3 = load i32, i32* %0
%4 = load i32, i32* %1
%5 = and i32 %3, 262144
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %15
7: ; preds = %2
%8 = and i32 %3, 131072
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %15
10: ; preds = %7
%11 = and i32 %3, 98304
switch i32 %11, label %12 [
i32 32768, label %14
i32 65536, label %15
]
12: ; preds = %10
%13 = and i32 %3, 65535
br label %15
14: ; preds = %10
br label %15
15: ; preds = %2, %7, %10, %12, %14
%16 = phi i32 [ %13, %12 ], [ 32767, %14 ], [ 32768, %10 ], [ 32768, %7 ], [ 32767, %2 ]
store i32 %16, i32* %0
%17 = and i32 %4, 262144
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %28
19: ; preds = %15
%20 = and i32 %4, 131072
%21 = icmp eq i32 %20, 0
br i1 %21, label %22, label %28
22: ; preds = %19
%23 = and i32 %4, 98304
switch i32 %23, label %24 [
i32 32768, label %27
i32 65536, label %28
]
24: ; preds = %22
%25 = load i32, i32* %1
%26 = and i32 %25, 65535
br label %28
27: ; preds = %22
br label %28
28: ; preds = %15, %19, %22, %24, %27
%29 = phi i32 [ %26, %24 ], [ 32767, %27 ], [ 32768, %22 ], [ 32768, %19 ], [ 32767, %15 ]
store i32 %29, i32* %1
ret void
}