#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 */
typedef int uint8_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int read_fsr();
void cmd_read_fsr() {
  uint8_t fsr;
  fsr = read_fsr();
  printf("status register (FSR): 0x%02x\n", fsr);
  printf("ENDEBUG is%s set\n", (fsr & (1 << 7)) ? "" : " not");
  printf("STP	is%s set\n", (fsr & (1 << 6)) ? "" : " not");
  printf("WEN	is%s set\n", (fsr & (1 << 5)) ? "" : " not");
  printf("RDYN	is%s set\n", (fsr & (1 << 4)) ? "" : " not");
  printf("INFEN	is%s set\n", (fsr & (1 << 3)) ? "" : " not");
  printf("RDISMB	is%s set\n", (fsr & (1 << 2)) ? "" : " not");
}


x86 assembly (clang, -O0):
<cmd_read_fsr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <read_fsr@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xec4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%ecx
and    $0x80,%ecx
lea    0xede(%rip),%rsi
lea    0xf27(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rsi
lea    0xeb7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%ecx
and    $0x40,%ecx
lea    0xeb5(%rip),%rsi
lea    0xefe(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rsi
lea    0xea5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%ecx
and    $0x20,%ecx
lea    0xe8c(%rip),%rsi
lea    0xed5(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rsi
lea    0xe8a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%ecx
and    $0x10,%ecx
lea    0xe63(%rip),%rsi
lea    0xeac(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rsi
lea    0xe6f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%ecx
and    $0x8,%ecx
lea    0xe3a(%rip),%rsi
lea    0xe83(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rsi
lea    0xe55(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%ecx
and    $0x4,%ecx
lea    0xe11(%rip),%rsi
lea    0xe5a(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rsi
lea    0xe3c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmd_read_fsr>:
push   %rbp
push   %r14
push   %rbx
xor    %eax,%eax
call   1040 <read_fsr@plt>
mov    %eax,%ebp
lea    0xecc(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
test   $0x80,%bpl
lea    0xee9(%rip),%r14
lea    0xf32(%rip),%rbx
mov    %rbx,%rsi
cmove  %r14,%rsi
lea    0xec2(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
test   $0x40,%bpl
mov    %rbx,%rsi
cmove  %r14,%rsi
lea    0xec0(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
test   $0x20,%bpl
mov    %rbx,%rsi
cmove  %r14,%rsi
lea    0xeb5(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
test   $0x10,%bpl
mov    %rbx,%rsi
cmove  %r14,%rsi
lea    0xeaa(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
test   $0x8,%bpl
mov    %rbx,%rsi
cmove  %r14,%rsi
lea    0xea0(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
test   $0x4,%bpl
cmove  %r14,%rbx
lea    0xe9a(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [31 x i8] c"status register (FSR): 0x%02x\0A\00"
@.str.1 = [18 x i8] c"ENDEBUG is%s set\0A\00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [5 x i8] c" not\00"
@.str.4 = [14 x i8] c"STP\09is%s set\0A\00"
@.str.5 = [14 x i8] c"WEN\09is%s set\0A\00"
@.str.6 = [15 x i8] c"RDYN\09is%s set\0A\00"
@.str.7 = [16 x i8] c"INFEN\09is%s set\0A\00"
@.str.8 = [17 x i8] c"RDISMB\09is%s set\0A\00"
define void @cmd_read_fsr() {
%1 = alloca i32
%2 = call i32 (...) @read_fsr()
store i32 %2, i32* %1
%3 = load i32, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = load i32, i32* %1
%6 = and i32 %5, 128
%7 = icmp ne i32 %6, 0
%8 = zext i1 %7 to i64
%9 = select i1 %7, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0)
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* %9)
%11 = load i32, i32* %1
%12 = and i32 %11, 64
%13 = icmp ne i32 %12, 0
%14 = zext i1 %13 to i64
%15 = select i1 %13, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0)
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i8* %15)
%17 = load i32, i32* %1
%18 = and i32 %17, 32
%19 = icmp ne i32 %18, 0
%20 = zext i1 %19 to i64
%21 = select i1 %19, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0)
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), i8* %21)
%23 = load i32, i32* %1
%24 = and i32 %23, 16
%25 = icmp ne i32 %24, 0
%26 = zext i1 %25 to i64
%27 = select i1 %25, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0)
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0), i8* %27)
%29 = load i32, i32* %1
%30 = and i32 %29, 8
%31 = icmp ne i32 %30, 0
%32 = zext i1 %31 to i64
%33 = select i1 %31, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0)
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0), i8* %33)
%35 = load i32, i32* %1
%36 = and i32 %35, 4
%37 = icmp ne i32 %36, 0
%38 = zext i1 %37 to i64
%39 = select i1 %37, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0)
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0), i8* %39)
ret void
}

LLVM IR (-O2):
@.str = [31 x i8] c"status register (FSR): 0x%02x\0A\00"
@.str.1 = [18 x i8] c"ENDEBUG is%s set\0A\00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [5 x i8] c" not\00"
@.str.4 = [14 x i8] c"STP\09is%s set\0A\00"
@.str.5 = [14 x i8] c"WEN\09is%s set\0A\00"
@.str.6 = [15 x i8] c"RDYN\09is%s set\0A\00"
@.str.7 = [16 x i8] c"INFEN\09is%s set\0A\00"
@.str.8 = [17 x i8] c"RDISMB\09is%s set\0A\00"
define void @cmd_read_fsr() {
%1 = tail call i32 (...) @read_fsr()
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = and i32 %1, 128
%4 = icmp eq i32 %3, 0
%5 = select i1 %4, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* %5)
%7 = and i32 %1, 64
%8 = icmp eq i32 %7, 0
%9 = select i1 %8, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0)
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i8* %9)
%11 = and i32 %1, 32
%12 = icmp eq i32 %11, 0
%13 = select i1 %12, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0)
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), i8* %13)
%15 = and i32 %1, 16
%16 = icmp eq i32 %15, 0
%17 = select i1 %16, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0)
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0), i8* %17)
%19 = and i32 %1, 8
%20 = icmp eq i32 %19, 0
%21 = select i1 %20, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0)
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0), i8* %21)
%23 = and i32 %1, 4
%24 = icmp eq i32 %23, 0
%25 = select i1 %24, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0)
%26 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0), i8* %25)
ret void
}