#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 GetRuleByte(int, int);
int /*<<< orphan*/ printf(char *, ...);
void PrintRule(int offset) {
  int i = 1;
  unsigned char A = 0;
  printf("Applying rule: ");
  do {
    A = GetRuleByte(offset, i);
    if ((A & 127) == '=')
      printf(" -> ");
    else
      printf("%c", A & 127);
    i++;
  } while ((A & 128) == 0);
  printf("\n");
}


x86 assembly (clang, -O0):
<PrintRule>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
movb   $0x0,-0x9(%rbp)
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1040 <GetRuleByte@plt>
mov    %al,-0x9(%rbp)
movzbl -0x9(%rbp),%eax
and    $0x7f,%eax
cmp    $0x3d,%eax
jne    1175 <PrintRule+0x55>
lea    0xea7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    118a <PrintRule+0x6a>
movzbl -0x9(%rbp),%esi
and    $0x7f,%esi
lea    0xe92(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
movzbl -0x9(%rbp),%eax
and    $0x80,%eax
cmp    $0x0,%eax
je     1144 <PrintRule+0x24>
lea    0xe6c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PrintRule>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edi,%r15d
lea    0xebf(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1,%ebp
lea    0xebc(%rip),%r14
jmp    116d <PrintRule+0x3d>
cs nopw 0x0(%rax,%rax,1)
call   1030 <putchar@plt>
add    $0x1,%ebp
test   $0x80,%bl
jne    1190 <PrintRule+0x60>
mov    %r15d,%edi
mov    %ebp,%esi
call   1050 <GetRuleByte@plt>
mov    %eax,%ebx
movzbl %al,%edi
and    $0x7f,%edi
cmp    $0x3d,%edi
jne    1160 <PrintRule+0x30>
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1165 <PrintRule+0x35>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [16 x i8] c"Applying rule: \00"
@.str.1 = [5 x i8] c" -> \00"
@.str.2 = [3 x i8] c"%c\00"
@.str.3 = [2 x i8] c"\0A\00"
define void @PrintRule(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8
store i32 %0, i32* %2
store i32 1, i32* %3
store i8 0, i8* %4
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %24, %1
%7 = load i32, i32* %2
%8 = load i32, i32* %3
%9 = call zeroext i8 @GetRuleByte(i32 %7, i32 %8)
store i8 %9, i8* %4
%10 = load i8, i8* %4
%11 = zext i8 %10 to i32
%12 = and i32 %11, 127
%13 = icmp eq i32 %12, 61
br i1 %13, label %14, label %16
14: ; preds = %6
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %21
16: ; preds = %6
%17 = load i8, i8* %4
%18 = zext i8 %17 to i32
%19 = and i32 %18, 127
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %19)
br label %21
21: ; preds = %16, %14
%22 = load i32, i32* %3
%23 = add nsw i32 %22, 1
store i32 %23, i32* %3
br label %24
24: ; preds = %21
%25 = load i8, i8* %4
%26 = zext i8 %25 to i32
%27 = and i32 %26, 128
%28 = icmp eq i32 %27, 0
br i1 %28, label %6, label %29
29: ; preds = %24
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"Applying rule: \00"
@.str.1 = [5 x i8] c" -> \00"
define void @PrintRule(i32 %0) {
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
br label %3
3: ; preds = %13, %1
%4 = phi i32 [ 1, %1 ], [ %14, %13 ]
%5 = tail call zeroext i8 @GetRuleByte(i32 %0, i32 %4)
%6 = zext i8 %5 to i32
%7 = and i32 %6, 127
%8 = icmp eq i32 %7, 61
br i1 %8, label %9, label %11
9: ; preds = %3
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %13
11: ; preds = %3
%12 = tail call i32 @putchar(i32 %7)
br label %13
13: ; preds = %11, %9
%14 = add nuw nsw i32 %4, 1
%15 = and i32 %6, 128
%16 = icmp eq i32 %15, 0
br i1 %16, label %3, label %17
17: ; preds = %13
%18 = tail call i32 @putchar(i32 10)
ret void
}