#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 sysentry {
  int dummy;
};

/* Variables and functions */
double atof(char *);
int /*<<< orphan*/ get_sysdata(char *, char **, char *);
int /*<<< orphan*/ sprintf(char *, char *, double);
void get_per_entc(struct sysentry *unused_se, char *buf) {
  char *descr;
  char physc[32];
  char entc[32];
  get_sysdata("DesEntCap", &descr, entc);
  get_sysdata("physc", &descr, physc);
  sprintf(buf, "%.2f", atof(physc) / atof(entc) * 100.0);
}


x86 assembly (clang, -O0):
<get_per_entc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x60(%rbp),%rdx
lea    0xebd(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <get_sysdata@plt>
lea    -0x40(%rbp),%rdx
lea    0xeb3(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <get_sysdata@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x70(%rbp)
lea    -0x40(%rbp),%rdi
call   1030 <atof@plt>
movsd  %xmm0,-0x68(%rbp)
lea    -0x60(%rbp),%rdi
call   1030 <atof@plt>
mov    -0x70(%rbp),%rdi
movaps %xmm0,%xmm1
movsd  -0x68(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  0xe61(%rip),%xmm1
mulsd  %xmm1,%xmm0
lea    0xe6e(%rip),%rsi
call   1050 <sprintf@plt>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_per_entc>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x58,%rsp
mov    %rsi,%r14
lea    0xec3(%rip),%rdi
lea    0x8(%rsp),%r12
lea    0x10(%rsp),%r15
mov    %r12,%rsi
mov    %r15,%rdx
call   1040 <get_sysdata@plt>
lea    0xeb1(%rip),%rdi
lea    0x30(%rsp),%rbx
mov    %r12,%rsi
mov    %rbx,%rdx
call   1040 <get_sysdata@plt>
mov    %rbx,%rdi
call   1030 <atof@plt>
movsd  %xmm0,(%rsp)
mov    %r15,%rdi
call   1030 <atof@plt>
movsd  (%rsp),%xmm1
divsd  %xmm0,%xmm1
mulsd  0xe69(%rip),%xmm1
movapd %xmm1,%xmm0
lea    0xe76(%rip),%rsi
mov    %r14,%rdi
call   1050 <sprintf@plt>
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.sysentry = type { i32 }
@.str = [10 x i8] c"DesEntCap\00"
@.str.1 = [6 x i8] c"physc\00"
@.str.2 = [5 x i8] c"%.2f\00"
define void @get_per_entc(%struct.sysentry* %0, i8* %1) {
%3 = alloca %struct.sysentry*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca [32 x i8]
%7 = alloca [32 x i8]
store %struct.sysentry* %0, %struct.sysentry** %3
store i8* %1, i8** %4
%8 = getelementptr inbounds [32 x i8], [32 x i8]* %7, i64 0, i64 0
%9 = call i32 @get_sysdata(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8** %5, i8* %8)
%10 = getelementptr inbounds [32 x i8], [32 x i8]* %6, i64 0, i64 0
%11 = call i32 @get_sysdata(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8** %5, i8* %10)
%12 = load i8*, i8** %4
%13 = getelementptr inbounds [32 x i8], [32 x i8]* %6, i64 0, i64 0
%14 = call double @atof(i8* %13)
%15 = getelementptr inbounds [32 x i8], [32 x i8]* %7, i64 0, i64 0
%16 = call double @atof(i8* %15)
%17 = fdiv double %14, %16
%18 = fmul double %17, 1.000000e+02
%19 = call i32 @sprintf(i8* %12, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), double %18)
ret void
}

LLVM IR (-O2):
%struct.sysentry = type { i32 }
@.str = [10 x i8] c"DesEntCap\00"
@.str.1 = [6 x i8] c"physc\00"
@.str.2 = [5 x i8] c"%.2f\00"
define void @get_per_entc(%struct.sysentry* nocapture readnone %0, i8* nocapture writeonly %1) {
%3 = alloca i8*
%4 = alloca [32 x i8]
%5 = alloca [32 x i8]
%6 = bitcast i8** %3 to i8*
%7 = getelementptr inbounds [32 x i8], [32 x i8]* %4, i64 0, i64 0
%8 = getelementptr inbounds [32 x i8], [32 x i8]* %5, i64 0, i64 0
%9 = call i32 @get_sysdata(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8** %3, i8* %8)
%10 = call i32 @get_sysdata(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8** %3, i8* %7)
%11 = call double @atof(i8* %7)
%12 = call double @atof(i8* %8)
%13 = fdiv double %11, %12
%14 = fmul double %13, 1.000000e+02
%15 = call i32 @sprintf(i8* dereferenceable(1) %1, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), double %14)
ret void
}