#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 /*<<< orphan*/ replace_minus(char *);
scalar_t__ strcmp(char *, char *);
int main(void) {
  char before1[64] = "-2+1";
  char after1[64] = "(0-2)+1";
  replace_minus(before1);
  if (strcmp(before1, after1) != 0) {
    return (-1);
  }
  char before2[64] = "3-2";
  char after2[64] = "3-2";
  replace_minus(before2);
  if (strcmp(before2, after2) != 0) {
    return (-1);
  }
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x50(%rbp),%rdi
xor    %esi,%esi
mov    $0x40,%edx
call   1030 <memset@plt>
movb   $0x2d,-0x50(%rbp)
movb   $0x32,-0x4f(%rbp)
movb   $0x2b,-0x4e(%rbp)
movb   $0x31,-0x4d(%rbp)
lea    -0x90(%rbp),%rdi
lea    0xe80(%rip),%rsi
mov    $0x40,%edx
call   1050 <memcpy@plt>
lea    -0x50(%rbp),%rdi
call   1060 <replace_minus@plt>
lea    -0x50(%rbp),%rdi
lea    -0x90(%rbp),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     11b9 <main+0x79>
movl   $0xffffffff,-0x4(%rbp)
jmp    1245 <main+0x105>
lea    -0xd0(%rbp),%rdi
xor    %esi,%esi
mov    $0x40,%edx
call   1030 <memset@plt>
movb   $0x33,-0xd0(%rbp)
movb   $0x2d,-0xcf(%rbp)
movb   $0x32,-0xce(%rbp)
lea    -0x110(%rbp),%rdi
xor    %esi,%esi
mov    $0x40,%edx
call   1030 <memset@plt>
movb   $0x33,-0x110(%rbp)
movb   $0x2d,-0x10f(%rbp)
movb   $0x32,-0x10e(%rbp)
lea    -0xd0(%rbp),%rdi
call   1060 <replace_minus@plt>
lea    -0xd0(%rbp),%rdi
lea    -0x110(%rbp),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     123e <main+0xfe>
movl   $0xffffffff,-0x4(%rbp)
jmp    1245 <main+0x105>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x100,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0xb0(%rsp)
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0x90(%rsp)
movl   $0x312b322d,0x80(%rsp)
2d 32 2b 31
movaps 0xed3(%rip),%xmm0
movaps %xmm0,0xf0(%rsp)
movaps 0xeb4(%rip),%xmm0
movaps %xmm0,0xe0(%rsp)
movaps 0xe95(%rip),%xmm0
movaps %xmm0,0xd0(%rsp)
movaps 0xe76(%rip),%xmm0
movaps %xmm0,0xc0(%rsp)
lea    0x80(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <replace_minus@plt>
lea    0xc0(%rsp),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
mov    %rax,%rcx
mov    $0xffffffff,%eax
test   %rcx,%rcx
jne    121d <main+0xfd>
xorps  %xmm0,%xmm0
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movw   $0x2d33,0x40(%rsp)
movb   $0x32,0x42(%rsp)
movaps %xmm0,(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movw   $0x2d33,(%rsp)
movb   $0x32,0x2(%rsp)
lea    0x40(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <replace_minus@plt>
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
neg    %rax
sbb    %eax,%eax
add    $0x100,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.after1 = [64 x i8] c"(0-2)+1\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [64 x i8]
%3 = alloca [64 x i8]
%4 = alloca [64 x i8]
%5 = alloca [64 x i8]
store i32 0, i32* %1
%6 = bitcast [64 x i8]* %2 to i8*
%7 = bitcast i8* %6 to [64 x i8]*
%8 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i32 0, i32 0
store i8 45, i8* %8
%9 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i32 0, i32 1
store i8 50, i8* %9
%10 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i32 0, i32 2
store i8 43, i8* %10
%11 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i32 0, i32 3
store i8 49, i8* %11
%12 = bitcast [64 x i8]* %3 to i8*
%13 = getelementptr inbounds [64 x i8], [64 x i8]* %2, i64 0, i64 0
%14 = call i32 @replace_minus(i8* %13)
%15 = getelementptr inbounds [64 x i8], [64 x i8]* %2, i64 0, i64 0
%16 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%17 = call i64 @strcmp(i8* %15, i8* %16)
%18 = icmp ne i64 %17, 0
br i1 %18, label %19, label %20
19: ; preds = %0
store i32 -1, i32* %1
br label %39
20: ; preds = %0
%21 = bitcast [64 x i8]* %4 to i8*
%22 = bitcast i8* %21 to [64 x i8]*
%23 = getelementptr inbounds [64 x i8], [64 x i8]* %22, i32 0, i32 0
store i8 51, i8* %23
%24 = getelementptr inbounds [64 x i8], [64 x i8]* %22, i32 0, i32 1
store i8 45, i8* %24
%25 = getelementptr inbounds [64 x i8], [64 x i8]* %22, i32 0, i32 2
store i8 50, i8* %25
%26 = bitcast [64 x i8]* %5 to i8*
%27 = bitcast i8* %26 to [64 x i8]*
%28 = getelementptr inbounds [64 x i8], [64 x i8]* %27, i32 0, i32 0
store i8 51, i8* %28
%29 = getelementptr inbounds [64 x i8], [64 x i8]* %27, i32 0, i32 1
store i8 45, i8* %29
%30 = getelementptr inbounds [64 x i8], [64 x i8]* %27, i32 0, i32 2
store i8 50, i8* %30
%31 = getelementptr inbounds [64 x i8], [64 x i8]* %4, i64 0, i64 0
%32 = call i32 @replace_minus(i8* %31)
%33 = getelementptr inbounds [64 x i8], [64 x i8]* %4, i64 0, i64 0
%34 = getelementptr inbounds [64 x i8], [64 x i8]* %5, i64 0, i64 0
%35 = call i64 @strcmp(i8* %33, i8* %34)
%36 = icmp ne i64 %35, 0
br i1 %36, label %37, label %38
37: ; preds = %20
store i32 -1, i32* %1
br label %39
38: ; preds = %20
store i32 0, i32* %1
br label %39
39: ; preds = %38, %37, %19
%40 = load i32, i32* %1
ret i32 %40
}

LLVM IR (-O2):
@__const.main.after1 = [64 x i8] c"(0-2)+1\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
define i32 @main() {
%1 = alloca [64 x i8]
%2 = alloca [64 x i8]
%3 = alloca [64 x i8]
%4 = alloca [64 x i8]
%5 = getelementptr inbounds [64 x i8], [64 x i8]* %1, i64 0, i64 0
store i8 45, i8* %5
%6 = getelementptr inbounds [64 x i8], [64 x i8]* %1, i64 0, i64 1
store i8 50, i8* %6
%7 = getelementptr inbounds [64 x i8], [64 x i8]* %1, i64 0, i64 2
store i8 43, i8* %7
%8 = getelementptr inbounds [64 x i8], [64 x i8]* %1, i64 0, i64 3
store i8 49, i8* %8
%9 = getelementptr inbounds [64 x i8], [64 x i8]* %2, i64 0, i64 0
%10 = call i32 @replace_minus(i8* %5)
%11 = call i64 @strcmp(i8* %5, i8* %9)
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %24
13: ; preds = %0
%14 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
store i8 51, i8* %14
%15 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 1
store i8 45, i8* %15
%16 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 2
store i8 50, i8* %16
%17 = getelementptr inbounds [64 x i8], [64 x i8]* %4, i64 0, i64 0
store i8 51, i8* %17
%18 = getelementptr inbounds [64 x i8], [64 x i8]* %4, i64 0, i64 1
store i8 45, i8* %18
%19 = getelementptr inbounds [64 x i8], [64 x i8]* %4, i64 0, i64 2
store i8 50, i8* %19
%20 = call i32 @replace_minus(i8* %14)
%21 = call i64 @strcmp(i8* %14, i8* %17)
%22 = icmp ne i64 %21, 0
%23 = sext i1 %22 to i32
br label %24
24: ; preds = %0, %13
%25 = phi i32 [ %23, %13 ], [ -1, %0 ]
ret i32 %25
}