#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*/ USBSTK5515_GPIO_setOutput(int, int);
short USBSTK5515_ULED_setall(unsigned short pattern) {
  if (pattern & 0x01)
    USBSTK5515_GPIO_setOutput(14, 1);
  else
    USBSTK5515_GPIO_setOutput(14, 0);
  if (pattern & 0x02)
    USBSTK5515_GPIO_setOutput(15, 1);
  else
    USBSTK5515_GPIO_setOutput(15, 0);
  if (pattern & 0x04)
    USBSTK5515_GPIO_setOutput(16, 1);
  else
    USBSTK5515_GPIO_setOutput(16, 0);
  if (pattern & 0x08)
    USBSTK5515_GPIO_setOutput(17, 1);
  else
    USBSTK5515_GPIO_setOutput(17, 0);
  return 0;
}


x86 assembly (clang, -O0):
<USBSTK5515_ULED_setall>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1143 <USBSTK5515_ULED_setall+0x33>
mov    $0xe,%edi
mov    $0x1,%esi
call   1030 <USBSTK5515_GPIO_setOutput@plt>
jmp    114f <USBSTK5515_ULED_setall+0x3f>
mov    $0xe,%edi
xor    %esi,%esi
call   1030 <USBSTK5515_GPIO_setOutput@plt>
movzwl -0x2(%rbp),%eax
and    $0x2,%eax
cmp    $0x0,%eax
je     1173 <USBSTK5515_ULED_setall+0x63>
mov    $0xf,%edi
mov    $0x1,%esi
call   1030 <USBSTK5515_GPIO_setOutput@plt>
jmp    117f <USBSTK5515_ULED_setall+0x6f>
mov    $0xf,%edi
xor    %esi,%esi
call   1030 <USBSTK5515_GPIO_setOutput@plt>
movzwl -0x2(%rbp),%eax
and    $0x4,%eax
cmp    $0x0,%eax
je     11a3 <USBSTK5515_ULED_setall+0x93>
mov    $0x10,%edi
mov    $0x1,%esi
call   1030 <USBSTK5515_GPIO_setOutput@plt>
jmp    11af <USBSTK5515_ULED_setall+0x9f>
mov    $0x10,%edi
xor    %esi,%esi
call   1030 <USBSTK5515_GPIO_setOutput@plt>
movzwl -0x2(%rbp),%eax
and    $0x8,%eax
cmp    $0x0,%eax
je     11d3 <USBSTK5515_ULED_setall+0xc3>
mov    $0x11,%edi
mov    $0x1,%esi
call   1030 <USBSTK5515_GPIO_setOutput@plt>
jmp    11df <USBSTK5515_ULED_setall+0xcf>
mov    $0x11,%edi
xor    %esi,%esi
call   1030 <USBSTK5515_GPIO_setOutput@plt>
xor    %eax,%eax
cwtl
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<USBSTK5515_ULED_setall>:
push   %rbx
mov    %edi,%ebx
mov    %edi,%esi
and    $0x1,%esi
mov    $0xe,%edi
call   1030 <USBSTK5515_GPIO_setOutput@plt>
mov    %ebx,%esi
shr    %esi
and    $0x1,%esi
mov    $0xf,%edi
call   1030 <USBSTK5515_GPIO_setOutput@plt>
mov    %ebx,%esi
shr    $0x2,%esi
and    $0x1,%esi
mov    $0x10,%edi
call   1030 <USBSTK5515_GPIO_setOutput@plt>
shr    $0x3,%ebx
and    $0x1,%ebx
mov    $0x11,%edi
mov    %ebx,%esi
call   1030 <USBSTK5515_GPIO_setOutput@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define signext i16 @USBSTK5515_ULED_setall(i16 zeroext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = zext i16 %3 to i32
%5 = and i32 %4, 1
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = call i32 @USBSTK5515_GPIO_setOutput(i32 14, i32 1)
br label %11
9: ; preds = %1
%10 = call i32 @USBSTK5515_GPIO_setOutput(i32 14, i32 0)
br label %11
11: ; preds = %9, %7
%12 = load i16, i16* %2
%13 = zext i16 %12 to i32
%14 = and i32 %13, 2
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %11
%17 = call i32 @USBSTK5515_GPIO_setOutput(i32 15, i32 1)
br label %20
18: ; preds = %11
%19 = call i32 @USBSTK5515_GPIO_setOutput(i32 15, i32 0)
br label %20
20: ; preds = %18, %16
%21 = load i16, i16* %2
%22 = zext i16 %21 to i32
%23 = and i32 %22, 4
%24 = icmp ne i32 %23, 0
br i1 %24, label %25, label %27
25: ; preds = %20
%26 = call i32 @USBSTK5515_GPIO_setOutput(i32 16, i32 1)
br label %29
27: ; preds = %20
%28 = call i32 @USBSTK5515_GPIO_setOutput(i32 16, i32 0)
br label %29
29: ; preds = %27, %25
%30 = load i16, i16* %2
%31 = zext i16 %30 to i32
%32 = and i32 %31, 8
%33 = icmp ne i32 %32, 0
br i1 %33, label %34, label %36
34: ; preds = %29
%35 = call i32 @USBSTK5515_GPIO_setOutput(i32 17, i32 1)
br label %38
36: ; preds = %29
%37 = call i32 @USBSTK5515_GPIO_setOutput(i32 17, i32 0)
br label %38
38: ; preds = %36, %34
ret i16 0
}

LLVM IR (-O2):
define signext i16 @USBSTK5515_ULED_setall(i16 zeroext %0) {
%2 = zext i16 %0 to i32
%3 = and i32 %2, 1
%4 = tail call i32 @USBSTK5515_GPIO_setOutput(i32 14, i32 %3)
%5 = lshr i32 %2, 1
%6 = and i32 %5, 1
%7 = tail call i32 @USBSTK5515_GPIO_setOutput(i32 15, i32 %6)
%8 = lshr i32 %2, 2
%9 = and i32 %8, 1
%10 = tail call i32 @USBSTK5515_GPIO_setOutput(i32 16, i32 %9)
%11 = lshr i32 %2, 3
%12 = and i32 %11, 1
%13 = tail call i32 @USBSTK5515_GPIO_setOutput(i32 17, i32 %12)
ret i16 0
}