#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 sscanf(char *, char *, ...);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
char *strstr(char *, char *);
int getop(char s[], char line[]) {
  int i, c;
  char *sp, temp[100];
  double d;
  if (sscanf(line, "%s", &temp) == 1) {
    sp = strstr(line, temp) + strlen(temp);
    strcpy(line, sp);
    strcpy(s, temp);
    if (sscanf(temp, "%f", &d) == 1)
      return '0';
    else
      return s[0];
  } else
    return 0;
}


x86 assembly (clang, -O0):
<getop>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xea2(%rip),%rsi
lea    -0x90(%rbp),%rdx
mov    $0x0,%al
call   1050 <sscanf@plt>
cmp    $0x1,%eax
jne    1208 <getop+0xc8>
mov    -0x18(%rbp),%rdi
lea    -0x90(%rbp),%rsi
call   1060 <strstr@plt>
mov    %rax,-0xa0(%rbp)
lea    -0x90(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0xa0(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rdi
lea    -0x90(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x90(%rbp),%rdi
lea    0xe2d(%rip),%rsi
lea    -0x98(%rbp),%rdx
mov    $0x0,%al
call   1050 <sscanf@plt>
cmp    $0x1,%eax
jne    11f9 <getop+0xb9>
movl   $0x30,-0x4(%rbp)
jmp    120f <getop+0xcf>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    120f <getop+0xcf>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getop>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x78,%rsp
mov    %rsi,%rbx
mov    %rdi,%r14
lea    0xea9(%rip),%rsi
xor    %ebp,%ebp
lea    0x10(%rsp),%rdx
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <sscanf@plt>
cmp    $0x1,%eax
jne    11c5 <getop+0x85>
lea    0x10(%rsp),%r15
mov    %rbx,%rdi
mov    %r15,%rsi
call   1060 <strstr@plt>
mov    %rax,%rbp
mov    %r15,%rdi
call   1040 <strlen@plt>
movslq %eax,%rsi
add    %rbp,%rsi
mov    %rbx,%rdi
call   1030 <strcpy@plt>
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <strcpy@plt>
lea    0xe5b(%rip),%rsi
lea    0x8(%rsp),%rdx
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <sscanf@plt>
mov    $0x30,%ebp
cmp    $0x1,%eax
je     11c5 <getop+0x85>
movsbl (%r14),%ebp
mov    %ebp,%eax
add    $0x78,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [3 x i8] c"%f\00"
define i32 @getop(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
%9 = alloca [100 x i8]
%10 = alloca double
store i8* %0, i8** %4
store i8* %1, i8** %5
%11 = load i8*, i8** %5
%12 = call i32 (i8*, i8*, ...) @sscanf(i8* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), [100 x i8]* %9)
%13 = icmp eq i32 %12, 1
br i1 %13, label %14, label %37
14: ; preds = %2
%15 = load i8*, i8** %5
%16 = getelementptr inbounds [100 x i8], [100 x i8]* %9, i64 0, i64 0
%17 = call i8* @strstr(i8* %15, i8* %16)
%18 = getelementptr inbounds [100 x i8], [100 x i8]* %9, i64 0, i64 0
%19 = call i32 @strlen(i8* %18)
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8, i8* %17, i64 %20
store i8* %21, i8** %8
%22 = load i8*, i8** %5
%23 = load i8*, i8** %8
%24 = call i32 @strcpy(i8* %22, i8* %23)
%25 = load i8*, i8** %4
%26 = getelementptr inbounds [100 x i8], [100 x i8]* %9, i64 0, i64 0
%27 = call i32 @strcpy(i8* %25, i8* %26)
%28 = getelementptr inbounds [100 x i8], [100 x i8]* %9, i64 0, i64 0
%29 = call i32 (i8*, i8*, ...) @sscanf(i8* %28, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), double* %10)
%30 = icmp eq i32 %29, 1
br i1 %30, label %31, label %32
31: ; preds = %14
store i32 48, i32* %3
br label %38
32: ; preds = %14
%33 = load i8*, i8** %4
%34 = getelementptr inbounds i8, i8* %33, i64 0
%35 = load i8, i8* %34
%36 = sext i8 %35 to i32
store i32 %36, i32* %3
br label %38
37: ; preds = %2
store i32 0, i32* %3
br label %38
38: ; preds = %37, %32, %31
%39 = load i32, i32* %3
ret i32 %39
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [3 x i8] c"%f\00"
define i32 @getop(i8* %0, i8* %1) {
%3 = alloca [100 x i8]
%4 = alloca double
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%6 = bitcast double* %4 to i8*
%7 = call i32 (i8*, i8*, ...) @sscanf(i8* %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), [100 x i8]* %3)
%8 = icmp eq i32 %7, 1
br i1 %8, label %9, label %21
9: ; preds = %2
%10 = call i8* @strstr(i8* dereferenceable(1) %1, i8* %5)
%11 = call i32 @strlen(i8* %5)
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds i8, i8* %10, i64 %12
%14 = call i32 @strcpy(i8* %1, i8* %13)
%15 = call i32 @strcpy(i8* %0, i8* %5)
%16 = call i32 (i8*, i8*, ...) @sscanf(i8* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), double* %4)
%17 = icmp eq i32 %16, 1
br i1 %17, label %21, label %18
18: ; preds = %9
%19 = load i8, i8* %0
%20 = sext i8 %19 to i32
br label %21
21: ; preds = %2, %9, %18
%22 = phi i32 [ %20, %18 ], [ 48, %9 ], [ 0, %2 ]
ret i32 %22
}