#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__ is_number(char *);
int read_number(char *);
scalar_t__ strcmp(char *, char *);
void parse_element(char *elem, int *type, int *value) {
  if (strcmp(elem, "+") == 0) {
    *type = 110;
    *value = 11;
  } else if (strcmp(elem, "-") == 0) {
    *type = 110;
    *value = 12;
  } else if (strcmp(elem, "*") == 0) {
    *type = 110;
    *value = 17;
  } else if (strcmp(elem, "/") == 0) {
    *type = 110;
    *value = 13;
  } else if (strcmp(elem, "%") == 0) {
    *type = 110;
    *value = 14;
  } else if (strcmp(elem, "exp") == 0) {
    *type = 110;
    *value = 15;
  } else if (strcmp(elem, "log") == 0) {
    *type = 110;
    *value = 16;
  } else if (is_number(elem)) {
    *type = 111;
    *value = read_number(elem);
  } else {
    *type = 112;
    *value = 1110187;
  }
}


x86 assembly (clang, -O0):
<parse_element>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xeb1(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1177 <parse_element+0x47>
mov    -0x10(%rbp),%rax
movl   $0x6e,(%rax)
mov    -0x18(%rbp),%rax
movl   $0xb,(%rax)
jmp    1313 <parse_element+0x1e3>
mov    -0x8(%rbp),%rdi
lea    0xe80(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11aa <parse_element+0x7a>
mov    -0x10(%rbp),%rax
movl   $0x6e,(%rax)
mov    -0x18(%rbp),%rax
movl   $0xc,(%rax)
jmp    130e <parse_element+0x1de>
mov    -0x8(%rbp),%rdi
lea    0xe4f(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11dd <parse_element+0xad>
mov    -0x10(%rbp),%rax
movl   $0x6e,(%rax)
mov    -0x18(%rbp),%rax
movl   $0x11,(%rax)
jmp    1309 <parse_element+0x1d9>
mov    -0x8(%rbp),%rdi
lea    0xe1e(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1210 <parse_element+0xe0>
mov    -0x10(%rbp),%rax
movl   $0x6e,(%rax)
mov    -0x18(%rbp),%rax
movl   $0xd,(%rax)
jmp    1304 <parse_element+0x1d4>
mov    -0x8(%rbp),%rdi
lea    0xded(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1243 <parse_element+0x113>
mov    -0x10(%rbp),%rax
movl   $0x6e,(%rax)
mov    -0x18(%rbp),%rax
movl   $0xe,(%rax)
jmp    12ff <parse_element+0x1cf>
mov    -0x8(%rbp),%rdi
lea    0xdbc(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1276 <parse_element+0x146>
mov    -0x10(%rbp),%rax
movl   $0x6e,(%rax)
mov    -0x18(%rbp),%rax
movl   $0xf,(%rax)
jmp    12fa <parse_element+0x1ca>
mov    -0x8(%rbp),%rdi
lea    0xd8d(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    12a9 <parse_element+0x179>
mov    -0x10(%rbp),%rax
movl   $0x6e,(%rax)
mov    -0x18(%rbp),%rax
movl   $0x10,(%rax)
jmp    12f5 <parse_element+0x1c5>
mov    -0x8(%rbp),%rdi
call   1030 <is_number@plt>
cmp    $0x0,%rax
je     12dc <parse_element+0x1ac>
mov    -0x10(%rbp),%rax
movl   $0x6f,(%rax)
mov    -0x8(%rbp),%rdi
call   1050 <read_number@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
jmp    12f0 <parse_element+0x1c0>
mov    -0x10(%rbp),%rax
movl   $0x70,(%rax)
mov    -0x18(%rbp),%rax
movl   $0x10f0ab,(%rax)
jmp    12f5 <parse_element+0x1c5>
jmp    12fa <parse_element+0x1ca>
jmp    12ff <parse_element+0x1cf>
jmp    1304 <parse_element+0x1d4>
jmp    1309 <parse_element+0x1d9>
jmp    130e <parse_element+0x1de>
jmp    1313 <parse_element+0x1e3>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_element>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
lea    0xebb(%rip),%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     11f5 <parse_element+0xc5>
lea    0xea8(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     1203 <parse_element+0xd3>
lea    0xe92(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     1211 <parse_element+0xe1>
lea    0xe7c(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     121f <parse_element+0xef>
lea    0xe66(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     122d <parse_element+0xfd>
lea    0xe54(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     123b <parse_element+0x10b>
lea    0xe44(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     1249 <parse_element+0x119>
mov    %rbx,%rdi
call   1030 <is_number@plt>
test   %rax,%rax
je     1257 <parse_element+0x127>
movl   $0x6f,(%r15)
mov    %rbx,%rdi
call   1050 <read_number@plt>
jmp    1263 <parse_element+0x133>
movl   $0x6e,(%r15)
mov    $0xb,%eax
jmp    1263 <parse_element+0x133>
movl   $0x6e,(%r15)
mov    $0xc,%eax
jmp    1263 <parse_element+0x133>
movl   $0x6e,(%r15)
mov    $0x11,%eax
jmp    1263 <parse_element+0x133>
movl   $0x6e,(%r15)
mov    $0xd,%eax
jmp    1263 <parse_element+0x133>
movl   $0x6e,(%r15)
mov    $0xe,%eax
jmp    1263 <parse_element+0x133>
movl   $0x6e,(%r15)
mov    $0xf,%eax
jmp    1263 <parse_element+0x133>
movl   $0x6e,(%r15)
mov    $0x10,%eax
jmp    1263 <parse_element+0x133>
movl   $0x70,(%r15)
mov    $0x10f0ab,%eax
mov    %eax,(%r14)
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"
@.str.4 = [2 x i8] c"%\00"
@.str.5 = [4 x i8] c"exp\00"
@.str.6 = [4 x i8] c"log\00"
define void @parse_element(i8* %0, i32* %1, i32* %2) {
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i32*
store i8* %0, i8** %4
store i32* %1, i32** %5
store i32* %2, i32** %6
%7 = load i8*, i8** %4
%8 = call i64 @strcmp(i8* %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %3
%11 = load i32*, i32** %5
store i32 110, i32* %11
%12 = load i32*, i32** %6
store i32 11, i32* %12
br label %74
13: ; preds = %3
%14 = load i8*, i8** %4
%15 = call i64 @strcmp(i8* %14, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %20
17: ; preds = %13
%18 = load i32*, i32** %5
store i32 110, i32* %18
%19 = load i32*, i32** %6
store i32 12, i32* %19
br label %73
20: ; preds = %13
%21 = load i8*, i8** %4
%22 = call i64 @strcmp(i8* %21, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %27
24: ; preds = %20
%25 = load i32*, i32** %5
store i32 110, i32* %25
%26 = load i32*, i32** %6
store i32 17, i32* %26
br label %72
27: ; preds = %20
%28 = load i8*, i8** %4
%29 = call i64 @strcmp(i8* %28, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%30 = icmp eq i64 %29, 0
br i1 %30, label %31, label %34
31: ; preds = %27
%32 = load i32*, i32** %5
store i32 110, i32* %32
%33 = load i32*, i32** %6
store i32 13, i32* %33
br label %71
34: ; preds = %27
%35 = load i8*, i8** %4
%36 = call i64 @strcmp(i8* %35, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%37 = icmp eq i64 %36, 0
br i1 %37, label %38, label %41
38: ; preds = %34
%39 = load i32*, i32** %5
store i32 110, i32* %39
%40 = load i32*, i32** %6
store i32 14, i32* %40
br label %70
41: ; preds = %34
%42 = load i8*, i8** %4
%43 = call i64 @strcmp(i8* %42, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%44 = icmp eq i64 %43, 0
br i1 %44, label %45, label %48
45: ; preds = %41
%46 = load i32*, i32** %5
store i32 110, i32* %46
%47 = load i32*, i32** %6
store i32 15, i32* %47
br label %69
48: ; preds = %41
%49 = load i8*, i8** %4
%50 = call i64 @strcmp(i8* %49, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
%51 = icmp eq i64 %50, 0
br i1 %51, label %52, label %55
52: ; preds = %48
%53 = load i32*, i32** %5
store i32 110, i32* %53
%54 = load i32*, i32** %6
store i32 16, i32* %54
br label %68
55: ; preds = %48
%56 = load i8*, i8** %4
%57 = call i64 @is_number(i8* %56)
%58 = icmp ne i64 %57, 0
br i1 %58, label %59, label %64
59: ; preds = %55
%60 = load i32*, i32** %5
store i32 111, i32* %60
%61 = load i8*, i8** %4
%62 = call i32 @read_number(i8* %61)
%63 = load i32*, i32** %6
store i32 %62, i32* %63
br label %67
64: ; preds = %55
%65 = load i32*, i32** %5
store i32 112, i32* %65
%66 = load i32*, i32** %6
store i32 1110187, i32* %66
br label %67
67: ; preds = %64, %59
br label %68
68: ; preds = %67, %52
br label %69
69: ; preds = %68, %45
br label %70
70: ; preds = %69, %38
br label %71
71: ; preds = %70, %31
br label %72
72: ; preds = %71, %24
br label %73
73: ; preds = %72, %17
br label %74
74: ; preds = %73, %10
ret void
}

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"
@.str.4 = [2 x i8] c"%\00"
@.str.5 = [4 x i8] c"exp\00"
@.str.6 = [4 x i8] c"log\00"
define void @parse_element(i8* %0, i32* nocapture writeonly %1, i32* nocapture writeonly %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 %7
6: ; preds = %3
store i32 110, i32* %1
br label %37
7: ; preds = %3
%8 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %7
store i32 110, i32* %1
br label %37
11: ; preds = %7
%12 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %15
14: ; preds = %11
store i32 110, i32* %1
br label %37
15: ; preds = %11
%16 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %19
18: ; preds = %15
store i32 110, i32* %1
br label %37
19: ; preds = %15
%20 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %23
22: ; preds = %19
store i32 110, i32* %1
br label %37
23: ; preds = %19
%24 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%25 = icmp eq i64 %24, 0
br i1 %25, label %26, label %27
26: ; preds = %23
store i32 110, i32* %1
br label %37
27: ; preds = %23
%28 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
%29 = icmp eq i64 %28, 0
br i1 %29, label %30, label %31
30: ; preds = %27
store i32 110, i32* %1
br label %37
31: ; preds = %27
%32 = tail call i64 @is_number(i8* %0)
%33 = icmp eq i64 %32, 0
br i1 %33, label %36, label %34
34: ; preds = %31
store i32 111, i32* %1
%35 = tail call i32 @read_number(i8* %0)
br label %37
36: ; preds = %31
store i32 112, i32* %1
br label %37
37: ; preds = %10, %18, %26, %34, %36, %30, %22, %14, %6
%38 = phi i32 [ 12, %10 ], [ 13, %18 ], [ 15, %26 ], [ %35, %34 ], [ 1110187, %36 ], [ 16, %30 ], [ 14, %22 ], [ 17, %14 ], [ 11, %6 ]
store i32 %38, i32* %2
ret void
}