#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 strlen(char *);
void SplitPM(char *s, int *Erg) {
  int l = strlen(s);
  if (l == 0)
    *Erg = 0;
  else if (s[l - 1] == '+') {
    s[l - 1] = '\0';
    *Erg = 1;
  } else if (s[l - 1] == '-') {
    s[l - 1] = '\0';
    *Erg = (-1);
  } else
    *Erg = 0;
}


x86 assembly (clang, -O0):
<SplitPM>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    1145 <SplitPM+0x35>
mov    -0x10(%rbp),%rax
movl   $0x0,(%rax)
jmp    11cd <SplitPM+0xbd>
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2b,%eax
jne    117f <SplitPM+0x6f>
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x10(%rbp),%rax
movl   $0x1,(%rax)
jmp    11c8 <SplitPM+0xb8>
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2d,%eax
jne    11b9 <SplitPM+0xa9>
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x10(%rbp),%rax
movl   $0xffffffff,(%rax)
jmp    11c3 <SplitPM+0xb3>
mov    -0x10(%rbp),%rax
movl   $0x0,(%rax)
jmp    11c8 <SplitPM+0xb8>
jmp    11cd <SplitPM+0xbd>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SplitPM>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <strlen@plt>
xor    %ecx,%ecx
test   %eax,%eax
je     1146 <SplitPM+0x36>
cltq
mov    -0x1(%rax,%rbx,1),%dl
cmp    $0x2b,%dl
je     113c <SplitPM+0x2c>
cmp    $0x2d,%dl
jne    1146 <SplitPM+0x36>
mov    $0xffffffff,%ecx
jmp    1141 <SplitPM+0x31>
mov    $0x1,%ecx
movb   $0x0,-0x1(%rbx,%rax,1)
mov    %ecx,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @SplitPM(i8* %0, i32* %1) {
%3 = alloca i8*
%4 = alloca i32*
%5 = alloca i32
store i8* %0, i8** %3
store i32* %1, i32** %4
%6 = load i8*, i8** %3
%7 = call i32 @strlen(i8* %6)
store i32 %7, i32* %5
%8 = load i32, i32* %5
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = load i32*, i32** %4
store i32 0, i32* %11
br label %48
12: ; preds = %2
%13 = load i8*, i8** %3
%14 = load i32, i32* %5
%15 = sub nsw i32 %14, 1
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8, i8* %13, i64 %16
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %19, 43
br i1 %20, label %21, label %28
21: ; preds = %12
%22 = load i8*, i8** %3
%23 = load i32, i32* %5
%24 = sub nsw i32 %23, 1
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8, i8* %22, i64 %25
store i8 0, i8* %26
%27 = load i32*, i32** %4
store i32 1, i32* %27
br label %47
28: ; preds = %12
%29 = load i8*, i8** %3
%30 = load i32, i32* %5
%31 = sub nsw i32 %30, 1
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i8, i8* %29, i64 %32
%34 = load i8, i8* %33
%35 = sext i8 %34 to i32
%36 = icmp eq i32 %35, 45
br i1 %36, label %37, label %44
37: ; preds = %28
%38 = load i8*, i8** %3
%39 = load i32, i32* %5
%40 = sub nsw i32 %39, 1
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds i8, i8* %38, i64 %41
store i8 0, i8* %42
%43 = load i32*, i32** %4
store i32 -1, i32* %43
br label %46
44: ; preds = %28
%45 = load i32*, i32** %4
store i32 0, i32* %45
br label %46
46: ; preds = %44, %37
br label %47
47: ; preds = %46, %21
br label %48
48: ; preds = %47, %10
ret void
}

LLVM IR (-O2):
define void @SplitPM(i8* %0, i32* nocapture writeonly %1) {
%3 = tail call i32 @strlen(i8* %0)
%4 = icmp eq i32 %3, 0
br i1 %4, label %13, label %5
5: ; preds = %2
%6 = add nsw i32 %3, -1
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i8, i8* %0, i64 %7
%9 = load i8, i8* %8
switch i8 %9, label %13 [
i8 43, label %11
i8 45, label %10
]
10: ; preds = %5
br label %11
11: ; preds = %5, %10
%12 = phi i32 [ -1, %10 ], [ 1, %5 ]
store i8 0, i8* %8
br label %13
13: ; preds = %11, %5, %2
%14 = phi i32 [ 0, %2 ], [ 0, %5 ], [ %12, %11 ]
store i32 %14, i32* %1
ret void
}