#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 atoi(char *);
scalar_t__ isspace(char);
int bp_sw_number_from_equality(char *string) {
  char *st;
  for (; *string && *string != '='; string++)
    ;
  if (*string == '\0')
    return 0;
  for (; isspace(*string) && *string; string++)
    ;
  st = string;
  for (; !isspace(*string) && *string; string++)
    *string = '\0';
  return atoi(st);
}


x86 assembly (clang, -O0):
<bp_sw_number_from_equality>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x19(%rbp)
je     1151 <bp_sw_number_from_equality+0x31>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3d,%eax
setne  %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    1161 <bp_sw_number_from_equality+0x41>
jmp    1177 <bp_sw_number_from_equality+0x57>
jmp    1166 <bp_sw_number_from_equality+0x46>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    112c <bp_sw_number_from_equality+0xc>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1193 <bp_sw_number_from_equality+0x73>
movl   $0x0,-0x4(%rbp)
jmp    1256 <bp_sw_number_from_equality+0x136>
jmp    1198 <bp_sw_number_from_equality+0x78>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isspace@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x1a(%rbp)
je     11c6 <bp_sw_number_from_equality+0xa6>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x1a(%rbp)
mov    -0x1a(%rbp),%al
test   $0x1,%al
jne    11d6 <bp_sw_number_from_equality+0xb6>
jmp    11ec <bp_sw_number_from_equality+0xcc>
jmp    11db <bp_sw_number_from_equality+0xbb>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1198 <bp_sw_number_from_equality+0x78>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isspace@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x1b(%rbp)
jne    1222 <bp_sw_number_from_equality+0x102>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x1b(%rbp)
mov    -0x1b(%rbp),%al
test   $0x1,%al
jne    1232 <bp_sw_number_from_equality+0x112>
jmp    124a <bp_sw_number_from_equality+0x12a>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    11f4 <bp_sw_number_from_equality+0xd4>
mov    -0x18(%rbp),%rdi
call   1040 <atoi@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bp_sw_number_from_equality>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
nopw   0x0(%rax,%rax,1)
movzbl (%rbx),%eax
test   %al,%al
je     1141 <bp_sw_number_from_equality+0x21>
cmp    $0x3d,%al
je     114b <bp_sw_number_from_equality+0x2b>
add    $0x1,%rbx
jmp    1130 <bp_sw_number_from_equality+0x10>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    $0x3d,%edi
call   1030 <isspace@plt>
test   %rax,%rax
je     1169 <bp_sw_number_from_equality+0x49>
cmpb   $0x0,(%rbx)
je     1169 <bp_sw_number_from_equality+0x49>
movsbl 0x1(%rbx),%edi
add    $0x1,%rbx
jmp    1150 <bp_sw_number_from_equality+0x30>
movsbl (%rbx),%edi
call   1030 <isspace@plt>
test   %rax,%rax
jne    119d <bp_sw_number_from_equality+0x7d>
mov    %rbx,%r14
nopl   0x0(%rax)
cmpb   $0x0,(%r14)
je     119d <bp_sw_number_from_equality+0x7d>
movb   $0x0,(%r14)
movsbl 0x1(%r14),%edi
add    $0x1,%r14
call   1030 <isspace@plt>
test   %rax,%rax
je     1180 <bp_sw_number_from_equality+0x60>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <atoi@plt>

LLVM IR (-O0):
define i32 @bp_sw_number_from_equality(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
br label %5
5: ; preds = %18, %1
%6 = load i8*, i8** %3
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %15
10: ; preds = %5
%11 = load i8*, i8** %3
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = icmp ne i32 %13, 61
br label %15
15: ; preds = %10, %5
%16 = phi i1 [ false, %5 ], [ %14, %10 ]
br i1 %16, label %17, label %21
17: ; preds = %15
br label %18
18: ; preds = %17
%19 = load i8*, i8** %3
%20 = getelementptr inbounds i8, i8* %19, i32 1
store i8* %20, i8** %3
br label %5
21: ; preds = %15
%22 = load i8*, i8** %3
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = icmp eq i32 %24, 0
br i1 %25, label %26, label %27
26: ; preds = %21
store i32 0, i32* %2
br label %66
27: ; preds = %21
br label %28
28: ; preds = %41, %27
%29 = load i8*, i8** %3
%30 = load i8, i8* %29
%31 = call i64 @isspace(i8 signext %30)
%32 = icmp ne i64 %31, 0
br i1 %32, label %33, label %38
33: ; preds = %28
%34 = load i8*, i8** %3
%35 = load i8, i8* %34
%36 = sext i8 %35 to i32
%37 = icmp ne i32 %36, 0
br label %38
38: ; preds = %33, %28
%39 = phi i1 [ false, %28 ], [ %37, %33 ]
br i1 %39, label %40, label %44
40: ; preds = %38
br label %41
41: ; preds = %40
%42 = load i8*, i8** %3
%43 = getelementptr inbounds i8, i8* %42, i32 1
store i8* %43, i8** %3
br label %28
44: ; preds = %38
%45 = load i8*, i8** %3
store i8* %45, i8** %4
br label %46
46: ; preds = %60, %44
%47 = load i8*, i8** %3
%48 = load i8, i8* %47
%49 = call i64 @isspace(i8 signext %48)
%50 = icmp ne i64 %49, 0
br i1 %50, label %56, label %51
51: ; preds = %46
%52 = load i8*, i8** %3
%53 = load i8, i8* %52
%54 = sext i8 %53 to i32
%55 = icmp ne i32 %54, 0
br label %56
56: ; preds = %51, %46
%57 = phi i1 [ false, %46 ], [ %55, %51 ]
br i1 %57, label %58, label %63
58: ; preds = %56
%59 = load i8*, i8** %3
store i8 0, i8* %59
br label %60
60: ; preds = %58
%61 = load i8*, i8** %3
%62 = getelementptr inbounds i8, i8* %61, i32 1
store i8* %62, i8** %3
br label %46
63: ; preds = %56
%64 = load i8*, i8** %4
%65 = call i32 @atoi(i8* %64)
store i32 %65, i32* %2
br label %66
66: ; preds = %63, %26
%67 = load i32, i32* %2
ret i32 %67
}

LLVM IR (-O2):
define i32 @bp_sw_number_from_equality(i8* nocapture %0) {
br label %2
2: ; preds = %8, %1
%3 = phi i8* [ %0, %1 ], [ %9, %8 ]
%4 = load i8, i8* %3
switch i8 %4, label %8 [
i8 0, label %35
i8 61, label %5
]
5: ; preds = %2
%6 = tail call i64 @isspace(i8 signext 61)
%7 = icmp eq i64 %6, 0
br i1 %7, label %19, label %10
8: ; preds = %2
%9 = getelementptr inbounds i8, i8* %3, i64 1
br label %2
10: ; preds = %5, %14
%11 = phi i8* [ %15, %14 ], [ %3, %5 ]
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
br i1 %13, label %19, label %14
14: ; preds = %10
%15 = getelementptr inbounds i8, i8* %11, i64 1
%16 = load i8, i8* %15
%17 = tail call i64 @isspace(i8 signext %16)
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %10
19: ; preds = %10, %14, %5
%20 = phi i8* [ %3, %5 ], [ %15, %14 ], [ %11, %10 ]
%21 = load i8, i8* %20
%22 = tail call i64 @isspace(i8 signext %21)
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %33
24: ; preds = %19, %28
%25 = phi i8* [ %29, %28 ], [ %20, %19 ]
%26 = load i8, i8* %25
%27 = icmp eq i8 %26, 0
br i1 %27, label %33, label %28
28: ; preds = %24
store i8 0, i8* %25
%29 = getelementptr inbounds i8, i8* %25, i64 1
%30 = load i8, i8* %29
%31 = tail call i64 @isspace(i8 signext %30)
%32 = icmp eq i64 %31, 0
br i1 %32, label %24, label %33
33: ; preds = %24, %28, %19
%34 = tail call i32 @atoi(i8* %20)
br label %35
35: ; preds = %2, %33
%36 = phi i32 [ %34, %33 ], [ 0, %2 ]
ret i32 %36
}