#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 */
int /*<<< orphan*/ EXIT_SUCCESS;
float atof(char *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int log10(float);
int /*<<< orphan*/ printf(char *, float);
int /*<<< orphan*/ usage(char *);
int main(int argc, char *argv[]) {
  if (argc != 2) {
    usage(argv[0]);
    exit(EXIT_SUCCESS);
  }
  float x = atof(argv[1]);
  float val = -10 * log10(x);
  printf("minlog10: %4.6f\n", val);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     118a <main+0x3a>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1050 <usage@plt>
mov    0x2e5d(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <atof@plt>
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
call   1060 <log10@plt>
imul   $0xfffffff6,%eax,%eax
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x18(%rbp),%xmm0
lea    0xe3f(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x2,%edi
jne    1182 <main+0x32>
mov    0x8(%rsi),%rdi
call   1030 <atof@plt>
call   1060 <log10@plt>
add    %eax,%eax
lea    (%rax,%rax,4),%eax
neg    %eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
lea    0xe87(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret
mov    (%rsi),%rdi
call   1050 <usage@plt>
mov    0x2e4f(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@EXIT_SUCCESS = global i32 0
@.str = [17 x i8] c"minlog10: %4.6f\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca float
%7 = alloca float
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = icmp ne i32 %8, 2
br i1 %9, label %10, label %17
10: ; preds = %2
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 0
%13 = load i8*, i8** %12
%14 = call i32 @usage(i8* %13)
%15 = load i32, i32* @EXIT_SUCCESS
%16 = call i32 @exit(i32 %15)
unreachable
17: ; preds = %2
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 1
%20 = load i8*, i8** %19
%21 = call float @atof(i8* %20)
store float %21, float* %6
%22 = load float, float* %6
%23 = call i32 @log10(float %22)
%24 = mul nsw i32 -10, %23
%25 = sitofp i32 %24 to float
store float %25, float* %7
%26 = load float, float* %7
%27 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), float %26)
ret i32 0
}

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
@.str = [17 x i8] c"minlog10: %4.6f\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %9, label %4
4: ; preds = %2
%5 = load i8*, i8** %1
%6 = tail call i32 @usage(i8* %5)
%7 = load i32, i32* @EXIT_SUCCESS
%8 = tail call i32 @exit(i32 %7)
unreachable
9: ; preds = %2
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = tail call float @atof(i8* %11)
%13 = tail call i32 @log10(float %12)
%14 = mul nsw i32 %13, -10
%15 = sitofp i32 %14 to float
%16 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), float %15)
ret i32 0
}