#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*/ do_bch_correct_data(unsigned char *, int *);
int do_bch_decode(unsigned char *, unsigned char *, int *, int);
int /*<<< orphan*/ printk(char *);
void do_bch_decode_and_correct(unsigned char *inbuf, unsigned char *paritybuf,
                               int len) {
  int flag, errpos[64];
  flag = do_bch_decode(inbuf, paritybuf, errpos, len);
  if (flag == 1) {
    if (errpos[0] != 0) {
      do_bch_correct_data(inbuf, errpos);
    }
  } else
    printk("{Software bch_decode: uncorrect error}\n");
}


x86 assembly (clang, -O0):
<do_bch_decode_and_correct>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0x120(%rbp),%rdx
mov    -0x14(%rbp),%ecx
call   1050 <do_bch_decode@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x1,-0x18(%rbp)
jne    118c <do_bch_decode_and_correct+0x5c>
cmpl   $0x0,-0x120(%rbp)
je     1187 <do_bch_decode_and_correct+0x57>
mov    -0x8(%rbp),%rdi
lea    -0x120(%rbp),%rsi
call   1040 <do_bch_correct_data@plt>
jmp    1198 <do_bch_decode_and_correct+0x68>
lea    0xe6d(%rip),%rdi
call   1030 <printk@plt>
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_bch_decode_and_correct>:
push   %rbx
sub    $0x100,%rsp
mov    %edx,%ecx
mov    %rdi,%rbx
mov    %rsp,%rdx
call   1050 <do_bch_decode@plt>
cmp    $0x1,%eax
jne    115d <do_bch_decode_and_correct+0x2d>
cmpl   $0x0,(%rsp)
je     1169 <do_bch_decode_and_correct+0x39>
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1040 <do_bch_correct_data@plt>
jmp    1169 <do_bch_decode_and_correct+0x39>
lea    0xe9c(%rip),%rdi
call   1030 <printk@plt>
add    $0x100,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [40 x i8] c"{Software bch_decode: uncorrect error}\0A\00"
define void @do_bch_decode_and_correct(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca [64 x i32]
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%9 = load i8*, i8** %4
%10 = load i8*, i8** %5
%11 = getelementptr inbounds [64 x i32], [64 x i32]* %8, i64 0, i64 0
%12 = load i32, i32* %6
%13 = call i32 @do_bch_decode(i8* %9, i8* %10, i32* %11, i32 %12)
store i32 %13, i32* %7
%14 = load i32, i32* %7
%15 = icmp eq i32 %14, 1
br i1 %15, label %16, label %25
16: ; preds = %3
%17 = getelementptr inbounds [64 x i32], [64 x i32]* %8, i64 0, i64 0
%18 = load i32, i32* %17
%19 = icmp ne i32 %18, 0
br i1 %19, label %20, label %24
20: ; preds = %16
%21 = load i8*, i8** %4
%22 = getelementptr inbounds [64 x i32], [64 x i32]* %8, i64 0, i64 0
%23 = call i32 @do_bch_correct_data(i8* %21, i32* %22)
br label %24
24: ; preds = %20, %16
br label %27
25: ; preds = %3
%26 = call i32 @printk(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
br label %27
27: ; preds = %25, %24
ret void
}

LLVM IR (-O2):
@.str = [40 x i8] c"{Software bch_decode: uncorrect error}\0A\00"
define void @do_bch_decode_and_correct(i8* %0, i8* %1, i32 %2) {
%4 = alloca [64 x i32]
%5 = bitcast [64 x i32]* %4 to i8*
%6 = getelementptr inbounds [64 x i32], [64 x i32]* %4, i64 0, i64 0
%7 = call i32 @do_bch_decode(i8* %0, i8* %1, i32* %6, i32 %2)
%8 = icmp eq i32 %7, 1
br i1 %8, label %9, label %14
9: ; preds = %3
%10 = load i32, i32* %6
%11 = icmp eq i32 %10, 0
br i1 %11, label %16, label %12
12: ; preds = %9
%13 = call i32 @do_bch_correct_data(i8* %0, i32* %6)
br label %16
14: ; preds = %3
%15 = call i32 @printk(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
br label %16
16: ; preds = %9, %12, %14
ret void
}