#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 owTouchByte(unsigned char);
int /*<<< orphan*/ owTouchReset();
unsigned char owBlock(unsigned char do_reset, unsigned char *tran_buf,
                      unsigned char tran_len) {
  int i;
  if (tran_len > 64)
    return 0;
  if (do_reset) {
    if (!owTouchReset())
      return 0;
  }
  for (i = 0; i < tran_len; i++)
    tran_buf[i] = owTouchByte(tran_buf[i]);
  return 1;
}


x86 assembly (clang, -O0):
<owBlock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dl,%al
mov    %dil,%cl
mov    %cl,-0x2(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
movzbl -0x11(%rbp),%eax
cmp    $0x40,%eax
jle    114d <owBlock+0x2d>
movb   $0x0,-0x1(%rbp)
jmp    11bb <owBlock+0x9b>
cmpb   $0x0,-0x2(%rbp)
je     1175 <owBlock+0x55>
mov    $0x0,%al
call   1040 <owTouchReset@plt>
cmp    $0x0,%eax
jne    1170 <owBlock+0x50>
movb   $0x0,-0x1(%rbp)
jmp    11bb <owBlock+0x9b>
jmp    1175 <owBlock+0x55>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
movzbl -0x11(%rbp),%ecx
cmp    %ecx,%eax
jge    11b7 <owBlock+0x97>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movzbl (%rax,%rcx,1),%edi
call   1030 <owTouchByte@plt>
mov    %al,%dl
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    117c <owBlock+0x5c>
movb   $0x1,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<owBlock>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%ebp
cmp    $0x40,%bpl
jbe    1134 <owBlock+0x14>
xor    %r14d,%r14d
jmp    1175 <owBlock+0x55>
mov    %rsi,%rbx
test   %dil,%dil
je     114a <owBlock+0x2a>
xor    %r14d,%r14d
xor    %eax,%eax
call   1040 <owTouchReset@plt>
test   %eax,%eax
je     1175 <owBlock+0x55>
mov    $0x1,%r14b
test   %bpl,%bpl
je     1175 <owBlock+0x55>
movzbl %bpl,%r15d
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
movzbl (%rbx,%rbp,1),%edi
call   1030 <owTouchByte@plt>
mov    %al,(%rbx,%rbp,1)
add    $0x1,%rbp
cmp    %rbp,%r15
jne    1160 <owBlock+0x40>
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define zeroext i8 @owBlock(i8 zeroext %0, i8* %1, i8 zeroext %2) {
%4 = alloca i8
%5 = alloca i8
%6 = alloca i8*
%7 = alloca i8
%8 = alloca i32
store i8 %0, i8* %5
store i8* %1, i8** %6
store i8 %2, i8* %7
%9 = load i8, i8* %7
%10 = zext i8 %9 to i32
%11 = icmp sgt i32 %10, 64
br i1 %11, label %12, label %13
12: ; preds = %3
store i8 0, i8* %4
br label %42
13: ; preds = %3
%14 = load i8, i8* %5
%15 = icmp ne i8 %14, 0
br i1 %15, label %16, label %21
16: ; preds = %13
%17 = call i32 (...) @owTouchReset()
%18 = icmp ne i32 %17, 0
br i1 %18, label %20, label %19
19: ; preds = %16
store i8 0, i8* %4
br label %42
20: ; preds = %16
br label %21
21: ; preds = %20, %13
store i32 0, i32* %8
br label %22
22: ; preds = %38, %21
%23 = load i32, i32* %8
%24 = load i8, i8* %7
%25 = zext i8 %24 to i32
%26 = icmp slt i32 %23, %25
br i1 %26, label %27, label %41
27: ; preds = %22
%28 = load i8*, i8** %6
%29 = load i32, i32* %8
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i8, i8* %28, i64 %30
%32 = load i8, i8* %31
%33 = call zeroext i8 @owTouchByte(i8 zeroext %32)
%34 = load i8*, i8** %6
%35 = load i32, i32* %8
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds i8, i8* %34, i64 %36
store i8 %33, i8* %37
br label %38
38: ; preds = %27
%39 = load i32, i32* %8
%40 = add nsw i32 %39, 1
store i32 %40, i32* %8
br label %22
41: ; preds = %22
store i8 1, i8* %4
br label %42
42: ; preds = %41, %19, %12
%43 = load i8, i8* %4
ret i8 %43
}

LLVM IR (-O2):
define zeroext i8 @owBlock(i8 zeroext %0, i8* nocapture %1, i8 zeroext %2) {
%4 = icmp ugt i8 %2, 64
br i1 %4, label %21, label %5
5: ; preds = %3
%6 = icmp eq i8 %0, 0
br i1 %6, label %10, label %7
7: ; preds = %5
%8 = tail call i32 (...) @owTouchReset()
%9 = icmp eq i32 %8, 0
br i1 %9, label %21, label %10
10: ; preds = %7, %5
%11 = icmp eq i8 %2, 0
br i1 %11, label %21, label %12
12: ; preds = %10
%13 = zext i8 %2 to i64
br label %14
14: ; preds = %12, %14
%15 = phi i64 [ 0, %12 ], [ %19, %14 ]
%16 = getelementptr inbounds i8, i8* %1, i64 %15
%17 = load i8, i8* %16
%18 = tail call zeroext i8 @owTouchByte(i8 zeroext %17)
store i8 %18, i8* %16
%19 = add nuw nsw i64 %15, 1
%20 = icmp eq i64 %19, %13
br i1 %20, label %21, label %14
21: ; preds = %14, %10, %7, %3
%22 = phi i8 [ 0, %3 ], [ 0, %7 ], [ 1, %10 ], [ 1, %14 ]
ret i8 %22
}