#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*/ resetFlag(int);
int /*<<< orphan*/ setFlag(int);
unsigned char sla(unsigned char value) {
  if (value & 0x80) {
    setFlag(4);
  } else {
    resetFlag(4);
  }
  resetFlag(6);
  resetFlag(5);
  value = value << 1;
  if (value) {
    resetFlag(7);
  } else {
    setFlag(7);
  }
  return value;
}


x86 assembly (clang, -O0):
<sla>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
and    $0x80,%eax
cmp    $0x0,%eax
je     114f <sla+0x2f>
mov    $0x4,%edi
call   1030 <setFlag@plt>
jmp    1159 <sla+0x39>
mov    $0x4,%edi
call   1040 <resetFlag@plt>
mov    $0x6,%edi
call   1040 <resetFlag@plt>
mov    $0x5,%edi
call   1040 <resetFlag@plt>
movzbl -0x1(%rbp),%eax
shl    $0x1,%eax
mov    %al,-0x1(%rbp)
cmpb   $0x0,-0x1(%rbp)
je     1190 <sla+0x70>
mov    $0x7,%edi
call   1040 <resetFlag@plt>
jmp    119a <sla+0x7a>
mov    $0x7,%edi
call   1030 <setFlag@plt>
movzbl -0x1(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sla>:
push   %rbx
mov    %edi,%ebx
mov    $0x4,%edi
test   %bl,%bl
js     1133 <sla+0x13>
call   1040 <resetFlag@plt>
jmp    1138 <sla+0x18>
call   1030 <setFlag@plt>
mov    $0x6,%edi
call   1040 <resetFlag@plt>
mov    $0x5,%edi
call   1040 <resetFlag@plt>
mov    $0x7,%edi
add    %bl,%bl
je     115c <sla+0x3c>
call   1040 <resetFlag@plt>
jmp    1161 <sla+0x41>
call   1030 <setFlag@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define zeroext i8 @sla(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = and i32 %4, 128
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = call i32 @setFlag(i32 4)
br label %11
9: ; preds = %1
%10 = call i32 @resetFlag(i32 4)
br label %11
11: ; preds = %9, %7
%12 = call i32 @resetFlag(i32 6)
%13 = call i32 @resetFlag(i32 5)
%14 = load i8, i8* %2
%15 = zext i8 %14 to i32
%16 = shl i32 %15, 1
%17 = trunc i32 %16 to i8
store i8 %17, i8* %2
%18 = load i8, i8* %2
%19 = icmp ne i8 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %11
%21 = call i32 @resetFlag(i32 7)
br label %24
22: ; preds = %11
%23 = call i32 @setFlag(i32 7)
br label %24
24: ; preds = %22, %20
%25 = load i8, i8* %2
ret i8 %25
}

LLVM IR (-O2):
define zeroext i8 @sla(i8 zeroext %0) {
%2 = icmp sgt i8 %0, -1
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @setFlag(i32 4)
br label %7
5: ; preds = %1
%6 = tail call i32 @resetFlag(i32 4)
br label %7
7: ; preds = %5, %3
%8 = tail call i32 @resetFlag(i32 6)
%9 = tail call i32 @resetFlag(i32 5)
%10 = shl i8 %0, 1
%11 = icmp eq i8 %10, 0
br i1 %11, label %14, label %12
12: ; preds = %7
%13 = tail call i32 @resetFlag(i32 7)
br label %16
14: ; preds = %7
%15 = tail call i32 @setFlag(i32 7)
br label %16
16: ; preds = %14, %12
ret i8 %10
}