#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 */
typedef int /*<<< orphan*/ out_buf;

/* Variables and functions */
int apply_rule_cpu(char *, int /*<<< orphan*/, char *, int /*<<< orphan*/,
                   char *);
scalar_t__ memcmp(char *, char *, int);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strlen(char *);
int process_block(int o[64], char *block_ptr[64], int block_cnt, char *word_buf,
                  char final_buf[64], int final_len, char rule_buf[64]) {
  int last_o = o[0];
  for (int i = 1; i < block_cnt; i++) {
    if (o[i] < last_o)
      return (0);
  }
  memset(rule_buf, 0, 64);
  strcat(rule_buf, block_ptr[o[0]]);
  int i;
  for (i = 1; i < block_cnt; i++) {
    strcat(rule_buf, " ");
    strcat(rule_buf, block_ptr[o[i]]);
  }
  char out_buf[64];
  memset(out_buf, 0, sizeof(out_buf));
  int out_len = apply_rule_cpu(rule_buf, strlen(rule_buf), word_buf,
                               strlen(word_buf), out_buf);
  if (out_len == final_len) {
    if (memcmp(final_buf, out_buf, out_len) == 0)
      return (1);
  }
  return 0;
}


x86 assembly (clang, -O0):
<process_block>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    0x10(%rbp),%rax
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    %r9d,-0x34(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x38(%rbp)
movl   $0x1,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    11c5 <process_block+0x75>
mov    -0x10(%rbp),%rax
movslq -0x3c(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
cmp    -0x38(%rbp),%eax
jge    11b2 <process_block+0x62>
movl   $0x0,-0x4(%rbp)
jmp    12e2 <process_block+0x192>
jmp    11b7 <process_block+0x67>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    1186 <process_block+0x36>
mov    0x10(%rbp),%rdi
xor    %esi,%esi
mov    $0x40,%edx
call   1040 <memset@plt>
mov    0x10(%rbp),%rdi
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rsi
call   1060 <strcat@plt>
movl   $0x1,-0x40(%rbp)
mov    -0x40(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    123b <process_block+0xeb>
mov    0x10(%rbp),%rdi
lea    0xdf5(%rip),%rsi
call   1060 <strcat@plt>
mov    0x10(%rbp),%rdi
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%rcx
movslq -0x40(%rbp),%rdx
movslq (%rcx,%rdx,4),%rcx
mov    (%rax,%rcx,8),%rsi
call   1060 <strcat@plt>
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    11f4 <process_block+0xa4>
lea    -0x80(%rbp),%rdi
xor    %esi,%esi
mov    $0x40,%edx
call   1040 <memset@plt>
mov    0x10(%rbp),%rax
mov    %rax,-0xa0(%rbp)
mov    0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x94(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x90(%rbp)
mov    -0x28(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0xa0(%rbp),%rdi
mov    -0x94(%rbp),%esi
mov    -0x90(%rbp),%rdx
mov    %eax,%ecx
lea    -0x80(%rbp),%r8
call   1070 <apply_rule_cpu@plt>
mov    %eax,-0x84(%rbp)
mov    -0x84(%rbp),%eax
cmp    -0x34(%rbp),%eax
jne    12db <process_block+0x18b>
mov    -0x30(%rbp),%rdi
lea    -0x80(%rbp),%rsi
mov    -0x84(%rbp),%edx
call   1050 <memcmp@plt>
cmp    $0x0,%rax
jne    12d6 <process_block+0x186>
movl   $0x1,-0x4(%rbp)
jmp    12e2 <process_block+0x192>
jmp    12db <process_block+0x18b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<process_block>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
mov    %rsi,%rbx
mov    %rdi,%rbp
mov    0xa0(%rsp),%r13
cmp    $0x2,%edx
jl     1217 <process_block+0xc7>
mov    %edx,%r14d
mov    0x0(%rbp),%eax
mov    %edx,%r15d
mov    $0x1,%edx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
cmp    %eax,0x0(%rbp,%rdx,4)
jl     12a9 <process_block+0x159>
add    $0x1,%rdx
cmp    %rdx,%r15
jne    1190 <process_block+0x40>
mov    %rcx,0x18(%rsp)
mov    %r8,0x10(%rsp)
mov    %r9d,0xc(%rsp)
mov    %r13,%rdi
xor    %esi,%esi
mov    $0x40,%edx
call   1040 <memset@plt>
movslq 0x0(%rbp),%rax
mov    (%rbx,%rax,8),%rsi
mov    %r13,%rdi
call   1060 <strcat@plt>
cmp    $0x2,%r14d
jl     1245 <process_block+0xf5>
mov    $0x1,%r12d
lea    0xe1c(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r13,%rdi
mov    %r14,%rsi
call   1060 <strcat@plt>
movslq 0x0(%rbp,%r12,4),%rax
mov    (%rbx,%rax,8),%rsi
mov    %r13,%rdi
call   1060 <strcat@plt>
add    $0x1,%r12
cmp    %r12,%r15
jne    11f0 <process_block+0xa0>
jmp    1245 <process_block+0xf5>
mov    %rcx,0x18(%rsp)
mov    %r8,0x10(%rsp)
mov    %r9d,0xc(%rsp)
mov    %r13,%rdi
xor    %esi,%esi
mov    $0x40,%edx
call   1040 <memset@plt>
movslq 0x0(%rbp),%rax
mov    (%rbx,%rax,8),%rsi
mov    %r13,%rdi
call   1060 <strcat@plt>
lea    0x20(%rsp),%r14
xor    %r15d,%r15d
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x40,%edx
call   1040 <memset@plt>
mov    %r13,%rdi
call   1030 <strlen@plt>
mov    %eax,%ebp
mov    0x18(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %r13,%rdi
mov    %ebp,%esi
mov    %rbx,%rdx
mov    %eax,%ecx
mov    %r14,%r8
call   1070 <apply_rule_cpu@plt>
mov    0xc(%rsp),%edx
cmp    %edx,%eax
jne    12ac <process_block+0x15c>
lea    0x20(%rsp),%rsi
mov    0x10(%rsp),%rdi
call   1050 <memcmp@plt>
test   %rax,%rax
jne    12ac <process_block+0x15c>
mov    $0x1,%r15d
jmp    12ac <process_block+0x15c>
xor    %r15d,%r15d
mov    %r15d,%eax
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [2 x i8] c" \00"
define i32 @process_block(i32* nocapture %0, i8** nocapture %1, i32 %2, i8* %3, i8* %4, i32 %5, i8* %6) {
%8 = alloca [64 x i8]
%9 = load i32, i32* %0
%10 = icmp sgt i32 %2, 1
br i1 %10, label %11, label %41
11: ; preds = %7
%12 = zext i32 %2 to i64
br label %15
13: ; preds = %15
%14 = icmp eq i64 %20, %12
br i1 %14, label %21, label %15
15: ; preds = %11, %13
%16 = phi i64 [ 1, %11 ], [ %20, %13 ]
%17 = getelementptr inbounds i32, i32* %0, i64 %16
%18 = load i32, i32* %17
%19 = icmp slt i32 %18, %9
%20 = add nuw nsw i64 %16, 1
br i1 %19, label %61, label %13
21: ; preds = %13
%22 = tail call i32 @memset(i8* %6, i32 0, i32 64)
%23 = load i32, i32* %0
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8*, i8** %1, i64 %24
%26 = load i8*, i8** %25
%27 = tail call i32 @strcat(i8* %6, i8* %26)
br i1 %10, label %28, label %48
28: ; preds = %21
%29 = zext i32 %2 to i64
br label %30
30: ; preds = %28, %30
%31 = phi i64 [ 1, %28 ], [ %39, %30 ]
%32 = tail call i32 @strcat(i8* %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%33 = getelementptr inbounds i32, i32* %0, i64 %31
%34 = load i32, i32* %33
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds i8*, i8** %1, i64 %35
%37 = load i8*, i8** %36
%38 = tail call i32 @strcat(i8* %6, i8* %37)
%39 = add nuw nsw i64 %31, 1
%40 = icmp eq i64 %39, %29
br i1 %40, label %48, label %30
41: ; preds = %7
%42 = tail call i32 @memset(i8* %6, i32 0, i32 64)
%43 = load i32, i32* %0
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds i8*, i8** %1, i64 %44
%46 = load i8*, i8** %45
%47 = tail call i32 @strcat(i8* %6, i8* %46)
br label %48
48: ; preds = %30, %41, %21
%49 = getelementptr inbounds [64 x i8], [64 x i8]* %8, i64 0, i64 0
%50 = call i32 @memset(i8* %49, i32 0, i32 64)
%51 = call i32 @strlen(i8* %6)
%52 = call i32 @strlen(i8* %3)
%53 = call i32 @apply_rule_cpu(i8* %6, i32 %51, i8* %3, i32 %52, i8* %49)
%54 = icmp eq i32 %53, %5
br i1 %54, label %55, label %58
55: ; preds = %48
%56 = call i64 @memcmp(i8* %4, i8* %49, i32 %5)
%57 = icmp eq i64 %56, 0
br i1 %57, label %59, label %58
58: ; preds = %55, %48
br label %59
59: ; preds = %55, %58
%60 = phi i32 [ 0, %58 ], [ 1, %55 ]
br label %61
61: ; preds = %15, %59
%62 = phi i32 [ %60, %59 ], [ 0, %15 ]
ret i32 %62
}