#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 */
scalar_t__ strcmp(char *, char *);
long izracunajPredhodna(char *znaki, long prvo, long drugo) {
  if (strcmp(znaki, "-") == 0) {
    return prvo - drugo;
  } else if (strcmp(znaki, "+") == 0) {
    return prvo + drugo;
  } else if (strcmp(znaki, "/") == 0) {
    return prvo / drugo;
  } else if (strcmp(znaki, "*") == 0) {
    return prvo * drugo;
  }
  return 0;
}


x86 assembly (clang, -O0):
<izracunajPredhodna>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xed1(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    114f <izracunajPredhodna+0x3f>
mov    -0x18(%rbp),%rax
sub    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    11ea <izracunajPredhodna+0xda>
mov    -0x10(%rbp),%rdi
lea    0xea8(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    117a <izracunajPredhodna+0x6a>
mov    -0x18(%rbp),%rax
add    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    11ea <izracunajPredhodna+0xda>
mov    -0x10(%rbp),%rdi
lea    0xe7f(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    11a7 <izracunajPredhodna+0x97>
mov    -0x18(%rbp),%rax
cqto
idivq  -0x20(%rbp)
mov    %rax,-0x8(%rbp)
jmp    11ea <izracunajPredhodna+0xda>
mov    -0x10(%rbp),%rdi
lea    0xe54(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    11d3 <izracunajPredhodna+0xc3>
mov    -0x18(%rbp),%rax
imul   -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    11ea <izracunajPredhodna+0xda>
jmp    11d8 <izracunajPredhodna+0xc8>
jmp    11dd <izracunajPredhodna+0xcd>
jmp    11e2 <izracunajPredhodna+0xd2>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<izracunajPredhodna>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
lea    0xedb(%rip),%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     1176 <izracunajPredhodna+0x66>
lea    0xecc(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     117b <izracunajPredhodna+0x6b>
lea    0xeba(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     1180 <izracunajPredhodna+0x70>
lea    0xea8(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
imul   %r15,%r14
xor    %r15d,%r15d
test   %rax,%rax
cmove  %r14,%r15
jmp    11a4 <izracunajPredhodna+0x94>
sub    %r14,%r15
jmp    11a4 <izracunajPredhodna+0x94>
add    %r14,%r15
jmp    11a4 <izracunajPredhodna+0x94>
mov    %r15,%rax
or     %r14,%rax
shr    $0x20,%rax
je     1199 <izracunajPredhodna+0x89>
mov    %r15,%rax
cqto
idiv   %r14
mov    %rax,%r15
jmp    11a4 <izracunajPredhodna+0x94>
mov    %r15d,%eax
xor    %edx,%edx
div    %r14d
mov    %eax,%r15d
mov    %r15,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [2 x i8] c"-\00"
@.str.1 = [2 x i8] c"+\00"
@.str.2 = [2 x i8] c"/\00"
@.str.3 = [2 x i8] c"*\00"
define i64 @izracunajPredhodna(i8* %0, i64 %1, i64 %2) {
%4 = alloca i64
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i64
store i8* %0, i8** %5
store i64 %1, i64* %6
store i64 %2, i64* %7
%8 = load i8*, i8** %5
%9 = call i64 @strcmp(i8* %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %15
11: ; preds = %3
%12 = load i64, i64* %6
%13 = load i64, i64* %7
%14 = sub nsw i64 %12, %13
store i64 %14, i64* %4
br label %43
15: ; preds = %3
%16 = load i8*, i8** %5
%17 = call i64 @strcmp(i8* %16, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %23
19: ; preds = %15
%20 = load i64, i64* %6
%21 = load i64, i64* %7
%22 = add nsw i64 %20, %21
store i64 %22, i64* %4
br label %43
23: ; preds = %15
%24 = load i8*, i8** %5
%25 = call i64 @strcmp(i8* %24, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%26 = icmp eq i64 %25, 0
br i1 %26, label %27, label %31
27: ; preds = %23
%28 = load i64, i64* %6
%29 = load i64, i64* %7
%30 = sdiv i64 %28, %29
store i64 %30, i64* %4
br label %43
31: ; preds = %23
%32 = load i8*, i8** %5
%33 = call i64 @strcmp(i8* %32, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%34 = icmp eq i64 %33, 0
br i1 %34, label %35, label %39
35: ; preds = %31
%36 = load i64, i64* %6
%37 = load i64, i64* %7
%38 = mul nsw i64 %36, %37
store i64 %38, i64* %4
br label %43
39: ; preds = %31
br label %40
40: ; preds = %39
br label %41
41: ; preds = %40
br label %42
42: ; preds = %41
store i64 0, i64* %4
br label %43
43: ; preds = %42, %35, %27, %19, %11
%44 = load i64, i64* %4
ret i64 %44
}

LLVM IR (-O2):
@.str = [2 x i8] c"-\00"
@.str.1 = [2 x i8] c"+\00"
@.str.2 = [2 x i8] c"/\00"
@.str.3 = [2 x i8] c"*\00"
define i64 @izracunajPredhodna(i8* %0, i64 %1, i64 %2) {
%4 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = sub nsw i64 %1, %2
br label %23
8: ; preds = %3
%9 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %8
%12 = add nsw i64 %2, %1
br label %23
13: ; preds = %8
%14 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %13
%17 = sdiv i64 %1, %2
br label %23
18: ; preds = %13
%19 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%20 = icmp eq i64 %19, 0
%21 = mul nsw i64 %2, %1
%22 = select i1 %20, i64 %21, i64 0
br label %23
23: ; preds = %18, %16, %11, %6
%24 = phi i64 [ %7, %6 ], [ %12, %11 ], [ %17, %16 ], [ %22, %18 ]
ret i64 %24
}