#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 /*<<< orphan*/ exec_shldl(int, int, int, int);
int /*<<< orphan*/ exec_shldw(int, int, int, int);
void exec_shld(int s2, int s0, int s1) {
  int o, s, z, a, c, p, flags_in;
  for (o = 0; o < 2; o++) {
    for (s = 0; s < 2; s++) {
      for (z = 0; z < 2; z++) {
        for (a = 0; a < 2; a++) {
          for (c = 0; c < 2; c++) {
            for (p = 0; p < 2; p++) {
              flags_in = (o ? 0x0800 : 0) | (s ? 0x0080 : 0) |
                         (z ? 0x0040 : 0) | (a ? 0x0010 : 0) |
                         (c ? 0x0001 : 0) | (p ? 0x0004 : 0);
              exec_shldl(s2, s0, s1, flags_in);
              if (s1 <= 15)
                exec_shldw(s2, s0, s1, flags_in);
            }
          }
        }
      }
    }
  }
}


x86 assembly (clang, -O0):
<exec_shld>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x2,-0x10(%rbp)
jge    12a2 <exec_shld+0x182>
movl   $0x0,-0x14(%rbp)
cmpl   $0x2,-0x14(%rbp)
jge    128f <exec_shld+0x16f>
movl   $0x0,-0x18(%rbp)
cmpl   $0x2,-0x18(%rbp)
jge    127c <exec_shld+0x15c>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x2,-0x1c(%rbp)
jge    1269 <exec_shld+0x149>
movl   $0x0,-0x20(%rbp)
cmpl   $0x2,-0x20(%rbp)
jge    1256 <exec_shld+0x136>
movl   $0x0,-0x24(%rbp)
cmpl   $0x2,-0x24(%rbp)
jge    1243 <exec_shld+0x123>
mov    -0x10(%rbp),%edx
xor    %eax,%eax
mov    $0x800,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
mov    -0x14(%rbp),%esi
xor    %ecx,%ecx
mov    $0x80,%edx
cmp    $0x0,%esi
cmovne %edx,%ecx
or     %ecx,%eax
mov    -0x18(%rbp),%esi
xor    %ecx,%ecx
mov    $0x40,%edx
cmp    $0x0,%esi
cmovne %edx,%ecx
or     %ecx,%eax
mov    -0x1c(%rbp),%esi
xor    %ecx,%ecx
mov    $0x10,%edx
cmp    $0x0,%esi
cmovne %edx,%ecx
or     %ecx,%eax
mov    -0x20(%rbp),%esi
xor    %ecx,%ecx
mov    $0x1,%edx
cmp    $0x0,%esi
cmovne %edx,%ecx
or     %ecx,%eax
mov    -0x24(%rbp),%esi
xor    %ecx,%ecx
mov    $0x4,%edx
cmp    $0x0,%esi
cmovne %edx,%ecx
or     %ecx,%eax
mov    %eax,-0x28(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x28(%rbp),%ecx
call   1030 <exec_shldl@plt>
cmpl   $0xf,-0xc(%rbp)
jg     1230 <exec_shld+0x110>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x28(%rbp),%ecx
call   1040 <exec_shldw@plt>
jmp    1235 <exec_shld+0x115>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    118d <exec_shld+0x6d>
jmp    1248 <exec_shld+0x128>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    117c <exec_shld+0x5c>
jmp    125b <exec_shld+0x13b>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    116b <exec_shld+0x4b>
jmp    126e <exec_shld+0x14e>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    115a <exec_shld+0x3a>
jmp    1281 <exec_shld+0x161>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1149 <exec_shld+0x29>
jmp    1294 <exec_shld+0x174>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1138 <exec_shld+0x18>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<exec_shld>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %edx,%r12d
mov    %esi,%r14d
mov    %edi,%r15d
mov    $0x1,%al
jmp    1150 <exec_shld+0x30>
nopl   0x0(%rax,%rax,1)
testb  $0x1,0x8(%rsp)
mov    $0x0,%eax
je     1379 <exec_shld+0x259>
mov    %eax,0x8(%rsp)
not    %al
movzbl %al,%eax
and    $0x1,%eax
shl    $0xb,%eax
mov    %eax,0xc(%rsp)
mov    $0x1,%al
jmp    117c <exec_shld+0x5c>
nopw   0x0(%rax,%rax,1)
testb  $0x1,0x10(%rsp)
mov    $0x0,%eax
je     1140 <exec_shld+0x20>
mov    %eax,0x10(%rsp)
not    %al
movzbl %al,%ebx
and    $0x1,%ebx
shl    $0x7,%ebx
or     0xc(%rsp),%ebx
mov    $0x1,%r13b
mov    %ebx,0x14(%rsp)
jmp    12c5 <exec_shld+0x1a5>
nopl   0x0(%rax,%rax,1)
mov    %r15d,%edi
mov    %r14d,%esi
mov    %r12d,%edx
mov    %ebp,%ecx
call   1040 <exec_shldw@plt>
mov    %ebp,%ebx
or     $0x4,%ebx
mov    %r15d,%edi
mov    %r14d,%esi
mov    %r12d,%edx
mov    %ebx,%ecx
call   1030 <exec_shldl@plt>
mov    %r15d,%edi
mov    %r14d,%esi
mov    %r12d,%edx
mov    %ebx,%ecx
call   1040 <exec_shldw@plt>
mov    %ebp,%ebx
or     $0x1,%ebx
mov    %r15d,%edi
mov    %r14d,%esi
mov    %r12d,%edx
mov    %ebx,%ecx
call   1030 <exec_shldl@plt>
mov    %r15d,%edi
mov    %r14d,%esi
mov    %r12d,%edx
mov    %ebx,%ecx
call   1040 <exec_shldw@plt>
mov    %ebp,%ebx
or     $0x5,%ebx
mov    %r15d,%edi
mov    %r14d,%esi
mov    %r12d,%edx
mov    %ebx,%ecx
call   1030 <exec_shldl@plt>
mov    %r15d,%edi
mov    %r14d,%esi
mov    %r12d,%edx
mov    %ebx,%ecx
call   1040 <exec_shldw@plt>
mov    %ebp,%ebx
or     $0x10,%ebx
mov    %r15d,%edi
mov    %r14d,%esi
mov    %r12d,%edx
mov    %ebx,%ecx
call   1030 <exec_shldl@plt>
mov    %r15d,%edi
mov    %r14d,%esi
mov    %r12d,%edx
mov    %ebx,%ecx
call   1040 <exec_shldw@plt>
mov    %ebp,%ebx
or     $0x14,%ebx
mov    %r15d,%edi
mov    %r14d,%esi
mov    %r12d,%edx
mov    %ebx,%ecx
call   1030 <exec_shldl@plt>
mov    %r15d,%edi
mov    %r14d,%esi
mov    %r12d,%edx
mov    %ebx,%ecx
call   1040 <exec_shldw@plt>
mov    %ebp,%ebx
or     $0x11,%ebx
mov    %r15d,%edi
mov    %r14d,%esi
mov    %r12d,%edx
mov    %ebx,%ecx
call   1030 <exec_shldl@plt>
mov    %r15d,%edi
mov    %r14d,%esi
mov    %r12d,%edx
mov    %ebx,%ecx
mov    0x14(%rsp),%ebx
call   1040 <exec_shldw@plt>
or     $0x15,%ebp
mov    %r15d,%edi
mov    %r14d,%esi
mov    %r12d,%edx
mov    %ebp,%ecx
call   1030 <exec_shldl@plt>
mov    %r15d,%edi
mov    %r14d,%esi
mov    %r12d,%edx
mov    %ebp,%ecx
call   1040 <exec_shldw@plt>
test   $0x1,%r13b
mov    $0x0,%r13d
je     1170 <exec_shld+0x50>
mov    %r13d,%eax
not    %al
movzbl %al,%ebp
and    $0x1,%ebp
shl    $0x6,%ebp
or     %ebx,%ebp
mov    %r15d,%edi
mov    %r14d,%esi
mov    %r12d,%edx
mov    %ebp,%ecx
call   1030 <exec_shldl@plt>
cmp    $0x10,%r12d
jl     11a0 <exec_shld+0x80>
mov    %ebp,%ecx
or     $0x4,%ecx
mov    %r15d,%edi
mov    %r14d,%esi
mov    %r12d,%edx
call   1030 <exec_shldl@plt>
mov    %ebp,%ecx
or     $0x1,%ecx
mov    %r15d,%edi
mov    %r14d,%esi
mov    %r12d,%edx
call   1030 <exec_shldl@plt>
mov    %ebp,%ecx
or     $0x5,%ecx
mov    %r15d,%edi
mov    %r14d,%esi
mov    %r12d,%edx
call   1030 <exec_shldl@plt>
mov    %ebp,%ecx
or     $0x10,%ecx
mov    %r15d,%edi
mov    %r14d,%esi
mov    %r12d,%edx
call   1030 <exec_shldl@plt>
mov    %ebp,%ecx
or     $0x14,%ecx
mov    %r15d,%edi
mov    %r14d,%esi
mov    %r12d,%edx
call   1030 <exec_shldl@plt>
mov    %ebp,%ecx
or     $0x11,%ecx
mov    %r15d,%edi
mov    %r14d,%esi
mov    %r12d,%edx
call   1030 <exec_shldl@plt>
or     $0x15,%ebp
mov    %r15d,%edi
mov    %r14d,%esi
mov    %r12d,%edx
mov    %ebp,%ecx
call   1030 <exec_shldl@plt>
jmp    12b5 <exec_shld+0x195>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @exec_shld(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
store i32 0, i32* %7
br label %14
14: ; preds = %101, %3
%15 = load i32, i32* %7
%16 = icmp slt i32 %15, 2
br i1 %16, label %17, label %104
17: ; preds = %14
store i32 0, i32* %8
br label %18
18: ; preds = %97, %17
%19 = load i32, i32* %8
%20 = icmp slt i32 %19, 2
br i1 %20, label %21, label %100
21: ; preds = %18
store i32 0, i32* %9
br label %22
22: ; preds = %93, %21
%23 = load i32, i32* %9
%24 = icmp slt i32 %23, 2
br i1 %24, label %25, label %96
25: ; preds = %22
store i32 0, i32* %10
br label %26
26: ; preds = %89, %25
%27 = load i32, i32* %10
%28 = icmp slt i32 %27, 2
br i1 %28, label %29, label %92
29: ; preds = %26
store i32 0, i32* %11
br label %30
30: ; preds = %85, %29
%31 = load i32, i32* %11
%32 = icmp slt i32 %31, 2
br i1 %32, label %33, label %88
33: ; preds = %30
store i32 0, i32* %12
br label %34
34: ; preds = %81, %33
%35 = load i32, i32* %12
%36 = icmp slt i32 %35, 2
br i1 %36, label %37, label %84
37: ; preds = %34
%38 = load i32, i32* %7
%39 = icmp ne i32 %38, 0
%40 = zext i1 %39 to i64
%41 = select i1 %39, i32 2048, i32 0
%42 = load i32, i32* %8
%43 = icmp ne i32 %42, 0
%44 = zext i1 %43 to i64
%45 = select i1 %43, i32 128, i32 0
%46 = or i32 %41, %45
%47 = load i32, i32* %9
%48 = icmp ne i32 %47, 0
%49 = zext i1 %48 to i64
%50 = select i1 %48, i32 64, i32 0
%51 = or i32 %46, %50
%52 = load i32, i32* %10
%53 = icmp ne i32 %52, 0
%54 = zext i1 %53 to i64
%55 = select i1 %53, i32 16, i32 0
%56 = or i32 %51, %55
%57 = load i32, i32* %11
%58 = icmp ne i32 %57, 0
%59 = zext i1 %58 to i64
%60 = select i1 %58, i32 1, i32 0
%61 = or i32 %56, %60
%62 = load i32, i32* %12
%63 = icmp ne i32 %62, 0
%64 = zext i1 %63 to i64
%65 = select i1 %63, i32 4, i32 0
%66 = or i32 %61, %65
store i32 %66, i32* %13
%67 = load i32, i32* %4
%68 = load i32, i32* %5
%69 = load i32, i32* %6
%70 = load i32, i32* %13
%71 = call i32 @exec_shldl(i32 %67, i32 %68, i32 %69, i32 %70)
%72 = load i32, i32* %6
%73 = icmp sle i32 %72, 15
br i1 %73, label %74, label %80
74: ; preds = %37
%75 = load i32, i32* %4
%76 = load i32, i32* %5
%77 = load i32, i32* %6
%78 = load i32, i32* %13
%79 = call i32 @exec_shldw(i32 %75, i32 %76, i32 %77, i32 %78)
br label %80
80: ; preds = %74, %37
br label %81
81: ; preds = %80
%82 = load i32, i32* %12
%83 = add nsw i32 %82, 1
store i32 %83, i32* %12
br label %34
84: ; preds = %34
br label %85
85: ; preds = %84
%86 = load i32, i32* %11
%87 = add nsw i32 %86, 1
store i32 %87, i32* %11
br label %30
88: ; preds = %30
br label %89
89: ; preds = %88
%90 = load i32, i32* %10
%91 = add nsw i32 %90, 1
store i32 %91, i32* %10
br label %26
92: ; preds = %26
br label %93
93: ; preds = %92
%94 = load i32, i32* %9
%95 = add nsw i32 %94, 1
store i32 %95, i32* %9
br label %22
96: ; preds = %22
br label %97
97: ; preds = %96
%98 = load i32, i32* %8
%99 = add nsw i32 %98, 1
store i32 %99, i32* %8
br label %18
100: ; preds = %18
br label %101
101: ; preds = %100
%102 = load i32, i32* %7
%103 = add nsw i32 %102, 1
store i32 %103, i32* %7
br label %14
104: ; preds = %14
ret void
}

LLVM IR (-O2):
define void @exec_shld(i32 %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %2, 16
br label %5
5: ; preds = %3, %57
%6 = phi i1 [ true, %3 ], [ false, %57 ]
%7 = select i1 %6, i32 0, i32 2048
br label %8
8: ; preds = %5, %56
%9 = phi i1 [ true, %5 ], [ false, %56 ]
%10 = select i1 %9, i32 0, i32 128
%11 = or i32 %10, %7
br label %12
12: ; preds = %8, %55
%13 = phi i1 [ true, %8 ], [ false, %55 ]
%14 = select i1 %13, i32 0, i32 64
%15 = or i32 %11, %14
%16 = tail call i32 @exec_shldl(i32 %0, i32 %1, i32 %2, i32 %15)
br i1 %4, label %32, label %17
17: ; preds = %12
%18 = or i32 %15, 4
%19 = tail call i32 @exec_shldl(i32 %0, i32 %1, i32 %2, i32 %18)
%20 = or i32 %15, 1
%21 = tail call i32 @exec_shldl(i32 %0, i32 %1, i32 %2, i32 %20)
%22 = or i32 %15, 5
%23 = tail call i32 @exec_shldl(i32 %0, i32 %1, i32 %2, i32 %22)
%24 = or i32 %15, 16
%25 = tail call i32 @exec_shldl(i32 %0, i32 %1, i32 %2, i32 %24)
%26 = or i32 %15, 20
%27 = tail call i32 @exec_shldl(i32 %0, i32 %1, i32 %2, i32 %26)
%28 = or i32 %15, 17
%29 = tail call i32 @exec_shldl(i32 %0, i32 %1, i32 %2, i32 %28)
%30 = or i32 %15, 21
%31 = tail call i32 @exec_shldl(i32 %0, i32 %1, i32 %2, i32 %30)
br label %55
32: ; preds = %12
%33 = tail call i32 @exec_shldw(i32 %0, i32 %1, i32 %2, i32 %15)
%34 = or i32 %15, 4
%35 = tail call i32 @exec_shldl(i32 %0, i32 %1, i32 %2, i32 %34)
%36 = tail call i32 @exec_shldw(i32 %0, i32 %1, i32 %2, i32 %34)
%37 = or i32 %15, 1
%38 = tail call i32 @exec_shldl(i32 %0, i32 %1, i32 %2, i32 %37)
%39 = tail call i32 @exec_shldw(i32 %0, i32 %1, i32 %2, i32 %37)
%40 = or i32 %15, 5
%41 = tail call i32 @exec_shldl(i32 %0, i32 %1, i32 %2, i32 %40)
%42 = tail call i32 @exec_shldw(i32 %0, i32 %1, i32 %2, i32 %40)
%43 = or i32 %15, 16
%44 = tail call i32 @exec_shldl(i32 %0, i32 %1, i32 %2, i32 %43)
%45 = tail call i32 @exec_shldw(i32 %0, i32 %1, i32 %2, i32 %43)
%46 = or i32 %15, 20
%47 = tail call i32 @exec_shldl(i32 %0, i32 %1, i32 %2, i32 %46)
%48 = tail call i32 @exec_shldw(i32 %0, i32 %1, i32 %2, i32 %46)
%49 = or i32 %15, 17
%50 = tail call i32 @exec_shldl(i32 %0, i32 %1, i32 %2, i32 %49)
%51 = tail call i32 @exec_shldw(i32 %0, i32 %1, i32 %2, i32 %49)
%52 = or i32 %15, 21
%53 = tail call i32 @exec_shldl(i32 %0, i32 %1, i32 %2, i32 %52)
%54 = tail call i32 @exec_shldw(i32 %0, i32 %1, i32 %2, i32 %52)
br label %55
55: ; preds = %17, %32
br i1 %13, label %12, label %56
56: ; preds = %55
br i1 %9, label %8, label %57
57: ; preds = %56
br i1 %6, label %5, label %58
58: ; preds = %57
ret void
}