#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 */
struct imap {
  int dummy;
};

/* Variables and functions */
scalar_t__ deltaOff(struct imap *, struct imap *, int);
scalar_t__ opeq(struct imap *, char *, int /*<<< orphan*/, int /*<<< orphan*/,
                int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
struct imap *prv(struct imap *);
void armhli(struct imap *ci) {
  struct imap *ppi, *pi;
  pi = prv(ci);
  ppi = prv(pi);
  if (opeq(ppi, "ldrb", 0, 0, 0) && opeq(pi, "ldrb", 0, 0, 0) &&
      opeq(ci, "orr", 0, 0, 0) && deltaOff(ppi, pi, 1)) {
    printf("loadw\n");
  }
  if (opeq(ppi, "mov", 0, 0, 0) && opeq(pi, "strb", 0, 0, 0) &&
      opeq(ci, "strb", 0, 0, 0) && deltaOff(pi, ci, 1)) {
    printf("storw.imm\n");
  }
  if (opeq(ppi, "strb", 0, 0, 0) && opeq(pi, "mov", 0, 0, 0) &&
      opeq(ci, "strb", 0, 0, 0) && deltaOff(ppi, ci, 1)) {
    printf("storw.reg\n");
  }
}


x86 assembly (clang, -O0):
<armhli>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <prv@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <prv@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe8f(%rip),%rsi
xor    %r8d,%r8d
mov    %r8d,%edx
mov    %r8d,%ecx
call   1060 <opeq@plt>
cmp    $0x0,%rax
je     11f7 <armhli+0xb7>
mov    -0x18(%rbp),%rdi
lea    0xe6c(%rip),%rsi
xor    %r8d,%r8d
mov    %r8d,%edx
mov    %r8d,%ecx
call   1060 <opeq@plt>
cmp    $0x0,%rax
je     11f7 <armhli+0xb7>
mov    -0x8(%rbp),%rdi
lea    0xe4e(%rip),%rsi
xor    %r8d,%r8d
mov    %r8d,%edx
mov    %r8d,%ecx
call   1060 <opeq@plt>
cmp    $0x0,%rax
je     11f7 <armhli+0xb7>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    $0x1,%edx
call   1030 <deltaOff@plt>
cmp    $0x0,%rax
je     11f7 <armhli+0xb7>
lea    0xe17(%rip),%rdi
call   1050 <printf@plt>
mov    -0x10(%rbp),%rdi
lea    0xe0e(%rip),%rsi
xor    %r8d,%r8d
mov    %r8d,%edx
mov    %r8d,%ecx
call   1060 <opeq@plt>
cmp    $0x0,%rax
je     1288 <armhli+0x148>
mov    -0x18(%rbp),%rdi
lea    0xdef(%rip),%rsi
xor    %r8d,%r8d
mov    %r8d,%edx
mov    %r8d,%ecx
call   1060 <opeq@plt>
cmp    $0x0,%rax
je     1288 <armhli+0x148>
mov    -0x8(%rbp),%rdi
lea    0xdcc(%rip),%rsi
xor    %r8d,%r8d
mov    %r8d,%edx
mov    %r8d,%ecx
call   1060 <opeq@plt>
cmp    $0x0,%rax
je     1288 <armhli+0x148>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    $0x1,%edx
call   1030 <deltaOff@plt>
cmp    $0x0,%rax
je     1288 <armhli+0x148>
lea    0xd96(%rip),%rdi
call   1050 <printf@plt>
mov    -0x10(%rbp),%rdi
lea    0xd81(%rip),%rsi
xor    %r8d,%r8d
mov    %r8d,%edx
mov    %r8d,%ecx
call   1060 <opeq@plt>
cmp    $0x0,%rax
je     1319 <armhli+0x1d9>
mov    -0x18(%rbp),%rdi
lea    0xd5a(%rip),%rsi
xor    %r8d,%r8d
mov    %r8d,%edx
mov    %r8d,%ecx
call   1060 <opeq@plt>
cmp    $0x0,%rax
je     1319 <armhli+0x1d9>
mov    -0x8(%rbp),%rdi
lea    0xd3b(%rip),%rsi
xor    %r8d,%r8d
mov    %r8d,%edx
mov    %r8d,%ecx
call   1060 <opeq@plt>
cmp    $0x0,%rax
je     1319 <armhli+0x1d9>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    $0x1,%edx
call   1030 <deltaOff@plt>
cmp    $0x0,%rax
je     1319 <armhli+0x1d9>
lea    0xd10(%rip),%rdi
call   1050 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<armhli>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
call   1050 <prv@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1050 <prv@plt>
mov    %rax,%r15
lea    0xe9e(%rip),%rsi
mov    %rax,%rdi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1060 <opeq@plt>
test   %rax,%rax
je     11cd <armhli+0x8d>
lea    0xe83(%rip),%rsi
mov    %rbx,%rdi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1060 <opeq@plt>
test   %rax,%rax
je     11cd <armhli+0x8d>
lea    0xe6d(%rip),%rsi
mov    %r14,%rdi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1060 <opeq@plt>
test   %rax,%rax
je     11cd <armhli+0x8d>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    $0x1,%edx
call   1030 <deltaOff@plt>
test   %rax,%rax
je     11cd <armhli+0x8d>
lea    0xe5e(%rip),%rdi
call   1040 <puts@plt>
lea    0xe35(%rip),%rsi
mov    %r15,%rdi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1060 <opeq@plt>
test   %rax,%rax
je     123f <armhli+0xff>
lea    0xe1e(%rip),%rsi
mov    %rbx,%rdi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1060 <opeq@plt>
test   %rax,%rax
je     123f <armhli+0xff>
lea    0xe03(%rip),%rsi
mov    %r14,%rdi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1060 <opeq@plt>
test   %rax,%rax
je     123f <armhli+0xff>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x1,%edx
call   1030 <deltaOff@plt>
test   %rax,%rax
je     123f <armhli+0xff>
lea    0xde2(%rip),%rdi
call   1040 <puts@plt>
lea    0xdc7(%rip),%rsi
mov    %r15,%rdi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1060 <opeq@plt>
test   %rax,%rax
je     12b6 <armhli+0x176>
lea    0xda8(%rip),%rsi
mov    %rbx,%rdi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1060 <opeq@plt>
test   %rax,%rax
je     12b6 <armhli+0x176>
lea    0xd91(%rip),%rsi
mov    %r14,%rdi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1060 <opeq@plt>
test   %rax,%rax
je     12b6 <armhli+0x176>
mov    %r15,%rdi
mov    %r14,%rsi
mov    $0x1,%edx
call   1030 <deltaOff@plt>
test   %rax,%rax
je     12b6 <armhli+0x176>
lea    0xd66(%rip),%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <puts@plt>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.imap = type { i32 }
@.str = [5 x i8] c"ldrb\00"
@.str.1 = [4 x i8] c"orr\00"
@.str.2 = [7 x i8] c"loadw\0A\00"
@.str.3 = [4 x i8] c"mov\00"
@.str.4 = [5 x i8] c"strb\00"
@.str.5 = [11 x i8] c"storw.imm\0A\00"
@.str.6 = [11 x i8] c"storw.reg\0A\00"
define void @armhli(%struct.imap* %0) {
%2 = alloca %struct.imap*
%3 = alloca %struct.imap*
%4 = alloca %struct.imap*
store %struct.imap* %0, %struct.imap** %2
%5 = load %struct.imap*, %struct.imap** %2
%6 = call %struct.imap* @prv(%struct.imap* %5)
store %struct.imap* %6, %struct.imap** %4
%7 = load %struct.imap*, %struct.imap** %4
%8 = call %struct.imap* @prv(%struct.imap* %7)
store %struct.imap* %8, %struct.imap** %3
%9 = load %struct.imap*, %struct.imap** %3
%10 = call i64 @opeq(%struct.imap* %9, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 0, i32 0, i32 0)
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %27
12: ; preds = %1
%13 = load %struct.imap*, %struct.imap** %4
%14 = call i64 @opeq(%struct.imap* %13, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 0, i32 0, i32 0)
%15 = icmp ne i64 %14, 0
br i1 %15, label %16, label %27
16: ; preds = %12
%17 = load %struct.imap*, %struct.imap** %2
%18 = call i64 @opeq(%struct.imap* %17, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 0, i32 0, i32 0)
%19 = icmp ne i64 %18, 0
br i1 %19, label %20, label %27
20: ; preds = %16
%21 = load %struct.imap*, %struct.imap** %3
%22 = load %struct.imap*, %struct.imap** %4
%23 = call i64 @deltaOff(%struct.imap* %21, %struct.imap* %22, i32 1)
%24 = icmp ne i64 %23, 0
br i1 %24, label %25, label %27
25: ; preds = %20
%26 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
br label %27
27: ; preds = %25, %20, %16, %12, %1
%28 = load %struct.imap*, %struct.imap** %3
%29 = call i64 @opeq(%struct.imap* %28, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 0, i32 0, i32 0)
%30 = icmp ne i64 %29, 0
br i1 %30, label %31, label %46
31: ; preds = %27
%32 = load %struct.imap*, %struct.imap** %4
%33 = call i64 @opeq(%struct.imap* %32, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32 0, i32 0, i32 0)
%34 = icmp ne i64 %33, 0
br i1 %34, label %35, label %46
35: ; preds = %31
%36 = load %struct.imap*, %struct.imap** %2
%37 = call i64 @opeq(%struct.imap* %36, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32 0, i32 0, i32 0)
%38 = icmp ne i64 %37, 0
br i1 %38, label %39, label %46
39: ; preds = %35
%40 = load %struct.imap*, %struct.imap** %4
%41 = load %struct.imap*, %struct.imap** %2
%42 = call i64 @deltaOff(%struct.imap* %40, %struct.imap* %41, i32 1)
%43 = icmp ne i64 %42, 0
br i1 %43, label %44, label %46
44: ; preds = %39
%45 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0))
br label %46
46: ; preds = %44, %39, %35, %31, %27
%47 = load %struct.imap*, %struct.imap** %3
%48 = call i64 @opeq(%struct.imap* %47, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32 0, i32 0, i32 0)
%49 = icmp ne i64 %48, 0
br i1 %49, label %50, label %65
50: ; preds = %46
%51 = load %struct.imap*, %struct.imap** %4
%52 = call i64 @opeq(%struct.imap* %51, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 0, i32 0, i32 0)
%53 = icmp ne i64 %52, 0
br i1 %53, label %54, label %65
54: ; preds = %50
%55 = load %struct.imap*, %struct.imap** %2
%56 = call i64 @opeq(%struct.imap* %55, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32 0, i32 0, i32 0)
%57 = icmp ne i64 %56, 0
br i1 %57, label %58, label %65
58: ; preds = %54
%59 = load %struct.imap*, %struct.imap** %3
%60 = load %struct.imap*, %struct.imap** %2
%61 = call i64 @deltaOff(%struct.imap* %59, %struct.imap* %60, i32 1)
%62 = icmp ne i64 %61, 0
br i1 %62, label %63, label %65
63: ; preds = %58
%64 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0))
br label %65
65: ; preds = %63, %58, %54, %50, %46
ret void
}

LLVM IR (-O2):
%struct.imap = type { i32 }
@.str = [5 x i8] c"ldrb\00"
@.str.1 = [4 x i8] c"orr\00"
@.str.3 = [4 x i8] c"mov\00"
@.str.4 = [5 x i8] c"strb\00"
@str = [10 x i8] c"storw.reg\00"
@str.7 = [10 x i8] c"storw.imm\00"
@str.8 = [6 x i8] c"loadw\00"
define void @armhli(%struct.imap* %0) {
%2 = tail call %struct.imap* @prv(%struct.imap* %0)
%3 = tail call %struct.imap* @prv(%struct.imap* %2)
%4 = tail call i64 @opeq(%struct.imap* %3, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 0, i32 0, i32 0)
%5 = icmp eq i64 %4, 0
br i1 %5, label %17, label %6
6: ; preds = %1
%7 = tail call i64 @opeq(%struct.imap* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 0, i32 0, i32 0)
%8 = icmp eq i64 %7, 0
br i1 %8, label %17, label %9
9: ; preds = %6
%10 = tail call i64 @opeq(%struct.imap* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 0, i32 0, i32 0)
%11 = icmp eq i64 %10, 0
br i1 %11, label %17, label %12
12: ; preds = %9
%13 = tail call i64 @deltaOff(%struct.imap* %3, %struct.imap* %2, i32 1)
%14 = icmp eq i64 %13, 0
br i1 %14, label %17, label %15
15: ; preds = %12
%16 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str.8, i64 0, i64 0))
br label %17
17: ; preds = %15, %12, %9, %6, %1
%18 = tail call i64 @opeq(%struct.imap* %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 0, i32 0, i32 0)
%19 = icmp eq i64 %18, 0
br i1 %19, label %31, label %20
20: ; preds = %17
%21 = tail call i64 @opeq(%struct.imap* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32 0, i32 0, i32 0)
%22 = icmp eq i64 %21, 0
br i1 %22, label %31, label %23
23: ; preds = %20
%24 = tail call i64 @opeq(%struct.imap* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32 0, i32 0, i32 0)
%25 = icmp eq i64 %24, 0
br i1 %25, label %31, label %26
26: ; preds = %23
%27 = tail call i64 @deltaOff(%struct.imap* %2, %struct.imap* %0, i32 1)
%28 = icmp eq i64 %27, 0
br i1 %28, label %31, label %29
29: ; preds = %26
%30 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str.7, i64 0, i64 0))
br label %31
31: ; preds = %29, %26, %23, %20, %17
%32 = tail call i64 @opeq(%struct.imap* %3, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32 0, i32 0, i32 0)
%33 = icmp eq i64 %32, 0
br i1 %33, label %45, label %34
34: ; preds = %31
%35 = tail call i64 @opeq(%struct.imap* %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 0, i32 0, i32 0)
%36 = icmp eq i64 %35, 0
br i1 %36, label %45, label %37
37: ; preds = %34
%38 = tail call i64 @opeq(%struct.imap* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32 0, i32 0, i32 0)
%39 = icmp eq i64 %38, 0
br i1 %39, label %45, label %40
40: ; preds = %37
%41 = tail call i64 @deltaOff(%struct.imap* %3, %struct.imap* %0, i32 1)
%42 = icmp eq i64 %41, 0
br i1 %42, label %45, label %43
43: ; preds = %40
%44 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str, i64 0, i64 0))
br label %45
45: ; preds = %43, %40, %37, %34, %31
ret void
}