#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 */
double fabs(double);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, double *);
int main(void) {
  double pH;
  printf("Indtast pH værdi\n");
  (void)scanf("%lf", &pH);
  printf("%lf\n", fabs(pH - 7));
  if (pH > 7) {
    if (pH < 12) {
      printf("Alkaline\n");
    } else {
      printf("Very alkaline\n");
    }
  } else if (fabs(pH - 7) < 2.2204460492503131e-16) {
    printf("Neutral\n");
  } else if (pH > 2) {
    printf("Acidic\n");
  } else {
    printf("Very acidic\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xefa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeff(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
movsd  -0x10(%rbp),%xmm0
movsd  0xea6(%rip),%xmm1
subsd  %xmm1,%xmm0
movaps 0xebb(%rip),%xmm1
pand   %xmm1,%xmm0
lea    0xed7(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x10(%rbp),%xmm0
movsd  0xe7c(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    11c7 <main+0xa7>
movsd  0xe82(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    11b4 <main+0x94>
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11c2 <main+0xa2>
lea    0xe9b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    124a <main+0x12a>
movsd  -0x10(%rbp),%xmm1
movsd  0xe2c(%rip),%xmm0
subsd  %xmm0,%xmm1
movaps 0xe41(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  0xe1d(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1208 <main+0xe8>
lea    0xe69(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1245 <main+0x125>
movsd  -0x10(%rbp),%xmm0
movsd  0xdfb(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1232 <main+0x112>
lea    0xe48(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1240 <main+0x120>
lea    0xe3d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1245 <main+0x125>
jmp    124a <main+0x12a>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xf11(%rip),%rdi
call   1030 <puts@plt>
lea    0xefc(%rip),%rdi
mov    %rsp,%rsi
call   1050 <scanf@plt>
movsd  (%rsp),%xmm0
addsd  0xea7(%rip),%xmm0
andpd  0xecf(%rip),%xmm0
lea    0xedc(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  (%rsp),%xmm0
ucomisd 0xe8c(%rip),%xmm0
jbe    119a <main+0x6a>
movsd  0xe9a(%rip),%xmm1
ucomisd %xmm0,%xmm1
lea    0xef3(%rip),%rax
lea    0xede(%rip),%rdi
jmp    11db <main+0xab>
movsd  0xe5e(%rip),%xmm1
addsd  %xmm0,%xmm1
andpd  0xe82(%rip),%xmm1
movsd  0xe5a(%rip),%xmm2
ucomisd %xmm1,%xmm2
jbe    11c5 <main+0x95>
lea    0xeab(%rip),%rdi
jmp    11df <main+0xaf>
ucomisd 0xe4b(%rip),%xmm0
lea    0xe93(%rip),%rax
lea    0xe80(%rip),%rdi
cmova  %rax,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [19 x i8] c"Indtast pH v\C3\A6rdi\0A\00"
@.str.1 = [4 x i8] c"%lf\00"
@.str.2 = [5 x i8] c"%lf\0A\00"
@.str.3 = [10 x i8] c"Alkaline\0A\00"
@.str.4 = [15 x i8] c"Very alkaline\0A\00"
@.str.5 = [9 x i8] c"Neutral\0A\00"
@.str.6 = [8 x i8] c"Acidic\0A\00"
@.str.7 = [13 x i8] c"Very acidic\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %2)
%5 = load double, double* %2
%6 = fsub double %5, 7.000000e+00
%7 = call double @llvm.fabs.f64(double %6)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), double %7)
%9 = load double, double* %2
%10 = fcmp ogt double %9, 7.000000e+00
br i1 %10, label %11, label %19
11: ; preds = %0
%12 = load double, double* %2
%13 = fcmp olt double %12, 1.200000e+01
br i1 %13, label %14, label %16
14: ; preds = %11
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
br label %18
16: ; preds = %11
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0))
br label %18
18: ; preds = %16, %14
br label %35
19: ; preds = %0
%20 = load double, double* %2
%21 = fsub double %20, 7.000000e+00
%22 = call double @llvm.fabs.f64(double %21)
%23 = fcmp olt double %22, 0x3CB0000000000000
br i1 %23, label %24, label %26
24: ; preds = %19
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0))
br label %34
26: ; preds = %19
%27 = load double, double* %2
%28 = fcmp ogt double %27, 2.000000e+00
br i1 %28, label %29, label %31
29: ; preds = %26
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0))
br label %33
31: ; preds = %26
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0))
br label %33
33: ; preds = %31, %29
br label %34
34: ; preds = %33, %24
br label %35
35: ; preds = %34, %18
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [4 x i8] c"%lf\00"
@.str.2 = [5 x i8] c"%lf\0A\00"
@str = [18 x i8] c"Indtast pH v\C3\A6rdi\00"
@str.8 = [12 x i8] c"Very acidic\00"
@str.9 = [7 x i8] c"Acidic\00"
@str.10 = [8 x i8] c"Neutral\00"
@str.11 = [14 x i8] c"Very alkaline\00"
@str.12 = [9 x i8] c"Alkaline\00"
define i32 @main() {
%1 = alloca double
%2 = bitcast double* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %1)
%5 = load double, double* %1
%6 = fadd double %5, -7.000000e+00
%7 = call double @llvm.fabs.f64(double %6)
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), double %7)
%9 = load double, double* %1
%10 = fcmp ogt double %9, 7.000000e+00
br i1 %10, label %11, label %14
11: ; preds = %0
%12 = fcmp olt double %9, 1.200000e+01
%13 = select i1 %12, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @str.12, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @str.11, i64 0, i64 0)
br label %21
14: ; preds = %0
%15 = fadd double %9, -7.000000e+00
%16 = call double @llvm.fabs.f64(double %15)
%17 = fcmp olt double %16, 0x3CB0000000000000
br i1 %17, label %21, label %18
18: ; preds = %14
%19 = fcmp ogt double %9, 2.000000e+00
%20 = select i1 %19, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @str.9, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @str.8, i64 0, i64 0)
br label %21
21: ; preds = %18, %14, %11
%22 = phi i8* [ %13, %11 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @str.10, i64 0, i64 0), %14 ], [ %20, %18 ]
%23 = call i32 @puts(i8* dereferenceable(1) %22)
ret i32 0
}