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

/* Variables and functions */
int /*<<< orphan*/ powercap_sysfs_zone_get_name(char *, int /*<<< orphan*/ *,
                                                int, char *, size_t);
ssize_t rapl_sysfs_zone_get_name(uint32_t zone, uint32_t sz, int is_sz,
                                 char *buf, size_t size) {
  uint32_t zones[2];
  zones[0] = zone;
  zones[1] = sz;
  ;
  return powercap_sysfs_zone_get_name("intel-rapl", zones, (is_sz ? 2 : 1), buf,
                                      size);
}


x86 assembly (clang, -O0):
<rapl_sysfs_zone_get_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x24(%rbp)
lea    -0x28(%rbp),%rsi
mov    -0xc(%rbp),%ecx
mov    $0x1,%edx
mov    $0x2,%eax
cmp    $0x0,%ecx
cmovne %eax,%edx
mov    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%r8
lea    0xea5(%rip),%rdi
call   1030 <powercap_sysfs_zone_get_name@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rapl_sysfs_zone_get_name>:
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_zone_get_name@plt>
pop    %rcx
ret

LLVM IR (-O0):
@.str = [11 x i8] c"intel-rapl\00"
define i32 @rapl_sysfs_zone_get_name(i32 %0, i32 %1, i32 %2, i8* %3, i64 %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i64
%11 = alloca [2 x i32]
store i32 %0, i32* %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i8* %3, i8** %9
store i64 %4, i64* %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 i8*, i8** %9
%22 = load i64, i64* %10
%23 = call i32 @powercap_sysfs_zone_get_name(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32* %16, i32 %20, i8* %21, i64 %22)
ret i32 %23
}

LLVM IR (-O2):
@.str = [11 x i8] c"intel-rapl\00"
define i32 @rapl_sysfs_zone_get_name(i32 %0, i32 %1, i32 %2, i8* %3, i64 %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_zone_get_name(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32* %8, i32 %11, i8* %3, i64 %4)
ret i32 %12
}