#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 /*<<< orphan*/ uint64_t;
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int powercap_sysfs_constraint_get_power_limit_uw(char *, int /*<<< orphan*/ *,
                                                 int, int /*<<< orphan*/,
                                                 int /*<<< orphan*/ *);
int rapl_sysfs_constraint_get_power_limit_uw(uint32_t zone, uint32_t sz,
                                             int is_sz, uint32_t constraint,
                                             uint64_t *val) {
  uint32_t zones[2];
  zones[0] = zone;
  zones[1] = sz;
  ;
  return powercap_sysfs_constraint_get_power_limit_uw(
      "intel-rapl", zones, (is_sz ? 2 : 1), constraint, val);
}


x86 assembly (clang, -O0):
<rapl_sysfs_constraint_get_power_limit_uw>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8,-0x18(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x1c(%rbp)
lea    -0x20(%rbp),%rsi
mov    -0xc(%rbp),%ecx
mov    $0x1,%edx
mov    $0x2,%eax
cmp    $0x0,%ecx
cmovne %eax,%edx
mov    -0x10(%rbp),%ecx
mov    -0x18(%rbp),%r8
lea    0xea7(%rip),%rdi
call   1030 <powercap_sysfs_constraint_get_power_limit_uw@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rapl_sysfs_constraint_get_power_limit_uw>:
push   %rax
mov    %edi,(%rsp)
mov    %esi,0x4(%rsp)
cmp    $0x1,%edx
mov    $0x2,%edx
sbb    $0x0,%edx
lea    0xed6(%rip),%rdi
mov    %rsp,%rsi
call   1030 <powercap_sysfs_constraint_get_power_limit_uw@plt>
pop    %rcx
ret

LLVM IR (-O0):
@.str = [11 x i8] c"intel-rapl\00"
define i32 @rapl_sysfs_constraint_get_power_limit_uw(i32 %0, i32 %1, i32 %2, i32 %3, i32* %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32*
%11 = alloca [2 x i32]
store i32 %0, i32* %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32* %4, i32** %10
%12 = load i32, i32* %6
%13 = getelementptr inbounds [2 x i32], [2 x i32]* %11, i64 0, i64 0
store i32 %12, i32* %13
%14 = load i32, i32* %7
%15 = getelementptr inbounds [2 x i32], [2 x i32]* %11, i64 0, i64 1
store i32 %14, i32* %15
%16 = getelementptr inbounds [2 x i32], [2 x i32]* %11, i64 0, i64 0
%17 = load i32, i32* %8
%18 = icmp ne i32 %17, 0
%19 = zext i1 %18 to i64
%20 = select i1 %18, i32 2, i32 1
%21 = load i32, i32* %9
%22 = load i32*, i32** %10
%23 = call i32 @powercap_sysfs_constraint_get_power_limit_uw(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32* %16, i32 %20, i32 %21, i32* %22)
ret i32 %23
}

LLVM IR (-O2):
@.str = [11 x i8] c"intel-rapl\00"
define i32 @rapl_sysfs_constraint_get_power_limit_uw(i32 %0, i32 %1, i32 %2, i32 %3, i32* %4) {
%6 = alloca [2 x i32]
%7 = bitcast [2 x i32]* %6 to i8*
%8 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
store i32 %0, i32* %8
%9 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 1
store i32 %1, i32* %9
%10 = icmp eq i32 %2, 0
%11 = select i1 %10, i32 1, i32 2
%12 = call i32 @powercap_sysfs_constraint_get_power_limit_uw(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32* %8, i32 %11, i32 %3, i32* %4)
ret i32 %12
}