#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*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, float *);
int main(int argc, char *argv[]) {
  float f, m, a;
  printf("Enter 0 to solve for this value.\n");
  printf("Force: ");
  scanf("%f", &f);
  printf("Mass: ");
  scanf("%f", &m);
  printf("Acceleration: ");
  scanf("%f", &a);
  if (m && a) {
    printf("F = %f\n", m * a);
  } else if (f && a) {
    printf("M = %f\n", f / a);
  } else if (m && f) {
    printf("A = %f\n", f / m);
  } else {
    printf("Not enough data!\n");
  }
  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)
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed1(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xec4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb3(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xead(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe95(%rip),%rdi
lea    -0x1c(%rbp),%rsi
call   1040 <scanf@plt>
movss  -0x18(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    11ba <main+0x9a>
jp     11ba <main+0x9a>
jmp    11f7 <main+0xd7>
movss  -0x1c(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    11d6 <main+0xb6>
jp     11d6 <main+0xb6>
jmp    11f7 <main+0xd7>
movss  -0x18(%rbp),%xmm0
mulss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe58(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    12c1 <main+0x1a1>
movss  -0x14(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    1213 <main+0xf3>
jp     1213 <main+0xf3>
jmp    1250 <main+0x130>
movss  -0x1c(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    122f <main+0x10f>
jp     122f <main+0x10f>
jmp    1250 <main+0x130>
movss  -0x14(%rbp),%xmm0
divss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe07(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    12bc <main+0x19c>
movss  -0x18(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    126c <main+0x14c>
jp     126c <main+0x14c>
jmp    12a9 <main+0x189>
movss  -0x14(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    1288 <main+0x168>
jp     1288 <main+0x168>
jmp    12a9 <main+0x189>
movss  -0x14(%rbp),%xmm0
divss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xdb6(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    12b7 <main+0x197>
lea    0xdab(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12bc <main+0x19c>
jmp    12c1 <main+0x1a1>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xefd(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb8(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeb2(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xea1(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xe8d(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
movss  0x8(%rsp),%xmm0
xorps  %xmm3,%xmm3
ucomiss %xmm3,%xmm0
movss  0x4(%rsp),%xmm2
jne    11af <main+0x7f>
jnp    11c7 <main+0x97>
ucomiss %xmm3,%xmm2
jne    11b6 <main+0x86>
jnp    11c7 <main+0x97>
mulss  %xmm2,%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe5c(%rip),%rdi
jmp    1215 <main+0xe5>
movss  0xc(%rsp),%xmm1
ucomiss %xmm3,%xmm1
jne    11d4 <main+0xa4>
jnp    11f2 <main+0xc2>
xorps  %xmm3,%xmm3
ucomiss %xmm3,%xmm2
jne    11de <main+0xae>
jnp    11f2 <main+0xc2>
divss  %xmm2,%xmm1
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
lea    0xe39(%rip),%rdi
jmp    1215 <main+0xe5>
xorps  %xmm2,%xmm2
ucomiss %xmm2,%xmm0
jne    11fc <main+0xcc>
jnp    1224 <main+0xf4>
ucomiss %xmm2,%xmm1
jne    1203 <main+0xd3>
jnp    1224 <main+0xf4>
divss  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
lea    0xe1c(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret
lea    0xe2f(%rip),%rdi
call   1030 <puts@plt>
jmp    121c <main+0xec>

LLVM IR (-O0):
@.str = [34 x i8] c"Enter 0 to solve for this value.\0A\00"
@.str.1 = [8 x i8] c"Force: \00"
@.str.2 = [3 x i8] c"%f\00"
@.str.3 = [7 x i8] c"Mass: \00"
@.str.4 = [15 x i8] c"Acceleration: \00"
@.str.5 = [8 x i8] c"F = %f\0A\00"
@.str.6 = [8 x i8] c"M = %f\0A\00"
@.str.7 = [8 x i8] c"A = %f\0A\00"
@.str.8 = [18 x i8] c"Not enough data!\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca float
%7 = alloca float
%8 = alloca float
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %6)
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %7)
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0))
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %8)
%16 = load float, float* %7
%17 = fcmp une float %16, 0.000000e+00
br i1 %17, label %18, label %27
18: ; preds = %2
%19 = load float, float* %8
%20 = fcmp une float %19, 0.000000e+00
br i1 %20, label %21, label %27
21: ; preds = %18
%22 = load float, float* %7
%23 = load float, float* %8
%24 = fmul float %22, %23
%25 = fpext float %24 to double
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), double %25)
br label %55
27: ; preds = %18, %2
%28 = load float, float* %6
%29 = fcmp une float %28, 0.000000e+00
br i1 %29, label %30, label %39
30: ; preds = %27
%31 = load float, float* %8
%32 = fcmp une float %31, 0.000000e+00
br i1 %32, label %33, label %39
33: ; preds = %30
%34 = load float, float* %6
%35 = load float, float* %8
%36 = fdiv float %34, %35
%37 = fpext float %36 to double
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), double %37)
br label %54
39: ; preds = %30, %27
%40 = load float, float* %7
%41 = fcmp une float %40, 0.000000e+00
br i1 %41, label %42, label %51
42: ; preds = %39
%43 = load float, float* %6
%44 = fcmp une float %43, 0.000000e+00
br i1 %44, label %45, label %51
45: ; preds = %42
%46 = load float, float* %6
%47 = load float, float* %7
%48 = fdiv float %46, %47
%49 = fpext float %48 to double
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), double %49)
br label %53
51: ; preds = %42, %39
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.8, i64 0, i64 0))
br label %53
53: ; preds = %51, %45
br label %54
54: ; preds = %53, %33
br label %55
55: ; preds = %54, %21
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [8 x i8] c"Force: \00"
@.str.2 = [3 x i8] c"%f\00"
@.str.3 = [7 x i8] c"Mass: \00"
@.str.4 = [15 x i8] c"Acceleration: \00"
@.str.5 = [8 x i8] c"F = %f\0A\00"
@.str.6 = [8 x i8] c"M = %f\0A\00"
@.str.7 = [8 x i8] c"A = %f\0A\00"
@str = [33 x i8] c"Enter 0 to solve for this value.\00"
@str.9 = [17 x i8] c"Not enough data!\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = bitcast float* %3 to i8*
%7 = bitcast float* %4 to i8*
%8 = bitcast float* %5 to i8*
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str, i64 0, i64 0))
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %3)
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %4)
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0))
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %5)
%16 = load float, float* %4
%17 = fcmp une float %16, 0.000000e+00
%18 = load float, float* %5
%19 = fcmp une float %18, 0.000000e+00
%20 = select i1 %17, i1 %19, i1 false
br i1 %20, label %21, label %25
21: ; preds = %2
%22 = fmul float %16, %18
%23 = fpext float %22 to double
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), double %23)
br label %41
25: ; preds = %2
%26 = load float, float* %3
%27 = fcmp une float %26, 0.000000e+00
%28 = select i1 %27, i1 %19, i1 false
br i1 %28, label %29, label %33
29: ; preds = %25
%30 = fdiv float %26, %18
%31 = fpext float %30 to double
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), double %31)
br label %41
33: ; preds = %25
%34 = select i1 %17, i1 %27, i1 false
br i1 %34, label %35, label %39
35: ; preds = %33
%36 = fdiv float %26, %16
%37 = fpext float %36 to double
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), double %37)
br label %41
39: ; preds = %33
%40 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.9, i64 0, i64 0))
br label %41
41: ; preds = %29, %39, %35, %21
ret i32 0
}