#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 */
struct sched_param {
  int sched_priority;
};

/* Variables and functions */
int SCHED_FIFO;
int SCHED_OTHER;
int SCHED_RR;
int /*<<< orphan*/ printf(char *, char *, int);
void display_sched_attr(int policy, struct sched_param *param) {
  printf("policy=%s, priority=%d,",
         (policy == SCHED_FIFO)    ? "SCHED_FIFO"
         : (policy == SCHED_RR)    ? "SCHED_RR"
         : (policy == SCHED_OTHER) ? "SCHED_OTHER"
                                   : "???",
         param->sched_priority);
}


x86 assembly (clang, -O0):
<display_sched_attr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    0x2ebf(%rip),%rcx
cmp    (%rcx),%eax
jne    1141 <display_sched_attr+0x31>
lea    0xee0(%rip),%rax
mov    %rax,-0x18(%rbp)
jmp    118f <display_sched_attr+0x7f>
mov    -0x4(%rbp),%eax
mov    0x2e7d(%rip),%rcx
cmp    (%rcx),%eax
jne    1163 <display_sched_attr+0x53>
lea    0xec9(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    1187 <display_sched_attr+0x77>
mov    -0x4(%rbp),%edx
mov    0x2e6b(%rip),%rax
mov    (%rax),%esi
lea    0xec2(%rip),%rax
lea    0xeaf(%rip),%rcx
cmp    %esi,%edx
cmove  %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
mov    -0x10(%rbp),%rax
mov    (%rax),%edx
lea    0xe60(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<display_sched_attr>:
mov    0x2ed1(%rip),%rax
cmp    %edi,(%rax)
jne    1124 <display_sched_attr+0x14>
lea    0xef6(%rip),%rax
jmp    1153 <display_sched_attr+0x43>
mov    0x2e9d(%rip),%rax
cmp    %edi,(%rax)
jne    1138 <display_sched_attr+0x28>
lea    0xeed(%rip),%rax
jmp    1153 <display_sched_attr+0x43>
mov    0x2e99(%rip),%rax
cmp    %edi,(%rax)
lea    0xee4(%rip),%rcx
lea    0xee9(%rip),%rax
cmove  %rcx,%rax
mov    (%rsi),%edx
lea    0xea4(%rip),%rdi
mov    %rax,%rsi
jmp    1030 <printf@plt>

LLVM IR (-O0):
%struct.sched_param = type { i32 }
@.str = [24 x i8] c"policy=%s, priority=%d,\00"
@SCHED_FIFO = global i32 0
@.str.1 = [11 x i8] c"SCHED_FIFO\00"
@SCHED_RR = global i32 0
@.str.2 = [9 x i8] c"SCHED_RR\00"
@SCHED_OTHER = global i32 0
@.str.3 = [12 x i8] c"SCHED_OTHER\00"
@.str.4 = [4 x i8] c"???\00"
define void @display_sched_attr(i32 %0, %struct.sched_param* %1) {
%3 = alloca i32
%4 = alloca %struct.sched_param*
store i32 %0, i32* %3
store %struct.sched_param* %1, %struct.sched_param** %4
%5 = load i32, i32* %3
%6 = load i32, i32* @SCHED_FIFO
%7 = icmp eq i32 %5, %6
br i1 %7, label %8, label %9
8: ; preds = %2
br label %22
9: ; preds = %2
%10 = load i32, i32* %3
%11 = load i32, i32* @SCHED_RR
%12 = icmp eq i32 %10, %11
br i1 %12, label %13, label %14
13: ; preds = %9
br label %20
14: ; preds = %9
%15 = load i32, i32* %3
%16 = load i32, i32* @SCHED_OTHER
%17 = icmp eq i32 %15, %16
%18 = zext i1 %17 to i64
%19 = select i1 %17, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0)
br label %20
20: ; preds = %14, %13
%21 = phi i8* [ getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), %13 ], [ %19, %14 ]
br label %22
22: ; preds = %20, %8
%23 = phi i8* [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), %8 ], [ %21, %20 ]
%24 = load %struct.sched_param*, %struct.sched_param** %4
%25 = getelementptr inbounds %struct.sched_param, %struct.sched_param* %24, i32 0, i32 0
%26 = load i32, i32* %25
%27 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %23, i32 %26)
ret void
}

LLVM IR (-O2):
%struct.sched_param = type { i32 }
@.str = [24 x i8] c"policy=%s, priority=%d,\00"
@SCHED_FIFO = global i32 0
@.str.1 = [11 x i8] c"SCHED_FIFO\00"
@SCHED_RR = global i32 0
@.str.2 = [9 x i8] c"SCHED_RR\00"
@SCHED_OTHER = global i32 0
@.str.3 = [12 x i8] c"SCHED_OTHER\00"
@.str.4 = [4 x i8] c"???\00"
define void @display_sched_attr(i32 %0, %struct.sched_param* nocapture %1) {
%3 = load i32, i32* @SCHED_FIFO
%4 = icmp eq i32 %3, %0
br i1 %4, label %12, label %5
5: ; preds = %2
%6 = load i32, i32* @SCHED_RR
%7 = icmp eq i32 %6, %0
br i1 %7, label %12, label %8
8: ; preds = %5
%9 = load i32, i32* @SCHED_OTHER
%10 = icmp eq i32 %9, %0
%11 = select i1 %10, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0)
br label %12
12: ; preds = %8, %5, %2
%13 = phi i8* [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), %2 ], [ %11, %8 ], [ getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), %5 ]
%14 = getelementptr inbounds %struct.sched_param, %struct.sched_param* %1, i64 0, i32 0
%15 = load i32, i32* %14
%16 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %13, i32 %15)
ret void
}