#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 abs(int);
int sgn(int);
char vrz(int x) {
  return ((abs(x) == 2)    ? '?'
          : (sgn(x) == 0)  ? '0'
          : (sgn(x) == 1)  ? '+'
          : (sgn(x) == -1) ? '-'
                           : '?');
}


x86 assembly (clang, -O0):
<vrz>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <abs@plt>
cmp    $0x2,%eax
jne    1149 <vrz+0x29>
mov    $0x3f,%eax
mov    %eax,-0x8(%rbp)
jmp    11ae <vrz+0x8e>
mov    -0x4(%rbp),%edi
call   1040 <sgn@plt>
cmp    $0x0,%eax
jne    1167 <vrz+0x47>
mov    $0x30,%eax
mov    %eax,-0xc(%rbp)
jmp    11a8 <vrz+0x88>
mov    -0x4(%rbp),%edi
call   1040 <sgn@plt>
cmp    $0x1,%eax
jne    1185 <vrz+0x65>
mov    $0x2b,%eax
mov    %eax,-0x10(%rbp)
jmp    11a2 <vrz+0x82>
mov    -0x4(%rbp),%edi
call   1040 <sgn@plt>
mov    %eax,%edx
mov    $0x3f,%eax
mov    $0x2d,%ecx
cmp    $0xffffffff,%edx
cmove  %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
movsbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vrz>:
push   %rbx
mov    %edi,%ecx
neg    %ecx
cmovs  %edi,%ecx
mov    $0x3f,%al
cmp    $0x2,%ecx
je     1151 <vrz+0x41>
mov    %edi,%ebx
call   1030 <sgn@plt>
test   %eax,%eax
je     1153 <vrz+0x43>
mov    %ebx,%edi
call   1030 <sgn@plt>
mov    %eax,%ecx
mov    $0x2b,%al
cmp    $0x1,%ecx
je     1151 <vrz+0x41>
mov    %ebx,%edi
call   1030 <sgn@plt>
cmp    $0xffffffff,%eax
mov    $0x2d,%ecx
mov    $0x3f,%eax
cmove  %ecx,%eax
pop    %rbx
ret
mov    $0x30,%al
pop    %rbx
ret

LLVM IR (-O0):
define signext i8 @vrz(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @abs(i32 %3)
%5 = icmp eq i32 %4, 2
br i1 %5, label %6, label %7
6: ; preds = %1
br label %27
7: ; preds = %1
%8 = load i32, i32* %2
%9 = call i32 @sgn(i32 %8)
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %7
br label %25
12: ; preds = %7
%13 = load i32, i32* %2
%14 = call i32 @sgn(i32 %13)
%15 = icmp eq i32 %14, 1
br i1 %15, label %16, label %17
16: ; preds = %12
br label %23
17: ; preds = %12
%18 = load i32, i32* %2
%19 = call i32 @sgn(i32 %18)
%20 = icmp eq i32 %19, -1
%21 = zext i1 %20 to i64
%22 = select i1 %20, i32 45, i32 63
br label %23
23: ; preds = %17, %16
%24 = phi i32 [ 43, %16 ], [ %22, %17 ]
br label %25
25: ; preds = %23, %11
%26 = phi i32 [ 48, %11 ], [ %24, %23 ]
br label %27
27: ; preds = %25, %6
%28 = phi i32 [ 63, %6 ], [ %26, %25 ]
%29 = trunc i32 %28 to i8
ret i8 %29
}

LLVM IR (-O2):
define signext i8 @vrz(i32 %0) {
%2 = tail call i32 @llvm.abs.i32(i32 %0, i1 true)
%3 = icmp eq i32 %2, 2
br i1 %3, label %14, label %4
4: ; preds = %1
%5 = tail call i32 @sgn(i32 %0)
%6 = icmp eq i32 %5, 0
br i1 %6, label %14, label %7
7: ; preds = %4
%8 = tail call i32 @sgn(i32 %0)
%9 = icmp eq i32 %8, 1
br i1 %9, label %14, label %10
10: ; preds = %7
%11 = tail call i32 @sgn(i32 %0)
%12 = icmp eq i32 %11, -1
%13 = select i1 %12, i8 45, i8 63
br label %14
14: ; preds = %4, %7, %10, %1
%15 = phi i8 [ 63, %1 ], [ 48, %4 ], [ %13, %10 ], [ 43, %7 ]
ret i8 %15
}