#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 *, double *);
int main() {
  double x1;
  double x2;
  printf("%s", "Enter 2 numbers:\n");
  printf("%s", "x1: ");
  scanf("%lf", &x1);
  printf("%s", "x2: ");
  scanf("%lf", &x2);
  printf("%s", "\n");
  printf("%s", "x1 + x2 = ");
  printf("%g", x1 + x2);
  printf("%s", "\nx1 - x2 = ");
  printf("%g", x1 - x2);
  printf("%s", "\nx1 * x2 = ");
  printf("%g", x1 * x2);
  printf("%s", "\nx1 / x2 = ");
  printf("%g", x1 / x2);
  if (x1 > 0 && x2 > 0) {
    printf("%s", "\n\nBoth numbers are positive!\n\n");
  } else {
    if (x1 < 0 && x2 < 0) {
      printf("%s", "\n\nBoth numbers are negative!\n\n");
    } else {
      printf("%s",
             "\n\nOne of them is positive and the other is negative!\n\n");
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    0xec6(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb5(%rip),%rdi
lea    0xec3(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeba(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xe90(%rip),%rdi
lea    0xea7(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe95(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xe6b(%rip),%rdi
lea    0xef5(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe56(%rip),%rdi
lea    0xe72(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  -0x10(%rbp),%xmm0
addsd  -0x18(%rbp),%xmm0
lea    0xe65(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xe29(%rip),%rdi
lea    0xe53(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  -0x10(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
lea    0xe38(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xdfc(%rip),%rdi
lea    0xe32(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  -0x10(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
lea    0xe0b(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xdcf(%rip),%rdi
lea    0xe11(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  -0x10(%rbp),%xmm0
divsd  -0x18(%rbp),%xmm0
lea    0xdde(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1295 <main+0x175>
movsd  -0x18(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1295 <main+0x175>
lea    0xd7e(%rip),%rdi
lea    0xdcc(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12e5 <main+0x1c5>
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    12cb <main+0x1ab>
xorps  %xmm0,%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    12cb <main+0x1ab>
lea    0xd48(%rip),%rdi
lea    0xdb5(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12e0 <main+0x1c0>
lea    0xd2e(%rip),%rdi
lea    0xdba(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12e5 <main+0x1c5>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0xef5(%rip),%rdi
call   1040 <puts@plt>
lea    0xea6(%rip),%r14
lea    0xea2(%rip),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe96(%rip),%rbx
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
lea    0xe86(%rip),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe63(%rip),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movsd  0x10(%rsp),%xmm0
addsd  0x8(%rsp),%xmm0
lea    0xe51(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
lea    0xe43(%rip),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movsd  0x10(%rsp),%xmm0
subsd  0x8(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
lea    0xe28(%rip),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movsd  0x10(%rsp),%xmm0
mulsd  0x8(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
lea    0xe0d(%rip),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movsd  0x10(%rsp),%xmm0
divsd  0x8(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movsd  0x8(%rsp),%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm0,%xmm1
lea    0xe2b(%rip),%rax
lea    0xdee(%rip),%rcx
cmovbe %rcx,%rax
movsd  0x10(%rsp),%xmm2
ucomisd %xmm2,%xmm1
cmovbe %rcx,%rax
ucomisd %xmm1,%xmm0
lea    0xe25(%rip),%rdi
cmovbe %rax,%rdi
ucomisd %xmm1,%xmm2
cmovbe %rax,%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [18 x i8] c"Enter 2 numbers:\0A\00"
@.str.2 = [5 x i8] c"x1: \00"
@.str.3 = [4 x i8] c"%lf\00"
@.str.4 = [5 x i8] c"x2: \00"
@.str.5 = [2 x i8] c"\0A\00"
@.str.6 = [11 x i8] c"x1 + x2 = \00"
@.str.7 = [3 x i8] c"%g\00"
@.str.8 = [12 x i8] c"\0Ax1 - x2 = \00"
@.str.9 = [12 x i8] c"\0Ax1 * x2 = \00"
@.str.10 = [12 x i8] c"\0Ax1 / x2 = \00"
@.str.11 = [31 x i8] c"\0A\0ABoth numbers are positive!\0A\0A\00"
@.str.12 = [31 x i8] c"\0A\0ABoth numbers are negative!\0A\0A\00"
@.str.13 = [55 x i8] c"\0A\0AOne of them is positive and the other is negative!\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), double* %2)
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), double* %3)
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0))
%11 = load double, double* %2
%12 = load double, double* %3
%13 = fadd double %11, %12
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), double %13)
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0))
%16 = load double, double* %2
%17 = load double, double* %3
%18 = fsub double %16, %17
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), double %18)
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.9, i64 0, i64 0))
%21 = load double, double* %2
%22 = load double, double* %3
%23 = fmul double %21, %22
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), double %23)
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0))
%26 = load double, double* %2
%27 = load double, double* %3
%28 = fdiv double %26, %27
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), double %28)
%30 = load double, double* %2
%31 = fcmp ogt double %30, 0.000000e+00
br i1 %31, label %32, label %37
32: ; preds = %0
%33 = load double, double* %3
%34 = fcmp ogt double %33, 0.000000e+00
br i1 %34, label %35, label %37
35: ; preds = %32
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.11, i64 0, i64 0))
br label %48
37: ; preds = %32, %0
%38 = load double, double* %2
%39 = fcmp olt double %38, 0.000000e+00
br i1 %39, label %40, label %45
40: ; preds = %37
%41 = load double, double* %3
%42 = fcmp olt double %41, 0.000000e+00
br i1 %42, label %43, label %45
43: ; preds = %40
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.12, i64 0, i64 0))
br label %47
45: ; preds = %40, %37
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.13, i64 0, i64 0))
br label %47
47: ; preds = %45, %43
br label %48
48: ; preds = %47, %35
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.2 = [5 x i8] c"x1: \00"
@.str.3 = [4 x i8] c"%lf\00"
@.str.4 = [5 x i8] c"x2: \00"
@.str.6 = [11 x i8] c"x1 + x2 = \00"
@.str.7 = [3 x i8] c"%g\00"
@.str.8 = [12 x i8] c"\0Ax1 - x2 = \00"
@.str.9 = [12 x i8] c"\0Ax1 * x2 = \00"
@.str.10 = [12 x i8] c"\0Ax1 / x2 = \00"
@str = [17 x i8] c"Enter 2 numbers:\00"
@str.14 = [54 x i8] c"\0A\0AOne of them is positive and the other is negative!\0A\00"
@str.15 = [30 x i8] c"\0A\0ABoth numbers are negative!\0A\00"
@str.16 = [30 x i8] c"\0A\0ABoth numbers are positive!\0A\00"
define i32 @main() {
%1 = alloca double
%2 = alloca double
%3 = bitcast double* %1 to i8*
%4 = bitcast double* %2 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), double* %1)
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), double* %2)
%10 = call i32 @putchar(i32 10)
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0))
%12 = load double, double* %1
%13 = load double, double* %2
%14 = fadd double %12, %13
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), double %14)
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0))
%17 = load double, double* %1
%18 = load double, double* %2
%19 = fsub double %17, %18
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), double %19)
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.9, i64 0, i64 0))
%22 = load double, double* %1
%23 = load double, double* %2
%24 = fmul double %22, %23
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), double %24)
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0))
%27 = load double, double* %1
%28 = load double, double* %2
%29 = fdiv double %27, %28
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), double %29)
%31 = load double, double* %1
%32 = fcmp ogt double %31, 0.000000e+00
%33 = load double, double* %2
%34 = fcmp ogt double %33, 0.000000e+00
%35 = select i1 %32, i1 %34, i1 false
%36 = fcmp olt double %31, 0.000000e+00
%37 = fcmp olt double %33, 0.000000e+00
%38 = select i1 %36, i1 %37, i1 false
%39 = select i1 %38, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @str.15, i64 0, i64 0), i8* getelementptr inbounds ([54 x i8], [54 x i8]* @str.14, i64 0, i64 0)
%40 = select i1 %35, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @str.16, i64 0, i64 0), i8* %39
%41 = call i32 @puts(i8* dereferenceable(1) %40)
ret i32 0
}