#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*/ abort();
int /*<<< orphan*/ sprintf(char *, char *, char const *, char);
const char *opbits(const char *insn, unsigned int bits) {
  static char opbits_str[32];
  char c;
  switch (bits) {
  case 8:
    c = 'b';
    break;
  case 16:
    c = 'w';
    break;
  case 32:
    c = 'l';
    break;
  case 64:
    c = 'q';
    break;
  default:
    abort();
    break;
  }
  sprintf(opbits_str, "%s%c", insn, c);
  return opbits_str;
}


x86 assembly (clang, -O0):
<opbits>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
sub    $0x8,%eax
je     1176 <opbits+0x56>
jmp    1143 <opbits+0x23>
mov    -0x14(%rbp),%eax
sub    $0x10,%eax
je     117f <opbits+0x5f>
jmp    1154 <opbits+0x34>
mov    -0x14(%rbp),%eax
sub    $0x20,%eax
je     1188 <opbits+0x68>
jmp    1165 <opbits+0x45>
mov    -0x14(%rbp),%eax
sub    $0x40,%eax
je     1191 <opbits+0x71>
jmp    119a <opbits+0x7a>
movb   $0x62,-0xd(%rbp)
jmp    11a1 <opbits+0x81>
movb   $0x77,-0xd(%rbp)
jmp    11a1 <opbits+0x81>
movb   $0x6c,-0xd(%rbp)
jmp    11a1 <opbits+0x81>
movb   $0x71,-0xd(%rbp)
jmp    11a1 <opbits+0x81>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x8(%rbp),%rdx
lea    0x2e94(%rip),%rdi
lea    0xe4d(%rip),%rsi
movsbl -0xd(%rbp),%ecx
call   1040 <sprintf@plt>
lea    0x2e7d(%rip),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<opbits>:
push   %rbx
add    $0xfffffff8,%esi
rol    $0x1d,%esi
cmp    $0x8,%esi
jae    1169 <opbits+0x49>
mov    $0x8b,%eax
bt     %esi,%eax
jae    1169 <opbits+0x49>
mov    %rdi,%rdx
shl    $0x3,%esi
movabs $0x716262626c627762,%rax
62 62 71
mov    %esi,%ecx
shr    %cl,%rax
movsbl %al,%ecx
lea    0x2eeb(%rip),%rbx
lea    0xea4(%rip),%rsi
mov    %rbx,%rdi
call   1040 <sprintf@plt>
mov    %rbx,%rax
pop    %rbx
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@opbits.opbits_str = internal global [32 x i8] zeroinitializer
@.str = [5 x i8] c"%s%c\00"
define i8* @opbits(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
switch i32 %6, label %11 [
i32 8, label %7
i32 16, label %8
i32 32, label %9
i32 64, label %10
]
7: ; preds = %2
store i8 98, i8* %5
br label %13
8: ; preds = %2
store i8 119, i8* %5
br label %13
9: ; preds = %2
store i8 108, i8* %5
br label %13
10: ; preds = %2
store i8 113, i8* %5
br label %13
11: ; preds = %2
%12 = call i32 (...) @abort()
unreachable
13: ; preds = %10, %9, %8, %7
%14 = load i8*, i8** %3
%15 = load i8, i8* %5
%16 = call i32 @sprintf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @opbits.opbits_str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %14, i8 signext %15)
ret i8* getelementptr inbounds ([32 x i8], [32 x i8]* @opbits.opbits_str, i64 0, i64 0)
}

LLVM IR (-O2):
@opbits.opbits_str = internal global [32 x i8] zeroinitializer
@.str = [5 x i8] c"%s%c\00"
define i8* @opbits(i8* %0, i32 %1) {
%3 = add i32 %1, -8
%4 = tail call i32 @llvm.fshl.i32(i32 %3, i32 %3, i32 29)
%5 = icmp ult i32 %4, 8
br i1 %5, label %8, label %6
6: ; preds = %8, %2
%7 = tail call i32 (...) @abort()
unreachable
8: ; preds = %2
%9 = trunc i32 %4 to i8
%10 = lshr i8 -117, %9
%11 = and i8 %10, 1
%12 = icmp eq i8 %11, 0
br i1 %12, label %6, label %13
13: ; preds = %8
%14 = zext i32 %4 to i64
%15 = shl nuw nsw i64 %14, 3
%16 = lshr i64 8170200848868210530, %15
%17 = trunc i64 %16 to i8
%18 = tail call i32 @sprintf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @opbits.opbits_str, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %0, i8 signext %17)
ret i8* getelementptr inbounds ([32 x i8], [32 x i8]* @opbits.opbits_str, i64 0, i64 0)
}