#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*/ swab(unsigned int *, unsigned int *, int);
int qc250a(unsigned int pixel) {
  unsigned int swabfrom, swabto, qctemp;
  int class;
  swabfrom = pixel;
  swab(&swabfrom, &swabto, 4);
  qctemp = swabto;
  if (qctemp & 0x02) {
    if (qctemp & 0x01) {
      class = 4;
    } else {
      class = 3;
    }
  } else {
    if (qctemp & 0x01) {
      class = 2;
    } else {
      class = 1;
    }
  }
  return class;
}


x86 assembly (clang, -O0):
<qc250a>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
lea    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x4,%edx
call   1030 <swab@plt>
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
and    $0x2,%eax
cmp    $0x0,%eax
je     116f <qc250a+0x5f>
mov    -0x10(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1163 <qc250a+0x53>
movl   $0x4,-0x14(%rbp)
jmp    116a <qc250a+0x5a>
movl   $0x3,-0x14(%rbp)
jmp    1196 <qc250a+0x86>
mov    -0x10(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     118a <qc250a+0x7a>
movl   $0x2,-0x14(%rbp)
jmp    1191 <qc250a+0x81>
movl   $0x1,-0x14(%rbp)
jmp    1196 <qc250a+0x86>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<qc250a>:
push   %rax
mov    %edi,0x4(%rsp)
lea    0x4(%rsp),%rdi
mov    %rsp,%rsi
mov    $0x4,%edx
call   1030 <swab@plt>
mov    (%rsp),%eax
and    $0x3,%eax
add    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @qc250a(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %2
%7 = load i32, i32* %2
store i32 %7, i32* %3
%8 = call i32 @swab(i32* %3, i32* %4, i32 4)
%9 = load i32, i32* %4
store i32 %9, i32* %5
%10 = load i32, i32* %5
%11 = and i32 %10, 2
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %20
13: ; preds = %1
%14 = load i32, i32* %5
%15 = and i32 %14, 1
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %13
store i32 4, i32* %6
br label %19
18: ; preds = %13
store i32 3, i32* %6
br label %19
19: ; preds = %18, %17
br label %27
20: ; preds = %1
%21 = load i32, i32* %5
%22 = and i32 %21, 1
%23 = icmp ne i32 %22, 0
br i1 %23, label %24, label %25
24: ; preds = %20
store i32 2, i32* %6
br label %26
25: ; preds = %20
store i32 1, i32* %6
br label %26
26: ; preds = %25, %24
br label %27
27: ; preds = %26, %19
%28 = load i32, i32* %6
ret i32 %28
}

LLVM IR (-O2):
define i32 @qc250a(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %2 to i8*
%5 = bitcast i32* %3 to i8*
store i32 %0, i32* %2
%6 = call i32 @swab(i32* %2, i32* %3, i32 4)
%7 = load i32, i32* %3
%8 = and i32 %7, 2
%9 = icmp eq i32 %8, 0
%10 = and i32 %7, 1
%11 = icmp eq i32 %10, 0
%12 = select i1 %11, i32 3, i32 4
%13 = select i1 %11, i32 1, i32 2
%14 = select i1 %9, i32 %13, i32 %12
ret i32 %14
}