#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*/ rt_tick_increase();
int /*<<< orphan*/ s4_push();
void do_irq(void) {
  int offset;
  offset = (*(volatile unsigned *)0x4a000014);
  switch (offset) {
  case 2:
    s4_push();
    break;
  case 10:
    rt_tick_increase();
    break;
  default:
    break;
  }
  {
    (*(volatile unsigned *)0x4a000000) = 1 << offset;
    (*(volatile unsigned *)0x4a000010) = 1 << offset;
    (*(volatile unsigned *)0x4a000010);
  };
}


x86 assembly (clang, -O0):
<do_irq>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x4a000014,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
sub    $0x2,%eax
je     1157 <do_irq+0x37>
jmp    1146 <do_irq+0x26>
mov    -0x8(%rbp),%eax
sub    $0xa,%eax
je     1163 <do_irq+0x43>
jmp    116f <do_irq+0x4f>
mov    $0x0,%al
call   1030 <s4_push@plt>
jmp    1174 <do_irq+0x54>
mov    $0x0,%al
call   1040 <rt_tick_increase@plt>
jmp    1174 <do_irq+0x54>
jmp    1174 <do_irq+0x54>
mov    -0x4(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,%ecx
mov    $0x4a000000,%eax
mov    %ecx,(%rax)
mov    -0x4(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,%ecx
mov    $0x4a000010,%eax
mov    %ecx,(%rax)
mov    $0x4a000010,%eax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_irq>:
push   %rbx
mov    0x4a000014,%ebx
cmp    $0xa,%ebx
je     113b <do_irq+0x1b>
cmp    $0x2,%ebx
jne    1142 <do_irq+0x22>
xor    %eax,%eax
call   1030 <s4_push@plt>
jmp    1142 <do_irq+0x22>
xor    %eax,%eax
call   1040 <rt_tick_increase@plt>
mov    $0x1,%eax
mov    %ebx,%ecx
shl    %cl,%eax
mov    %eax,0x4a000000
mov    %eax,0x4a000010
mov    0x4a000010,%eax
pop    %rbx
ret

LLVM IR (-O0):
define void @do_irq() {
%1 = alloca i32
%2 = load volatile i32, i32* inttoptr (i64 1241514004 to i32*)
store i32 %2, i32* %1
%3 = load i32, i32* %1
switch i32 %3, label %8 [
i32 2, label %4
i32 10, label %6
]
4: ; preds = %0
%5 = call i32 (...) @s4_push()
br label %9
6: ; preds = %0
%7 = call i32 (...) @rt_tick_increase()
br label %9
8: ; preds = %0
br label %9
9: ; preds = %8, %6, %4
%10 = load i32, i32* %1
%11 = shl i32 1, %10
store volatile i32 %11, i32* inttoptr (i64 1241513984 to i32*)
%12 = load i32, i32* %1
%13 = shl i32 1, %12
store volatile i32 %13, i32* inttoptr (i64 1241514000 to i32*)
%14 = load volatile i32, i32* inttoptr (i64 1241514000 to i32*)
ret void
}

LLVM IR (-O2):
define void @do_irq() {
%1 = load volatile i32, i32* inttoptr (i64 1241514004 to i32*)
switch i32 %1, label %6 [
i32 2, label %2
i32 10, label %4
]
2: ; preds = %0
%3 = tail call i32 (...) @s4_push()
br label %6
4: ; preds = %0
%5 = tail call i32 (...) @rt_tick_increase()
br label %6
6: ; preds = %0, %4, %2
%7 = shl nuw i32 1, %1
store volatile i32 %7, i32* inttoptr (i64 1241513984 to i32*)
store volatile i32 %7, i32* inttoptr (i64 1241514000 to i32*)
%8 = load volatile i32, i32* inttoptr (i64 1241514000 to i32*)
ret void
}