#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 int_min(int, int);
int t1_init_ctxno_sc(int f) {
  int hc, vc, n;
  n = 0;
  hc = int_min(((f & (0x0020 | 0x0200)) == 0x0020) +
                   ((f & (0x0080 | 0x0800)) == 0x0080),
               1) -
       int_min(((f & (0x0020 | 0x0200)) == (0x0020 | 0x0200)) +
                   ((f & (0x0080 | 0x0800)) == (0x0080 | 0x0800)),
               1);
  vc = int_min(((f & (0x0010 | 0x0100)) == 0x0010) +
                   ((f & (0x0040 | 0x0400)) == 0x0040),
               1) -
       int_min(((f & (0x0010 | 0x0100)) == (0x0010 | 0x0100)) +
                   ((f & (0x0040 | 0x0400)) == (0x0040 | 0x0400)),
               1);
  if (hc < 0) {
    hc = -hc;
    vc = -vc;
  }
  if (!hc) {
    if (vc == -1)
      n = 1;
    else if (!vc)
      n = 0;
    else
      n = 1;
  } else if (hc == 1) {
    if (vc == -1)
      n = 2;
    else if (!vc)
      n = 3;
    else
      n = 4;
  }
  return ((((0 + 1) + 9) + 3) + n);
}


x86 assembly (clang, -O0):
<t1_init_ctxno_sc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x4(%rbp),%eax
and    $0x220,%eax
cmp    $0x20,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
mov    -0x4(%rbp),%eax
and    $0x880,%eax
cmp    $0x80,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    %eax,%edi
mov    $0x1,%esi
call   1030 <int_min@plt>
mov    %eax,-0x18(%rbp)
mov    -0x4(%rbp),%eax
and    $0x220,%eax
cmp    $0x220,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
mov    -0x4(%rbp),%eax
and    $0x880,%eax
cmp    $0x880,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    %eax,%edi
mov    $0x1,%esi
call   1030 <int_min@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    $0x110,%eax
cmp    $0x10,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
mov    -0x4(%rbp),%eax
and    $0x440,%eax
cmp    $0x40,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    %eax,%edi
mov    $0x1,%esi
call   1030 <int_min@plt>
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%eax
and    $0x110,%eax
cmp    $0x110,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
mov    -0x4(%rbp),%eax
and    $0x440,%eax
cmp    $0x440,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    %eax,%edi
mov    $0x1,%esi
call   1030 <int_min@plt>
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    1228 <t1_init_ctxno_sc+0x118>
xor    %eax,%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
xor    %eax,%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    126f <t1_init_ctxno_sc+0x15f>
cmpl   $0xffffffff,-0xc(%rbp)
jne    1248 <t1_init_ctxno_sc+0x138>
movl   $0x1,-0x10(%rbp)
jmp    126a <t1_init_ctxno_sc+0x15a>
cmpl   $0x0,-0xc(%rbp)
jne    125e <t1_init_ctxno_sc+0x14e>
movl   $0x0,-0x10(%rbp)
jmp    1265 <t1_init_ctxno_sc+0x155>
movl   $0x1,-0x10(%rbp)
jmp    126a <t1_init_ctxno_sc+0x15a>
jmp    12bb <t1_init_ctxno_sc+0x1ab>
cmpl   $0x1,-0x8(%rbp)
jne    12b6 <t1_init_ctxno_sc+0x1a6>
cmpl   $0xffffffff,-0xc(%rbp)
jne    128f <t1_init_ctxno_sc+0x17f>
movl   $0x2,-0x10(%rbp)
jmp    12b1 <t1_init_ctxno_sc+0x1a1>
cmpl   $0x0,-0xc(%rbp)
jne    12a5 <t1_init_ctxno_sc+0x195>
movl   $0x3,-0x10(%rbp)
jmp    12ac <t1_init_ctxno_sc+0x19c>
movl   $0x4,-0x10(%rbp)
jmp    12b1 <t1_init_ctxno_sc+0x1a1>
jmp    12b6 <t1_init_ctxno_sc+0x1a6>
jmp    12bb <t1_init_ctxno_sc+0x1ab>
mov    -0x10(%rbp),%eax
add    $0xd,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<t1_init_ctxno_sc>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edi,%r15d
mov    %edi,%ebp
and    $0x220,%ebp
xor    %eax,%eax
cmp    $0x20,%ebp
sete   %al
mov    %edi,%ebx
and    $0x880,%ebx
xor    %edi,%edi
cmp    $0x80,%ebx
sete   %dil
add    %eax,%edi
mov    $0x1,%esi
call   1030 <int_min@plt>
mov    %eax,%r14d
xor    %eax,%eax
cmp    $0x220,%ebp
sete   %al
xor    %edi,%edi
cmp    $0x880,%ebx
sete   %dil
add    %eax,%edi
mov    $0x1,%esi
call   1030 <int_min@plt>
sub    %eax,%r14d
mov    %r15d,%ebx
and    $0x110,%ebx
xor    %eax,%eax
cmp    $0x10,%ebx
sete   %al
and    $0x440,%r15d
xor    %edi,%edi
cmp    $0x40,%r15d
sete   %dil
add    %eax,%edi
mov    $0x1,%esi
call   1030 <int_min@plt>
mov    %eax,%ebp
xor    %eax,%eax
cmp    $0x110,%ebx
sete   %al
xor    %edi,%edi
cmp    $0x440,%r15d
sete   %dil
add    %eax,%edi
mov    $0x1,%esi
call   1030 <int_min@plt>
sub    %eax,%ebp
mov    %ebp,%ecx
neg    %ecx
mov    %r14d,%edx
neg    %edx
cmovs  %r14d,%edx
test   %r14d,%r14d
cmovns %ebp,%ecx
cmp    $0x1,%edx
je     11f7 <t1_init_ctxno_sc+0xe7>
mov    $0xd,%eax
test   %edx,%edx
jne    120d <t1_init_ctxno_sc+0xfd>
cmp    $0x1,%ecx
mov    $0xe,%eax
sbb    $0x0,%eax
jmp    120d <t1_init_ctxno_sc+0xfd>
cmp    $0x1,%ecx
mov    $0x11,%edx
sbb    $0x0,%edx
cmp    $0xffffffff,%ecx
mov    $0xf,%eax
cmovne %edx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @t1_init_ctxno_sc(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %5
%6 = load i32, i32* %2
%7 = and i32 %6, 544
%8 = icmp eq i32 %7, 32
%9 = zext i1 %8 to i32
%10 = load i32, i32* %2
%11 = and i32 %10, 2176
%12 = icmp eq i32 %11, 128
%13 = zext i1 %12 to i32
%14 = add nsw i32 %9, %13
%15 = call i32 @int_min(i32 %14, i32 1)
%16 = load i32, i32* %2
%17 = and i32 %16, 544
%18 = icmp eq i32 %17, 544
%19 = zext i1 %18 to i32
%20 = load i32, i32* %2
%21 = and i32 %20, 2176
%22 = icmp eq i32 %21, 2176
%23 = zext i1 %22 to i32
%24 = add nsw i32 %19, %23
%25 = call i32 @int_min(i32 %24, i32 1)
%26 = sub nsw i32 %15, %25
store i32 %26, i32* %3
%27 = load i32, i32* %2
%28 = and i32 %27, 272
%29 = icmp eq i32 %28, 16
%30 = zext i1 %29 to i32
%31 = load i32, i32* %2
%32 = and i32 %31, 1088
%33 = icmp eq i32 %32, 64
%34 = zext i1 %33 to i32
%35 = add nsw i32 %30, %34
%36 = call i32 @int_min(i32 %35, i32 1)
%37 = load i32, i32* %2
%38 = and i32 %37, 272
%39 = icmp eq i32 %38, 272
%40 = zext i1 %39 to i32
%41 = load i32, i32* %2
%42 = and i32 %41, 1088
%43 = icmp eq i32 %42, 1088
%44 = zext i1 %43 to i32
%45 = add nsw i32 %40, %44
%46 = call i32 @int_min(i32 %45, i32 1)
%47 = sub nsw i32 %36, %46
store i32 %47, i32* %4
%48 = load i32, i32* %3
%49 = icmp slt i32 %48, 0
br i1 %49, label %50, label %55
50: ; preds = %1
%51 = load i32, i32* %3
%52 = sub nsw i32 0, %51
store i32 %52, i32* %3
%53 = load i32, i32* %4
%54 = sub nsw i32 0, %53
store i32 %54, i32* %4
br label %55
55: ; preds = %50, %1
%56 = load i32, i32* %3
%57 = icmp ne i32 %56, 0
br i1 %57, label %69, label %58
58: ; preds = %55
%59 = load i32, i32* %4
%60 = icmp eq i32 %59, -1
br i1 %60, label %61, label %62
61: ; preds = %58
store i32 1, i32* %5
br label %68
62: ; preds = %58
%63 = load i32, i32* %4
%64 = icmp ne i32 %63, 0
br i1 %64, label %66, label %65
65: ; preds = %62
store i32 0, i32* %5
br label %67
66: ; preds = %62
store i32 1, i32* %5
br label %67
67: ; preds = %66, %65
br label %68
68: ; preds = %67, %61
br label %84
69: ; preds = %55
%70 = load i32, i32* %3
%71 = icmp eq i32 %70, 1
br i1 %71, label %72, label %83
72: ; preds = %69
%73 = load i32, i32* %4
%74 = icmp eq i32 %73, -1
br i1 %74, label %75, label %76
75: ; preds = %72
store i32 2, i32* %5
br label %82
76: ; preds = %72
%77 = load i32, i32* %4
%78 = icmp ne i32 %77, 0
br i1 %78, label %80, label %79
79: ; preds = %76
store i32 3, i32* %5
br label %81
80: ; preds = %76
store i32 4, i32* %5
br label %81
81: ; preds = %80, %79
br label %82
82: ; preds = %81, %75
br label %83
83: ; preds = %82, %69
br label %84
84: ; preds = %83, %68
%85 = load i32, i32* %5
%86 = add nsw i32 13, %85
ret i32 %86
}

LLVM IR (-O2):
define i32 @t1_init_ctxno_sc(i32 %0) {
%2 = and i32 %0, 544
%3 = icmp eq i32 %2, 32
%4 = zext i1 %3 to i32
%5 = and i32 %0, 2176
%6 = icmp eq i32 %5, 128
%7 = zext i1 %6 to i32
%8 = add nuw nsw i32 %4, %7
%9 = tail call i32 @int_min(i32 %8, i32 1)
%10 = icmp eq i32 %2, 544
%11 = zext i1 %10 to i32
%12 = icmp eq i32 %5, 2176
%13 = zext i1 %12 to i32
%14 = add nuw nsw i32 %11, %13
%15 = tail call i32 @int_min(i32 %14, i32 1)
%16 = sub nsw i32 %9, %15
%17 = and i32 %0, 272
%18 = icmp eq i32 %17, 16
%19 = zext i1 %18 to i32
%20 = and i32 %0, 1088
%21 = icmp eq i32 %20, 64
%22 = zext i1 %21 to i32
%23 = add nuw nsw i32 %19, %22
%24 = tail call i32 @int_min(i32 %23, i32 1)
%25 = icmp eq i32 %17, 272
%26 = zext i1 %25 to i32
%27 = icmp eq i32 %20, 1088
%28 = zext i1 %27 to i32
%29 = add nuw nsw i32 %26, %28
%30 = tail call i32 @int_min(i32 %29, i32 1)
%31 = sub nsw i32 %24, %30
%32 = icmp slt i32 %16, 0
%33 = sub nsw i32 0, %16
%34 = sub nsw i32 0, %31
%35 = select i1 %32, i32 %33, i32 %16
%36 = select i1 %32, i32 %34, i32 %31
switch i32 %35, label %45 [
i32 0, label %37
i32 1, label %40
]
37: ; preds = %1
%38 = icmp eq i32 %36, 0
%39 = select i1 %38, i32 13, i32 14
br label %45
40: ; preds = %1
%41 = icmp eq i32 %36, 0
%42 = select i1 %41, i32 16, i32 17
%43 = icmp eq i32 %36, -1
%44 = select i1 %43, i32 15, i32 %42
br label %45
45: ; preds = %37, %40, %1
%46 = phi i32 [ 13, %1 ], [ %39, %37 ], [ %44, %40 ]
ret i32 %46
}