#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_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ printf(char *);
int scanf(char *, double *, double *, double *);
int /*<<< orphan*/ stderr;
int main() {
  double first, second, third;
  int sign = 0;
  printf("Enter 3 numbers: ");
  if ((scanf("%lf%lf%lf", &first, &second, &third)) != 3) {
    fprintf(stderr, "Wrong input values!");
    exit(EXIT_FAILURE);
  }
  if (first == 0.0 || second == 0.0 || third == 0.0) {
    printf("0");
  } else {
    if (first < 0.0) {
      sign++;
    }
    if (second < 0.0) {
      sign++;
    }
    if (third < 0.0) {
      sign++;
    }
    switch (sign) {
    case 0:
      printf("+");
      break;
    case 1:
      printf("-");
      break;
    case 2:
      printf("+");
      break;
    default:
      printf("-");
    }
  }
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x24(%rbp)
lea    0xea3(%rip),%rdi
call   1030 <printf@plt>
lea    0xea9(%rip),%rdi
lea    -0x10(%rbp),%rsi
lea    -0x18(%rbp),%rdx
lea    -0x20(%rbp),%rcx
call   1050 <scanf@plt>
cmp    $0x3,%eax
je     11a6 <main+0x66>
mov    0x2e56(%rip),%rax
mov    (%rax),%edi
lea    0xe89(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e39(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    11c3 <main+0x83>
jp     11c3 <main+0x83>
jmp    11f8 <main+0xb8>
movsd  -0x18(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    11e0 <main+0xa0>
jp     11e0 <main+0xa0>
jmp    11f8 <main+0xb8>
movsd  -0x20(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1209 <main+0xc9>
jp     1209 <main+0xc9>
lea    0xe31(%rip),%rdi
call   1030 <printf@plt>
jmp    12c7 <main+0x187>
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    1220 <main+0xe0>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    1237 <main+0xf7>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    124e <main+0x10e>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x28(%rbp)
test   %eax,%eax
je     1283 <main+0x143>
jmp    1261 <main+0x121>
mov    -0x28(%rbp),%eax
sub    $0x1,%eax
je     1294 <main+0x154>
jmp    1272 <main+0x132>
mov    -0x28(%rbp),%eax
sub    $0x2,%eax
je     12a5 <main+0x165>
jmp    12b6 <main+0x176>
lea    0xda8(%rip),%rdi
call   1030 <printf@plt>
jmp    12c2 <main+0x182>
lea    0xd99(%rip),%rdi
call   1030 <printf@plt>
jmp    12c2 <main+0x182>
lea    0xd86(%rip),%rdi
call   1030 <printf@plt>
jmp    12c2 <main+0x182>
lea    0xd77(%rip),%rdi
call   1030 <printf@plt>
jmp    12c7 <main+0x187>
mov    0x2d02(%rip),%rax
mov    (%rax),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xea5(%rip),%rdi
call   1040 <printf@plt>
lea    0xeab(%rip),%rdi
lea    0x10(%rsp),%rsi
lea    0x8(%rsp),%rdx
mov    %rsp,%rcx
call   1060 <scanf@plt>
cmp    $0x3,%eax
jne    11fb <main+0xab>
movsd  0x10(%rsp),%xmm0
xorpd  %xmm2,%xmm2
ucomisd %xmm2,%xmm0
mov    $0x30,%edi
jne    1195 <main+0x45>
jnp    11e8 <main+0x98>
movsd  0x8(%rsp),%xmm1
ucomisd %xmm2,%xmm1
jne    11a3 <main+0x53>
jnp    11e8 <main+0x98>
movsd  (%rsp),%xmm2
xorpd  %xmm3,%xmm3
ucomisd %xmm3,%xmm2
jne    11b4 <main+0x64>
jnp    11e8 <main+0x98>
xor    %eax,%eax
ucomisd %xmm0,%xmm3
seta   %al
lea    0x1(%rax),%ecx
ucomisd %xmm1,%xmm3
cmovbe %eax,%ecx
xor    %eax,%eax
ucomisd %xmm2,%xmm3
seta   %al
add    %ecx,%eax
mov    $0x2d,%edi
cmp    $0x2,%eax
ja     11e8 <main+0x98>
mov    %eax,%eax
lea    0xe4b(%rip),%rcx
mov    (%rcx,%rax,4),%edi
call   1030 <putchar@plt>
mov    0x2ddc(%rip),%rax
mov    (%rax),%eax
add    $0x18,%rsp
ret
mov    0x2dde(%rip),%rax
mov    (%rax),%edi
lea    0xe11(%rip),%rsi
call   1050 <fprintf@plt>
mov    0x2dc1(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [18 x i8] c"Enter 3 numbers: \00"
@.str.1 = [10 x i8] c"%lf%lf%lf\00"
@stderr = global i32 0
@.str.2 = [20 x i8] c"Wrong input values!\00"
@EXIT_FAILURE = global i32 0
@.str.3 = [2 x i8] c"0\00"
@.str.4 = [2 x i8] c"+\00"
@.str.5 = [2 x i8] c"-\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %5
%6 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), double* %2, double* %3, double* %4)
%8 = icmp ne i32 %7, 3
br i1 %8, label %9, label %14
9: ; preds = %0
%10 = load i32, i32* @stderr
%11 = call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
%12 = load i32, i32* @EXIT_FAILURE
%13 = call i32 @exit(i32 %12)
unreachable
14: ; preds = %0
%15 = load double, double* %2
%16 = fcmp oeq double %15, 0.000000e+00
br i1 %16, label %23, label %17
17: ; preds = %14
%18 = load double, double* %3
%19 = fcmp oeq double %18, 0.000000e+00
br i1 %19, label %23, label %20
20: ; preds = %17
%21 = load double, double* %4
%22 = fcmp oeq double %21, 0.000000e+00
br i1 %22, label %23, label %25
23: ; preds = %20, %17, %14
%24 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %54
25: ; preds = %20
%26 = load double, double* %2
%27 = fcmp olt double %26, 0.000000e+00
br i1 %27, label %28, label %31
28: ; preds = %25
%29 = load i32, i32* %5
%30 = add nsw i32 %29, 1
store i32 %30, i32* %5
br label %31
31: ; preds = %28, %25
%32 = load double, double* %3
%33 = fcmp olt double %32, 0.000000e+00
br i1 %33, label %34, label %37
34: ; preds = %31
%35 = load i32, i32* %5
%36 = add nsw i32 %35, 1
store i32 %36, i32* %5
br label %37
37: ; preds = %34, %31
%38 = load double, double* %4
%39 = fcmp olt double %38, 0.000000e+00
br i1 %39, label %40, label %43
40: ; preds = %37
%41 = load i32, i32* %5
%42 = add nsw i32 %41, 1
store i32 %42, i32* %5
br label %43
43: ; preds = %40, %37
%44 = load i32, i32* %5
switch i32 %44, label %51 [
i32 0, label %45
i32 1, label %47
i32 2, label %49
]
45: ; preds = %43
%46 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %53
47: ; preds = %43
%48 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %53
49: ; preds = %43
%50 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %53
51: ; preds = %43
%52 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %53
53: ; preds = %51, %49, %47, %45
br label %54
54: ; preds = %53, %23
%55 = load i32, i32* @EXIT_SUCCESS
ret i32 %55
}

LLVM IR (-O2):
@.str = [18 x i8] c"Enter 3 numbers: \00"
@.str.1 = [10 x i8] c"%lf%lf%lf\00"
@stderr = global i32 0
@.str.2 = [20 x i8] c"Wrong input values!\00"
@EXIT_FAILURE = global i32 0
@EXIT_SUCCESS = global i32 0
@switch.table.main = [3 x i32] [i32 43, i32 45, i32 43]
define i32 @main() {
%1 = alloca double
%2 = alloca double
%3 = alloca double
%4 = bitcast double* %1 to i8*
%5 = bitcast double* %2 to i8*
%6 = bitcast double* %3 to i8*
%7 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), double* %1, double* %2, double* %3)
%9 = icmp eq i32 %8, 3
br i1 %9, label %15, label %10
10: ; preds = %0
%11 = load i32, i32* @stderr
%12 = call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
%13 = load i32, i32* @EXIT_FAILURE
%14 = call i32 @exit(i32 %13)
unreachable
15: ; preds = %0
%16 = load double, double* %1
%17 = fcmp oeq double %16, 0.000000e+00
%18 = load double, double* %2
%19 = fcmp oeq double %18, 0.000000e+00
%20 = select i1 %17, i1 true, i1 %19
%21 = load double, double* %3
%22 = fcmp oeq double %21, 0.000000e+00
%23 = select i1 %20, i1 true, i1 %22
br i1 %23, label %38, label %24
24: ; preds = %15
%25 = fcmp olt double %16, 0.000000e+00
%26 = zext i1 %25 to i32
%27 = fcmp olt double %18, 0.000000e+00
%28 = select i1 %25, i32 2, i32 1
%29 = select i1 %27, i32 %28, i32 %26
%30 = fcmp olt double %21, 0.000000e+00
%31 = zext i1 %30 to i32
%32 = add nuw nsw i32 %29, %31
%33 = icmp ult i32 %32, 3
br i1 %33, label %34, label %38
34: ; preds = %24
%35 = zext i32 %32 to i64
%36 = getelementptr inbounds [3 x i32], [3 x i32]* @switch.table.main, i64 0, i64 %35
%37 = load i32, i32* %36
br label %38
38: ; preds = %24, %34, %15
%39 = phi i32 [ 48, %15 ], [ %37, %34 ], [ 45, %24 ]
%40 = call i32 @putchar(i32 %39)
%41 = load i32, i32* @EXIT_SUCCESS
ret i32 %41
}