int unary_operator_check(char *symbol) {
  char operations[2][3] = {"++", "!"};
  int j = 0;
  if (strcmp(symbol, "") == 0)
    return 0;
  for (j = 0; j < 2; j++)
    if (strcmp(symbol, operations[j]) == 0)
      return 1;
  return 0;
}


x86 assembly (clang, -O0):
<unary_operator_check>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    0xede(%rip),%eax
mov    %eax,-0x16(%rbp)
mov    0xed8(%rip),%ax
mov    %ax,-0x12(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xec4(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    115c <unary_operator_check+0x4c>
movl   $0x0,-0x4(%rbp)
jmp    11b4 <unary_operator_check+0xa4>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x2,-0x1c(%rbp)
jge    11ad <unary_operator_check+0x9d>
mov    -0x10(%rbp),%rdi
movslq -0x1c(%rbp),%rax
lea    -0x16(%rbp),%rsi
imul   $0x3,%rax,%rax
add    %rax,%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    119a <unary_operator_check+0x8a>
movl   $0x1,-0x4(%rbp)
jmp    11b4 <unary_operator_check+0xa4>
jmp    119f <unary_operator_check+0x8f>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1163 <unary_operator_check+0x53>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<unary_operator_check>:
push   %rbx
cmpb   $0x0,(%rdi)
je     1143 <unary_operator_check+0x33>
mov    %rdi,%rbx
lea    0xee0(%rip),%rsi
call   1030 <strcmp@plt>
test   %eax,%eax
je     1147 <unary_operator_check+0x37>
lea    0xed3(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
sete   %al
pop    %rbx
ret
xor    %eax,%eax
pop    %rbx
ret
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
@__const.unary_operator_check.operations = [2 x [3 x i8]] [[3 x i8] c"++\00", [3 x i8] c"!\00\00"]
@.str = [1 x i8] zeroinitializer
define i32 @unary_operator_check(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca [2 x [3 x i8]]
%5 = alloca i32
store i8* %0, i8** %3
%6 = bitcast [2 x [3 x i8]]* %4 to i8*
store i32 0, i32* %5
%7 = load i8*, i8** %3
%8 = call i32 @strcmp(i8* %7, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %1
store i32 0, i32* %2
br label %29
11: ; preds = %1
store i32 0, i32* %5
br label %12
12: ; preds = %25, %11
%13 = load i32, i32* %5
%14 = icmp slt i32 %13, 2
br i1 %14, label %15, label %28
15: ; preds = %12
%16 = load i8*, i8** %3
%17 = load i32, i32* %5
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [2 x [3 x i8]], [2 x [3 x i8]]* %4, i64 0, i64 %18
%20 = getelementptr inbounds [3 x i8], [3 x i8]* %19, i64 0, i64 0
%21 = call i32 @strcmp(i8* %16, i8* %20)
%22 = icmp eq i32 %21, 0
br i1 %22, label %23, label %24
23: ; preds = %15
store i32 1, i32* %2
br label %29
24: ; preds = %15
br label %25
25: ; preds = %24
%26 = load i32, i32* %5
%27 = add nsw i32 %26, 1
store i32 %27, i32* %5
br label %12
28: ; preds = %12
store i32 0, i32* %2
br label %29
29: ; preds = %28, %23, %10
%30 = load i32, i32* %2
ret i32 %30
}

LLVM IR (-O2):
@__const.unary_operator_check.operations = [2 x [3 x i8]] [[3 x i8] c"++\00", [3 x i8] c"!\00\00"]
define i32 @unary_operator_check(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %1
%5 = tail call i32 @strcmp(i8* %0, i8* getelementptr inbounds ([2 x [3 x i8]], [2 x [3 x i8]]* @__const.unary_operator_check.operations, i64 0, i64 0, i64 0))
%6 = icmp eq i32 %5, 0
br i1 %6, label %11, label %7
7: ; preds = %4
%8 = tail call i32 @strcmp(i8* %0, i8* getelementptr inbounds ([2 x [3 x i8]], [2 x [3 x i8]]* @__const.unary_operator_check.operations, i64 0, i64 1, i64 0))
%9 = icmp eq i32 %8, 0
%10 = zext i1 %9 to i32
br label %11
11: ; preds = %7, %4, %1
%12 = phi i32 [ 0, %1 ], [ 1, %4 ], [ %10, %7 ]
ret i32 %12
}