#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*/ infof(char *);
int /*<<< orphan*/ interpret_packet();
int rx();
void interpreter(void) {
  infof("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
        "2022-01-22/02-19-57/repos/zwizwa/staapl/refs/heads/master/arm/"
        "qemu-system/kernel.c"
        ": "
        "interpreter()\n");
  while (1) {
    int addr = rx();
    if (addr) {
      int count = rx();
      while (count--)
        rx();
    } else {
      interpret_packet();
    }
  }
}


x86 assembly (clang, -O0):
<interpreter>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
call   1050 <infof@plt>
mov    $0x0,%al
call   1040 <rx@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1187 <interpreter+0x57>
mov    $0x0,%al
call   1040 <rx@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
je     1182 <interpreter+0x52>
mov    $0x0,%al
call   1040 <rx@plt>
jmp    1162 <interpreter+0x32>
jmp    118e <interpreter+0x5e>
mov    $0x0,%al
call   1030 <interpret_packet@plt>
jmp    1144 <interpreter+0x14>

x86 assembly (clang, -O2):
<interpreter>:
push   %rbx
lea    0xec8(%rip),%rdi
call   1050 <infof@plt>
jmp    1147 <interpreter+0x17>
nop
xor    %eax,%eax
call   1030 <interpret_packet@plt>
xor    %eax,%eax
call   1040 <rx@plt>
test   %eax,%eax
je     1140 <interpreter+0x10>
xor    %eax,%eax
call   1040 <rx@plt>
test   %eax,%eax
je     1147 <interpreter+0x17>
mov    %eax,%ebx
nop
xor    %eax,%eax
call   1040 <rx@plt>
add    $0xffffffff,%ebx
jne    1160 <interpreter+0x30>
jmp    1147 <interpreter+0x17>

LLVM IR (-O0):
@.str = [163 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/zwizwa/staapl/refs/heads/master/arm/qemu-system/kernel.c: interpreter()\0A\00"
define void @interpreter() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 @infof(i8* getelementptr inbounds ([163 x i8], [163 x i8]* @.str, i64 0, i64 0))
br label %4
4: ; preds = %0, %19
%5 = call i32 (...) @rx()
store i32 %5, i32* %1
%6 = load i32, i32* %1
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %17
8: ; preds = %4
%9 = call i32 (...) @rx()
store i32 %9, i32* %2
br label %10
10: ; preds = %14, %8
%11 = load i32, i32* %2
%12 = add nsw i32 %11, -1
store i32 %12, i32* %2
%13 = icmp ne i32 %11, 0
br i1 %13, label %14, label %16
14: ; preds = %10
%15 = call i32 (...) @rx()
br label %10
16: ; preds = %10
br label %19
17: ; preds = %4
%18 = call i32 (...) @interpret_packet()
br label %19
19: ; preds = %17, %16
br label %4
}

LLVM IR (-O2):
@.str = [163 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/zwizwa/staapl/refs/heads/master/arm/qemu-system/kernel.c: interpreter()\0A\00"
define void @interpreter() {
%1 = tail call i32 @infof(i8* getelementptr inbounds ([163 x i8], [163 x i8]* @.str, i64 0, i64 0))
br label %2
2: ; preds = %8, %0
%3 = tail call i32 (...) @rx()
%4 = icmp eq i32 %3, 0
br i1 %4, label %14, label %5
5: ; preds = %2
%6 = tail call i32 (...) @rx()
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %9, %5, %14
br label %2
9: ; preds = %5, %9
%10 = phi i32 [ %11, %9 ], [ %6, %5 ]
%11 = add nsw i32 %10, -1
%12 = tail call i32 (...) @rx()
%13 = icmp eq i32 %11, 0
br i1 %13, label %8, label %9
14: ; preds = %2
%15 = tail call i32 (...) @interpret_packet()
br label %8
}