#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 *);
unsigned short int iscommand(char string[1000]) {
  unsigned short int ret = 0;
  char sin[1000] = "sin";
  char exp[1000] = "exp";
  char pow[1000] = "pow";
  if (strcmp(string, sin) == 0)
    ret = 1;
  else if (strcmp(string, exp) == 0)
    ret = 2;
  else if (strcmp(string, pow) == 0)
    ret = 3;
  else
    ret = 0;
  return ret;
}


x86 assembly (clang, -O0):
<iscommand>:
push   %rbp
mov    %rsp,%rbp
sub    $0xbe0,%rsp
mov    %rdi,-0x8(%rbp)
movw   $0x0,-0xa(%rbp)
lea    -0x400(%rbp),%rdi
xor    %esi,%esi
mov    $0x3e8,%edx
call   1030 <memset@plt>
movb   $0x73,-0x400(%rbp)
movb   $0x69,-0x3ff(%rbp)
movb   $0x6e,-0x3fe(%rbp)
lea    -0x7f0(%rbp),%rdi
xor    %esi,%esi
mov    $0x3e8,%edx
call   1030 <memset@plt>
movb   $0x65,-0x7f0(%rbp)
movb   $0x78,-0x7ef(%rbp)
movb   $0x70,-0x7ee(%rbp)
lea    -0xbe0(%rbp),%rdi
xor    %esi,%esi
mov    $0x3e8,%edx
call   1030 <memset@plt>
movb   $0x70,-0xbe0(%rbp)
movb   $0x6f,-0xbdf(%rbp)
movb   $0x77,-0xbde(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x400(%rbp),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11d2 <iscommand+0xb2>
movw   $0x1,-0xa(%rbp)
jmp    122c <iscommand+0x10c>
mov    -0x8(%rbp),%rdi
lea    -0x7f0(%rbp),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11f7 <iscommand+0xd7>
movw   $0x2,-0xa(%rbp)
jmp    1227 <iscommand+0x107>
mov    -0x8(%rbp),%rdi
lea    -0xbe0(%rbp),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    121c <iscommand+0xfc>
movw   $0x3,-0xa(%rbp)
jmp    1222 <iscommand+0x102>
movw   $0x0,-0xa(%rbp)
jmp    1227 <iscommand+0x107>
jmp    122c <iscommand+0x10c>
movzwl -0xa(%rbp),%eax
add    $0xbe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<iscommand>:
push   %r14
push   %rbx
sub    $0xbc8,%rsp
mov    %rdi,%rbx
lea    0x7e0(%rsp),%r14
mov    $0x3e8,%edx
mov    %r14,%rdi
xor    %esi,%esi
call   1030 <memset@plt>
movw   $0x6973,0x7e0(%rsp)
movb   $0x6e,0x7e2(%rsp)
6e
lea    0x3f0(%rsp),%rdi
mov    $0x3e8,%edx
xor    %esi,%esi
call   1030 <memset@plt>
movw   $0x7865,0x3f0(%rsp)
movb   $0x70,0x3f2(%rsp)
70
mov    %rsp,%rdi
mov    $0x3e8,%edx
xor    %esi,%esi
call   1030 <memset@plt>
movw   $0x6f70,(%rsp)
movb   $0x77,0x2(%rsp)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     11d3 <iscommand+0xb3>
lea    0x3f0(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     11d9 <iscommand+0xb9>
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
lea    (%rcx,%rcx,2),%eax
jmp    11dd <iscommand+0xbd>
mov    $0x1,%ax
jmp    11dd <iscommand+0xbd>
mov    $0x2,%ax
add    $0xbc8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define zeroext i16 @iscommand(i8* %0) {
%2 = alloca i8*
%3 = alloca i16
%4 = alloca [1000 x i8]
%5 = alloca [1000 x i8]
%6 = alloca [1000 x i8]
store i8* %0, i8** %2
store i16 0, i16* %3
%7 = bitcast [1000 x i8]* %4 to i8*
%8 = bitcast i8* %7 to [1000 x i8]*
%9 = getelementptr inbounds [1000 x i8], [1000 x i8]* %8, i32 0, i32 0
store i8 115, i8* %9
%10 = getelementptr inbounds [1000 x i8], [1000 x i8]* %8, i32 0, i32 1
store i8 105, i8* %10
%11 = getelementptr inbounds [1000 x i8], [1000 x i8]* %8, i32 0, i32 2
store i8 110, i8* %11
%12 = bitcast [1000 x i8]* %5 to i8*
%13 = bitcast i8* %12 to [1000 x i8]*
%14 = getelementptr inbounds [1000 x i8], [1000 x i8]* %13, i32 0, i32 0
store i8 101, i8* %14
%15 = getelementptr inbounds [1000 x i8], [1000 x i8]* %13, i32 0, i32 1
store i8 120, i8* %15
%16 = getelementptr inbounds [1000 x i8], [1000 x i8]* %13, i32 0, i32 2
store i8 112, i8* %16
%17 = bitcast [1000 x i8]* %6 to i8*
%18 = bitcast i8* %17 to [1000 x i8]*
%19 = getelementptr inbounds [1000 x i8], [1000 x i8]* %18, i32 0, i32 0
store i8 112, i8* %19
%20 = getelementptr inbounds [1000 x i8], [1000 x i8]* %18, i32 0, i32 1
store i8 111, i8* %20
%21 = getelementptr inbounds [1000 x i8], [1000 x i8]* %18, i32 0, i32 2
store i8 119, i8* %21
%22 = load i8*, i8** %2
%23 = getelementptr inbounds [1000 x i8], [1000 x i8]* %4, i64 0, i64 0
%24 = call i64 @strcmp(i8* %22, i8* %23)
%25 = icmp eq i64 %24, 0
br i1 %25, label %26, label %27
26: ; preds = %1
store i16 1, i16* %3
br label %42
27: ; preds = %1
%28 = load i8*, i8** %2
%29 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, i64 0, i64 0
%30 = call i64 @strcmp(i8* %28, i8* %29)
%31 = icmp eq i64 %30, 0
br i1 %31, label %32, label %33
32: ; preds = %27
store i16 2, i16* %3
br label %41
33: ; preds = %27
%34 = load i8*, i8** %2
%35 = getelementptr inbounds [1000 x i8], [1000 x i8]* %6, i64 0, i64 0
%36 = call i64 @strcmp(i8* %34, i8* %35)
%37 = icmp eq i64 %36, 0
br i1 %37, label %38, label %39
38: ; preds = %33
store i16 3, i16* %3
br label %40
39: ; preds = %33
store i16 0, i16* %3
br label %40
40: ; preds = %39, %38
br label %41
41: ; preds = %40, %32
br label %42
42: ; preds = %41, %26
%43 = load i16, i16* %3
ret i16 %43
}

LLVM IR (-O2):
define zeroext i16 @iscommand(i8* %0) {
%2 = alloca [1000 x i8]
%3 = alloca [1000 x i8]
%4 = alloca [1000 x i8]
%5 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 0
store i8 115, i8* %5
%6 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 1
store i8 105, i8* %6
%7 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 2
store i8 110, i8* %7
%8 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 0
store i8 101, i8* %8
%9 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 1
store i8 120, i8* %9
%10 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 2
store i8 112, i8* %10
%11 = getelementptr inbounds [1000 x i8], [1000 x i8]* %4, i64 0, i64 0
store i8 112, i8* %11
%12 = getelementptr inbounds [1000 x i8], [1000 x i8]* %4, i64 0, i64 1
store i8 111, i8* %12
%13 = getelementptr inbounds [1000 x i8], [1000 x i8]* %4, i64 0, i64 2
store i8 119, i8* %13
%14 = call i64 @strcmp(i8* %0, i8* %5)
%15 = icmp eq i64 %14, 0
br i1 %15, label %23, label %16
16: ; preds = %1
%17 = call i64 @strcmp(i8* %0, i8* %8)
%18 = icmp eq i64 %17, 0
br i1 %18, label %23, label %19
19: ; preds = %16
%20 = call i64 @strcmp(i8* %0, i8* %11)
%21 = icmp eq i64 %20, 0
%22 = select i1 %21, i16 3, i16 0
br label %23
23: ; preds = %19, %16, %1
%24 = phi i16 [ 1, %1 ], [ 2, %16 ], [ %22, %19 ]
ret i16 %24
}