#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 *, ...);
void processing_pending_instruction(char instr, unsigned int count) {
  switch (instr) {
  case '<': {
    if (count == 1) {
      printf("dec esi\n");
    } else {
      printf("sub esi, %d\n", count);
    }
    printf("mov ah, [data_str+esi]\n");
    break;
  }
  case '>': {
    if (count == 1) {
      printf("inc esi\n");
    } else {
      printf("add esi, %d\n", count);
    }
    printf("mov ah, [data_str+esi]\n");
    break;
  }
  case '+': {
    if (count == 1) {
      printf("inc ah\n");
    } else {
      printf("add ah, %d\n", count);
    }
    printf("mov [data_str+esi], ah\n");
    break;
  }
  case '-': {
    if (count == 1) {
      printf("dec ah\n");
    } else {
      printf("sub ah, %d\n", count);
    }
    printf("mov [data_str+esi], ah\n");
    break;
  }
  }
}


x86 assembly (clang, -O0):
<processing_pending_instruction>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %esi,-0x8(%rbp)
movsbl -0x1(%rbp),%eax
add    $0xffffffd5,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x13,%eax
ja     124a <processing_pending_instruction+0x13a>
mov    -0x10(%rbp),%rax
lea    0xebe(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
cmpl   $0x1,-0x8(%rbp)
jne    1168 <processing_pending_instruction+0x58>
lea    0xef4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1179 <processing_pending_instruction+0x69>
mov    -0x8(%rbp),%esi
lea    0xee7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    124a <processing_pending_instruction+0x13a>
cmpl   $0x1,-0x8(%rbp)
jne    11a9 <processing_pending_instruction+0x99>
lea    0xee1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11ba <processing_pending_instruction+0xaa>
mov    -0x8(%rbp),%esi
lea    0xed4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    124a <processing_pending_instruction+0x13a>
cmpl   $0x1,-0x8(%rbp)
jne    11ea <processing_pending_instruction+0xda>
lea    0xeb6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11fb <processing_pending_instruction+0xeb>
mov    -0x8(%rbp),%esi
lea    0xea8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    124a <processing_pending_instruction+0x13a>
cmpl   $0x1,-0x8(%rbp)
jne    122b <processing_pending_instruction+0x11b>
lea    0xea1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    123c <processing_pending_instruction+0x12c>
mov    -0x8(%rbp),%esi
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe65(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<processing_pending_instruction>:
push   %rax
add    $0xffffffd5,%edi
cmp    $0x13,%edi
ja     1180 <processing_pending_instruction+0x60>
lea    0xed0(%rip),%rax
movslq (%rax,%rdi,4),%rcx
add    %rax,%rcx
jmp    *%rcx
cmp    $0x1,%esi
jne    1182 <processing_pending_instruction+0x62>
lea    0xf5b(%rip),%rdi
call   1030 <puts@plt>
jmp    1199 <processing_pending_instruction+0x79>
cmp    $0x1,%esi
jne    118b <processing_pending_instruction+0x6b>
lea    0xf2a(%rip),%rdi
call   1030 <puts@plt>
jmp    1199 <processing_pending_instruction+0x79>
cmp    $0x1,%esi
jne    11a6 <processing_pending_instruction+0x86>
lea    0xf5b(%rip),%rdi
jmp    1179 <processing_pending_instruction+0x59>
cmp    $0x1,%esi
jne    11af <processing_pending_instruction+0x8f>
lea    0xf2e(%rip),%rdi
call   1030 <puts@plt>
jmp    11bd <processing_pending_instruction+0x9d>
pop    %rax
ret
lea    0xee1(%rip),%rdi
jmp    1192 <processing_pending_instruction+0x72>
lea    0xee4(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xee9(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>
lea    0xea3(%rip),%rdi
jmp    11b6 <processing_pending_instruction+0x96>
lea    0xea7(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeeb(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"dec esi\0A\00"
@.str.1 = [13 x i8] c"sub esi, %d\0A\00"
@.str.2 = [24 x i8] c"mov ah, [data_str+esi]\0A\00"
@.str.3 = [9 x i8] c"inc esi\0A\00"
@.str.4 = [13 x i8] c"add esi, %d\0A\00"
@.str.5 = [8 x i8] c"inc ah\0A\00"
@.str.6 = [12 x i8] c"add ah, %d\0A\00"
@.str.7 = [24 x i8] c"mov [data_str+esi], ah\0A\00"
@.str.8 = [8 x i8] c"dec ah\0A\00"
@.str.9 = [12 x i8] c"sub ah, %d\0A\00"
define void @processing_pending_instruction(i8 signext %0, i32 %1) {
%3 = alloca i8
%4 = alloca i32
store i8 %0, i8* %3
store i32 %1, i32* %4
%5 = load i8, i8* %3
%6 = sext i8 %5 to i32
switch i32 %6, label %47 [
i32 60, label %7
i32 62, label %17
i32 43, label %27
i32 45, label %37
]
7: ; preds = %2
%8 = load i32, i32* %4
%9 = icmp eq i32 %8, 1
br i1 %9, label %10, label %12
10: ; preds = %7
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
br label %15
12: ; preds = %7
%13 = load i32, i32* %4
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %13)
br label %15
15: ; preds = %12, %10
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
br label %47
17: ; preds = %2
%18 = load i32, i32* %4
%19 = icmp eq i32 %18, 1
br i1 %19, label %20, label %22
20: ; preds = %17
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
br label %25
22: ; preds = %17
%23 = load i32, i32* %4
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i32 %23)
br label %25
25: ; preds = %22, %20
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
br label %47
27: ; preds = %2
%28 = load i32, i32* %4
%29 = icmp eq i32 %28, 1
br i1 %29, label %30, label %32
30: ; preds = %27
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0))
br label %35
32: ; preds = %27
%33 = load i32, i32* %4
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), i32 %33)
br label %35
35: ; preds = %32, %30
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.7, i64 0, i64 0))
br label %47
37: ; preds = %2
%38 = load i32, i32* %4
%39 = icmp eq i32 %38, 1
br i1 %39, label %40, label %42
40: ; preds = %37
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0))
br label %45
42: ; preds = %37
%43 = load i32, i32* %4
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.9, i64 0, i64 0), i32 %43)
br label %45
45: ; preds = %42, %40
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.7, i64 0, i64 0))
br label %47
47: ; preds = %2, %45, %35, %25, %15
ret void
}

LLVM IR (-O2):
@.str.1 = [13 x i8] c"sub esi, %d\0A\00"
@.str.4 = [13 x i8] c"add esi, %d\0A\00"
@.str.6 = [12 x i8] c"add ah, %d\0A\00"
@.str.9 = [12 x i8] c"sub ah, %d\0A\00"
@str.10 = [7 x i8] c"dec ah\00"
@str.11 = [23 x i8] c"mov [data_str+esi], ah\00"
@str.12 = [7 x i8] c"inc ah\00"
@str.14 = [8 x i8] c"inc esi\00"
@str.15 = [23 x i8] c"mov ah, [data_str+esi]\00"
@str.16 = [8 x i8] c"dec esi\00"
define void @processing_pending_instruction(i8 signext %0, i32 %1) {
%3 = sext i8 %0 to i32
switch i32 %3, label %31 [
i32 60, label %4
i32 62, label %10
i32 43, label %16
i32 45, label %22
]
4: ; preds = %2
%5 = icmp eq i32 %1, 1
br i1 %5, label %6, label %8
6: ; preds = %4
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.16, i64 0, i64 0))
br label %28
8: ; preds = %4
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %1)
br label %28
10: ; preds = %2
%11 = icmp eq i32 %1, 1
br i1 %11, label %12, label %14
12: ; preds = %10
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.14, i64 0, i64 0))
br label %28
14: ; preds = %10
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i32 %1)
br label %28
16: ; preds = %2
%17 = icmp eq i32 %1, 1
br i1 %17, label %18, label %20
18: ; preds = %16
%19 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.12, i64 0, i64 0))
br label %28
20: ; preds = %16
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), i32 %1)
br label %28
22: ; preds = %2
%23 = icmp eq i32 %1, 1
br i1 %23, label %24, label %26
24: ; preds = %22
%25 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.10, i64 0, i64 0))
br label %28
26: ; preds = %22
%27 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.9, i64 0, i64 0), i32 %1)
br label %28
28: ; preds = %24, %26, %18, %20, %12, %14, %6, %8
%29 = phi i8* [ getelementptr inbounds ([23 x i8], [23 x i8]* @str.15, i64 0, i64 0), %8 ], [ getelementptr inbounds ([23 x i8], [23 x i8]* @str.15, i64 0, i64 0), %6 ], [ getelementptr inbounds ([23 x i8], [23 x i8]* @str.15, i64 0, i64 0), %14 ], [ getelementptr inbounds ([23 x i8], [23 x i8]* @str.15, i64 0, i64 0), %12 ], [ getelementptr inbounds ([23 x i8], [23 x i8]* @str.11, i64 0, i64 0), %20 ], [ getelementptr inbounds ([23 x i8], [23 x i8]* @str.11, i64 0, i64 0), %18 ], [ getelementptr inbounds ([23 x i8], [23 x i8]* @str.11, i64 0, i64 0), %26 ], [ getelementptr inbounds ([23 x i8], [23 x i8]* @str.11, i64 0, i64 0), %24 ]
%30 = tail call i32 @puts(i8* dereferenceable(1) %29)
br label %31
31: ; preds = %28, %2
ret void
}