#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 */
unsigned char decode_e(unsigned int, unsigned int, int);
int /*<<< orphan*/ dprintf(int, char *);
unsigned char code39_decode1(unsigned char enc, unsigned e, unsigned s) {
  unsigned char E = decode_e(e, s, 36);
  if (E > 7)
    return (0xff);
  enc <<= 1;
  if (E > 2) {
    enc |= 1;
    dprintf(2, "1");
  } else
    dprintf(2, "0");
  return (enc);
}


x86 assembly (clang, -O0):
<code39_decode1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x2(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    $0x24,%edx
call   1030 <decode_e@plt>
mov    %al,-0xd(%rbp)
movzbl -0xd(%rbp),%eax
cmp    $0x7,%eax
jle    115d <code39_decode1+0x3d>
movb   $0xff,-0x1(%rbp)
jmp    11ab <code39_decode1+0x8b>
movzbl -0x2(%rbp),%eax
shl    $0x1,%eax
mov    %al,-0x2(%rbp)
movzbl -0xd(%rbp),%eax
cmp    $0x2,%eax
jle    1194 <code39_decode1+0x74>
movzbl -0x2(%rbp),%eax
or     $0x1,%eax
mov    %al,-0x2(%rbp)
mov    $0x2,%edi
lea    0xe76(%rip),%rsi
call   1040 <dprintf@plt>
jmp    11a5 <code39_decode1+0x85>
mov    $0x2,%edi
lea    0xe62(%rip),%rsi
call   1040 <dprintf@plt>
mov    -0x2(%rbp),%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<code39_decode1>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
mov    %esi,%edi
mov    %edx,%esi
mov    $0x24,%edx
call   1030 <decode_e@plt>
mov    $0xff,%bl
cmp    $0x7,%al
ja     1160 <code39_decode1+0x40>
add    %bpl,%bpl
cmp    $0x3,%al
setae  %bl
lea    0xeb8(%rip),%rax
lea    0xeb3(%rip),%rsi
cmovae %rax,%rsi
or     %bpl,%bl
mov    $0x2,%edi
call   1040 <dprintf@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"1\00"
@.str.1 = [2 x i8] c"0\00"
define zeroext i8 @code39_decode1(i8 zeroext %0, i32 %1, i32 %2) {
%4 = alloca i8
%5 = alloca i8
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8
store i8 %0, i8* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
%9 = load i32, i32* %6
%10 = load i32, i32* %7
%11 = call zeroext i8 @decode_e(i32 %9, i32 %10, i32 36)
store i8 %11, i8* %8
%12 = load i8, i8* %8
%13 = zext i8 %12 to i32
%14 = icmp sgt i32 %13, 7
br i1 %14, label %15, label %16
15: ; preds = %3
store i8 -1, i8* %4
br label %34
16: ; preds = %3
%17 = load i8, i8* %5
%18 = zext i8 %17 to i32
%19 = shl i32 %18, 1
%20 = trunc i32 %19 to i8
store i8 %20, i8* %5
%21 = load i8, i8* %8
%22 = zext i8 %21 to i32
%23 = icmp sgt i32 %22, 2
br i1 %23, label %24, label %30
24: ; preds = %16
%25 = load i8, i8* %5
%26 = zext i8 %25 to i32
%27 = or i32 %26, 1
%28 = trunc i32 %27 to i8
store i8 %28, i8* %5
%29 = call i32 @dprintf(i32 2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %32
30: ; preds = %16
%31 = call i32 @dprintf(i32 2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %32
32: ; preds = %30, %24
%33 = load i8, i8* %5
store i8 %33, i8* %4
br label %34
34: ; preds = %32, %15
%35 = load i8, i8* %4
ret i8 %35
}

LLVM IR (-O2):
@.str = [2 x i8] c"1\00"
@.str.1 = [2 x i8] c"0\00"
define zeroext i8 @code39_decode1(i8 zeroext %0, i32 %1, i32 %2) {
%4 = tail call zeroext i8 @decode_e(i32 %1, i32 %2, i32 36)
%5 = icmp ugt i8 %4, 7
br i1 %5, label %13, label %6
6: ; preds = %3
%7 = shl i8 %0, 1
%8 = icmp ugt i8 %4, 2
%9 = select i1 %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0)
%10 = zext i1 %8 to i8
%11 = or i8 %7, %10
%12 = tail call i32 @dprintf(i32 2, i8* %9)
br label %13
13: ; preds = %6, %3
%14 = phi i8 [ -1, %3 ], [ %11, %6 ]
ret i8 %14
}