#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 */

/* Variables and functions */
char get_ac_status();
float get_dem_status();
float get_num_status();
char *smprintf(char *, float, int);
char *get_status() {
  char acVal = get_ac_status();
  float num = get_num_status();
  float dem = get_dem_status();
  if (acVal == '1') {
    return smprintf("+%0.f%c", ((num * 100) / dem), 37);
  } else {
    return smprintf("-%0.f%c", ((num * 100) / dem), 37);
  }
}


x86 assembly (clang, -O0):
<get_status>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x0,%al
call   1050 <get_ac_status@plt>
mov    %al,-0x9(%rbp)
mov    $0x0,%al
call   1060 <get_num_status@plt>
movss  %xmm0,-0x10(%rbp)
mov    $0x0,%al
call   1040 <get_dem_status@plt>
movss  %xmm0,-0x14(%rbp)
movsbl -0x9(%rbp),%eax
cmp    $0x31,%eax
jne    11a3 <get_status+0x63>
movss  0xe81(%rip),%xmm0
mulss  -0x10(%rbp),%xmm0
divss  -0x14(%rbp),%xmm0
lea    0xe74(%rip),%rdi
mov    $0x25,%esi
call   1030 <smprintf@plt>
mov    %rax,-0x8(%rbp)
jmp    11ca <get_status+0x8a>
movss  0xe55(%rip),%xmm0
mulss  -0x10(%rbp),%xmm0
divss  -0x14(%rbp),%xmm0
lea    0xe50(%rip),%rdi
mov    $0x25,%esi
call   1030 <smprintf@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_status>:
push   %rbx
sub    $0x10,%rsp
xor    %eax,%eax
call   1050 <get_ac_status@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1060 <get_num_status@plt>
movss  %xmm0,0xc(%rsp)
xor    %eax,%eax
call   1040 <get_dem_status@plt>
cmp    $0x31,%bl
movss  0xc(%rsp),%xmm1
mulss  0xe8d(%rip),%xmm1
divss  %xmm0,%xmm1
movaps %xmm1,%xmm0
lea    0xe83(%rip),%rax
lea    0xe84(%rip),%rdi
cmove  %rax,%rdi
mov    $0x25,%esi
add    $0x10,%rsp
pop    %rbx
jmp    1030 <smprintf@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"+%0.f%c\00"
@.str.1 = [8 x i8] c"-%0.f%c\00"
define i8* @get_status() {
%1 = alloca i8*
%2 = alloca i8
%3 = alloca float
%4 = alloca float
%5 = call signext i8 (...) @get_ac_status()
store i8 %5, i8* %2
%6 = call float (...) @get_num_status()
store float %6, float* %3
%7 = call float (...) @get_dem_status()
store float %7, float* %4
%8 = load i8, i8* %2
%9 = sext i8 %8 to i32
%10 = icmp eq i32 %9, 49
br i1 %10, label %11, label %17
11: ; preds = %0
%12 = load float, float* %3
%13 = fmul float %12, 1.000000e+02
%14 = load float, float* %4
%15 = fdiv float %13, %14
%16 = call i8* @smprintf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), float %15, i32 37)
store i8* %16, i8** %1
br label %23
17: ; preds = %0
%18 = load float, float* %3
%19 = fmul float %18, 1.000000e+02
%20 = load float, float* %4
%21 = fdiv float %19, %20
%22 = call i8* @smprintf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), float %21, i32 37)
store i8* %22, i8** %1
br label %23
23: ; preds = %17, %11
%24 = load i8*, i8** %1
ret i8* %24
}

LLVM IR (-O2):
@.str = [8 x i8] c"+%0.f%c\00"
@.str.1 = [8 x i8] c"-%0.f%c\00"
define i8* @get_status() {
%1 = tail call signext i8 (...) @get_ac_status()
%2 = tail call float (...) @get_num_status()
%3 = tail call float (...) @get_dem_status()
%4 = icmp eq i8 %1, 49
%5 = fmul float %2, 1.000000e+02
%6 = fdiv float %5, %3
%7 = select i1 %4, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0)
%8 = tail call i8* @smprintf(i8* %7, float %6, i32 37)
ret i8* %8
}