#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*/ dummy();
void main() {
  unsigned char *P8 = (unsigned char *)0x03f0;
  unsigned char *PD8 = (unsigned char *)0x03f2;
  unsigned char *PUR2 = (unsigned char *)0x03fe;
  unsigned char sw4, sw5;
  *PD8 = 0x00;
  *PUR2 = 0x01;
  while (1) {
    sw4 = 0x02 & (*P8);
    sw5 = 0x01 & (*P8);
    if (sw4 == 2) {
      dummy();
    } else {
      dummy();
    }
    if (sw5 == 1) {
      dummy();
    } else {
      dummy();
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x3f0,%eax
mov    %rax,-0x8(%rbp)
mov    $0x3f2,%eax
mov    %rax,-0x10(%rbp)
mov    $0x3fe,%eax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x18(%rbp),%rax
movb   $0x1,(%rax)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
and    $0x2,%eax
mov    %al,-0x19(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
and    $0x1,%eax
mov    %al,-0x1a(%rbp)
movzbl -0x19(%rbp),%eax
cmp    $0x2,%eax
jne    1174 <main+0x64>
mov    $0x0,%al
call   1030 <dummy@plt>
jmp    117b <main+0x6b>
mov    $0x0,%al
call   1030 <dummy@plt>
movzbl -0x1a(%rbp),%eax
cmp    $0x1,%eax
jne    1194 <main+0x84>
mov    $0x0,%al
call   1030 <dummy@plt>
jmp    119b <main+0x8b>
mov    $0x0,%al
call   1030 <dummy@plt>
jmp    1141 <main+0x31>

x86 assembly (clang, -O2):
<main>:
push   %rax
movb   $0x0,0x3f2
movb   $0x1,0x3fe
01
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <dummy@plt>
xor    %eax,%eax
call   1030 <dummy@plt>
jmp    1130 <main+0x20>

LLVM IR (-O0):
define void @main() {
%1 = alloca i8*
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8
%5 = alloca i8
store i8* inttoptr (i64 1008 to i8*), i8** %1
store i8* inttoptr (i64 1010 to i8*), i8** %2
store i8* inttoptr (i64 1022 to i8*), i8** %3
%6 = load i8*, i8** %2
store i8 0, i8* %6
%7 = load i8*, i8** %3
store i8 1, i8* %7
br label %8
8: ; preds = %0, %34
%9 = load i8*, i8** %1
%10 = load i8, i8* %9
%11 = zext i8 %10 to i32
%12 = and i32 2, %11
%13 = trunc i32 %12 to i8
store i8 %13, i8* %4
%14 = load i8*, i8** %1
%15 = load i8, i8* %14
%16 = zext i8 %15 to i32
%17 = and i32 1, %16
%18 = trunc i32 %17 to i8
store i8 %18, i8* %5
%19 = load i8, i8* %4
%20 = zext i8 %19 to i32
%21 = icmp eq i32 %20, 2
br i1 %21, label %22, label %24
22: ; preds = %8
%23 = call i32 (...) @dummy()
br label %26
24: ; preds = %8
%25 = call i32 (...) @dummy()
br label %26
26: ; preds = %24, %22
%27 = load i8, i8* %5
%28 = zext i8 %27 to i32
%29 = icmp eq i32 %28, 1
br i1 %29, label %30, label %32
30: ; preds = %26
%31 = call i32 (...) @dummy()
br label %34
32: ; preds = %26
%33 = call i32 (...) @dummy()
br label %34
34: ; preds = %32, %30
br label %8
}

LLVM IR (-O2):
define void @main() {
store i8 0, i8* inttoptr (i64 1010 to i8*)
store i8 1, i8* inttoptr (i64 1022 to i8*)
br label %1
1: ; preds = %1, %0
%2 = tail call i32 (...) @dummy()
%3 = tail call i32 (...) @dummy()
br label %1
}