#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 sio_read_reg(int, unsigned long *);
int FS460_get_blender_bypass(int *p_bypass) {
  int err;
  unsigned long mux2;
  if (!p_bypass)
    return 0x1000;
  err = sio_read_reg(0x3E, &mux2);
  if (err)
    return err;
  if (mux2 & ((1 << 9) | (1 << 7)))
    *p_bypass = 0;
  else
    *p_bypass = 1;
  return 0;
}


x86 assembly (clang, -O0):
<FS460_get_blender_bypass>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1133 <FS460_get_blender_bypass+0x23>
movl   $0x1000,-0x4(%rbp)
jmp    118d <FS460_get_blender_bypass+0x7d>
mov    $0x3e,%edi
lea    -0x20(%rbp),%rsi
call   1030 <sio_read_reg@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1159 <FS460_get_blender_bypass+0x49>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    118d <FS460_get_blender_bypass+0x7d>
mov    -0x20(%rbp),%rax
and    $0x280,%rax
cmp    $0x0,%rax
je     117c <FS460_get_blender_bypass+0x6c>
mov    -0x10(%rbp),%rax
movl   $0x0,(%rax)
jmp    1186 <FS460_get_blender_bypass+0x76>
mov    -0x10(%rbp),%rax
movl   $0x1,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<FS460_get_blender_bypass>:
push   %rbx
sub    $0x10,%rsp
test   %rdi,%rdi
je     1143 <FS460_get_blender_bypass+0x33>
mov    %rdi,%rbx
lea    0x8(%rsp),%rsi
mov    $0x3e,%edi
call   1030 <sio_read_reg@plt>
test   %eax,%eax
jne    1148 <FS460_get_blender_bypass+0x38>
xor    %eax,%eax
testl  $0x280,0x8(%rsp)
sete   %al
mov    %eax,(%rbx)
xor    %eax,%eax
jmp    1148 <FS460_get_blender_bypass+0x38>
mov    $0x1000,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @FS460_get_blender_bypass(i32* %0) {
%2 = alloca i32
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i64
store i32* %0, i32** %3
%6 = load i32*, i32** %3
%7 = icmp ne i32* %6, null
br i1 %7, label %9, label %8
8: ; preds = %1
store i32 4096, i32* %2
br label %24
9: ; preds = %1
%10 = call i32 @sio_read_reg(i32 62, i64* %5)
store i32 %10, i32* %4
%11 = load i32, i32* %4
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %9
%14 = load i32, i32* %4
store i32 %14, i32* %2
br label %24
15: ; preds = %9
%16 = load i64, i64* %5
%17 = and i64 %16, 640
%18 = icmp ne i64 %17, 0
br i1 %18, label %19, label %21
19: ; preds = %15
%20 = load i32*, i32** %3
store i32 0, i32* %20
br label %23
21: ; preds = %15
%22 = load i32*, i32** %3
store i32 1, i32* %22
br label %23
23: ; preds = %21, %19
store i32 0, i32* %2
br label %24
24: ; preds = %23, %13, %8
%25 = load i32, i32* %2
ret i32 %25
}

LLVM IR (-O2):
define i32 @FS460_get_blender_bypass(i32* writeonly %0) {
%2 = alloca i64
%3 = bitcast i64* %2 to i8*
%4 = icmp eq i32* %0, null
br i1 %4, label %13, label %5
5: ; preds = %1
%6 = call i32 @sio_read_reg(i32 62, i64* %2)
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %13
8: ; preds = %5
%9 = load i64, i64* %2
%10 = and i64 %9, 640
%11 = icmp eq i64 %10, 0
%12 = zext i1 %11 to i32
store i32 %12, i32* %0
br label %13
13: ; preds = %5, %1, %8
%14 = phi i32 [ 0, %8 ], [ 4096, %1 ], [ %6, %5 ]
ret i32 %14
}