#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*/ printf(char *, ...);
int ec_method_decode_matrix_ftw(int k, int max, int *count, int error_count,
                                unsigned char *src_in_err) {
  int i, j;
  for (i = k + 1; i < max; i++) {
    (*count)++;
    src_in_err[i] = '1';
    if ((*count) == error_count) {
      ({
        int i;
        printf("%d==>", *count);
        for (i = 0; i < max; i++) {
          printf("%c", src_in_err[i]);
        }
        printf("\n");
      });
      (*count)--;
      src_in_err[i] = '0';
      continue;
    } else {
      ec_method_decode_matrix_ftw(i, max, count, error_count, src_in_err);
      src_in_err[i] = '0';
      (*count)--;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<ec_method_decode_matrix_ftw>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8,-0x20(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1230 <ec_method_decode_matrix_ftw+0x110>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
movb   $0x31,(%rax,%rcx,1)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
cmp    -0x14(%rbp),%eax
jne    11f0 <ec_method_decode_matrix_ftw+0xd0>
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
lea    0xe7f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11c3 <ec_method_decode_matrix_ftw+0xa3>
mov    -0x20(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movzbl (%rax,%rcx,1),%esi
lea    0xe58(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    118f <ec_method_decode_matrix_ftw+0x6f>
lea    0xe3f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    %eax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0xffffffff,%ecx
mov    %ecx,(%rax)
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
movb   $0x30,(%rax,%rcx,1)
jmp    1222 <ec_method_decode_matrix_ftw+0x102>
mov    -0x24(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%ecx
mov    -0x20(%rbp),%r8
call   1040 <ec_method_decode_matrix_ftw@plt>
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
movb   $0x30,(%rax,%rcx,1)
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0xffffffff,%ecx
mov    %ecx,(%rax)
jmp    1222 <ec_method_decode_matrix_ftw+0x102>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1142 <ec_method_decode_matrix_ftw+0x22>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ec_method_decode_matrix_ftw>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
add    $0x1,%edi
cmp    %esi,%edi
jge    11dd <ec_method_decode_matrix_ftw+0xad>
mov    %r8,%rbx
mov    %ecx,%r14d
mov    %rdx,%r12
mov    %esi,%r15d
movslq %edi,%rbp
mov    %esi,%r13d
mov    %ecx,0x4(%rsp)
jmp    1185 <ec_method_decode_matrix_ftw+0x55>
xchg   %ax,%ax
mov    %ebp,%edi
mov    %r15d,%esi
mov    %r12,%rdx
mov    %r14d,%ecx
mov    %rbx,%r8
call   1050 <ec_method_decode_matrix_ftw@plt>
movb   $0x30,(%rbx,%rbp,1)
addl   $0xffffffff,(%r12)
add    $0x1,%rbp
cmp    %r15d,%ebp
je     11dd <ec_method_decode_matrix_ftw+0xad>
addl   $0x1,(%r12)
movb   $0x31,(%rbx,%rbp,1)
cmp    %r14d,(%r12)
jne    1160 <ec_method_decode_matrix_ftw+0x30>
lea    0xe65(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
test   %r15d,%r15d
jle    11c3 <ec_method_decode_matrix_ftw+0x93>
xor    %r14d,%r14d
nopl   (%rax)
movzbl (%rbx,%r14,1),%edi
call   1030 <putchar@plt>
add    $0x1,%r14
cmp    %r14,%r13
jne    11b0 <ec_method_decode_matrix_ftw+0x80>
mov    $0xa,%edi
call   1030 <putchar@plt>
addl   $0xffffffff,(%r12)
movb   $0x30,(%rbx,%rbp,1)
mov    0x4(%rsp),%r14d
jmp    117c <ec_method_decode_matrix_ftw+0x4c>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%d==>\00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [2 x i8] c"\0A\00"
define i32 @ec_method_decode_matrix_ftw(i32 %0, i32 %1, i32* %2, i32 %3, i8* %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32*
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
store i32 %0, i32* %6
store i32 %1, i32* %7
store i32* %2, i32** %8
store i32 %3, i32* %9
store i8* %4, i8** %10
%15 = load i32, i32* %6
%16 = add nsw i32 %15, 1
store i32 %16, i32* %11
br label %17
17: ; preds = %77, %5
%18 = load i32, i32* %11
%19 = load i32, i32* %7
%20 = icmp slt i32 %18, %19
br i1 %20, label %21, label %80
21: ; preds = %17
%22 = load i32*, i32** %8
%23 = load i32, i32* %22
%24 = add nsw i32 %23, 1
store i32 %24, i32* %22
%25 = load i8*, i8** %10
%26 = load i32, i32* %11
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i8, i8* %25, i64 %27
store i8 49, i8* %28
%29 = load i32*, i32** %8
%30 = load i32, i32* %29
%31 = load i32, i32* %9
%32 = icmp eq i32 %30, %31
br i1 %32, label %33, label %62
33: ; preds = %21
%34 = load i32*, i32** %8
%35 = load i32, i32* %34
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %35)
store i32 0, i32* %13
br label %37
37: ; preds = %49, %33
%38 = load i32, i32* %13
%39 = load i32, i32* %7
%40 = icmp slt i32 %38, %39
br i1 %40, label %41, label %52
41: ; preds = %37
%42 = load i8*, i8** %10
%43 = load i32, i32* %13
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds i8, i8* %42, i64 %44
%46 = load i8, i8* %45
%47 = zext i8 %46 to i32
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %47)
br label %49
49: ; preds = %41
%50 = load i32, i32* %13
%51 = add nsw i32 %50, 1
store i32 %51, i32* %13
br label %37
52: ; preds = %37
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32 %53, i32* %14
%54 = load i32, i32* %14
%55 = load i32*, i32** %8
%56 = load i32, i32* %55
%57 = add nsw i32 %56, -1
store i32 %57, i32* %55
%58 = load i8*, i8** %10
%59 = load i32, i32* %11
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds i8, i8* %58, i64 %60
store i8 48, i8* %61
br label %77
62: ; preds = %21
%63 = load i32, i32* %11
%64 = load i32, i32* %7
%65 = load i32*, i32** %8
%66 = load i32, i32* %9
%67 = load i8*, i8** %10
%68 = call i32 @ec_method_decode_matrix_ftw(i32 %63, i32 %64, i32* %65, i32 %66, i8* %67)
%69 = load i8*, i8** %10
%70 = load i32, i32* %11
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds i8, i8* %69, i64 %71
store i8 48, i8* %72
%73 = load i32*, i32** %8
%74 = load i32, i32* %73
%75 = add nsw i32 %74, -1
store i32 %75, i32* %73
br label %76
76: ; preds = %62
br label %77
77: ; preds = %76, %52
%78 = load i32, i32* %11
%79 = add nsw i32 %78, 1
store i32 %79, i32* %11
br label %17
80: ; preds = %17
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"%d==>\00"
define i32 @ec_method_decode_matrix_ftw(i32 %0, i32 %1, i32* nocapture %2, i32 %3, i8* nocapture %4) {
%6 = add i32 %0, 1
%7 = icmp slt i32 %6, %1
br i1 %7, label %8, label %42
8: ; preds = %5
%9 = icmp sgt i32 %1, 0
%10 = sext i32 %6 to i64
%11 = zext i32 %1 to i64
br label %12
12: ; preds = %8, %38
%13 = phi i64 [ %10, %8 ], [ %39, %38 ]
%14 = load i32, i32* %2
%15 = add nsw i32 %14, 1
store i32 %15, i32* %2
%16 = getelementptr inbounds i8, i8* %4, i64 %13
store i8 49, i8* %16
%17 = load i32, i32* %2
%18 = icmp eq i32 %17, %3
br i1 %18, label %19, label %33
19: ; preds = %12
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %3)
br i1 %9, label %21, label %29
21: ; preds = %19, %21
%22 = phi i64 [ %27, %21 ], [ 0, %19 ]
%23 = getelementptr inbounds i8, i8* %4, i64 %22
%24 = load i8, i8* %23
%25 = zext i8 %24 to i32
%26 = tail call i32 @putchar(i32 %25)
%27 = add nuw nsw i64 %22, 1
%28 = icmp eq i64 %27, %11
br i1 %28, label %29, label %21
29: ; preds = %21, %19
%30 = tail call i32 @putchar(i32 10)
%31 = load i32, i32* %2
%32 = add nsw i32 %31, -1
store i32 %32, i32* %2
store i8 48, i8* %16
br label %38
33: ; preds = %12
%34 = trunc i64 %13 to i32
%35 = tail call i32 @ec_method_decode_matrix_ftw(i32 %34, i32 %1, i32* %2, i32 %3, i8* %4)
store i8 48, i8* %16
%36 = load i32, i32* %2
%37 = add nsw i32 %36, -1
store i32 %37, i32* %2
br label %38
38: ; preds = %33, %29
%39 = add nsw i64 %13, 1
%40 = trunc i64 %39 to i32
%41 = icmp eq i32 %40, %1
br i1 %41, label %42, label %12
42: ; preds = %38, %5
ret i32 0
}