#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*/ memmove(char *, char *, size_t);
size_t strlen(char *);
void squeeze_zeros(char *decimal) {
  char *start;
  size_t len;
  if (*decimal == '+' || *decimal == '-')
    ++decimal;
  for (start = decimal; *start && *start == '0'; ++start)
    ;
  if (*start == '\0' || *start == '.')
    --start;
  len = strlen(start);
  memmove(decimal, start, len);
  for (start = decimal + len; *start; ++start)
    *start = '\0';
}


x86 assembly (clang, -O0):
<squeeze_zeros>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2b,%eax
je     114c <squeeze_zeros+0x2c>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    1158 <squeeze_zeros+0x38>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x19(%rbp)
je     1185 <squeeze_zeros+0x65>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x30,%eax
sete   %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    1195 <squeeze_zeros+0x75>
jmp    11ab <squeeze_zeros+0x8b>
jmp    119a <squeeze_zeros+0x7a>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1160 <squeeze_zeros+0x40>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     11cb <squeeze_zeros+0xab>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2e,%eax
jne    11d7 <squeeze_zeros+0xb7>
mov    -0x10(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1040 <memmove@plt>
mov    -0x8(%rbp),%rax
add    -0x18(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1226 <squeeze_zeros+0x106>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1201 <squeeze_zeros+0xe1>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<squeeze_zeros>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
mov    (%rdi),%al
cmp    $0x2d,%al
je     1132 <squeeze_zeros+0x12>
cmp    $0x2b,%al
jne    1136 <squeeze_zeros+0x16>
add    $0x1,%r14
mov    %r14,%rbx
nopl   0x0(%rax)
movzbl (%rbx),%eax
cmp    $0x30,%al
jne    114d <squeeze_zeros+0x2d>
add    $0x1,%rbx
jmp    1140 <squeeze_zeros+0x20>
test   %al,%al
je     1155 <squeeze_zeros+0x35>
cmp    $0x2e,%al
jne    1159 <squeeze_zeros+0x39>
add    $0xffffffffffffffff,%rbx
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %rax,%r15
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %rax,%rdx
call   1040 <memmove@plt>
cmpb   $0x0,(%r14,%r15,1)
je     119d <squeeze_zeros+0x7d>
lea    (%r15,%r14,1),%rax
add    $0x1,%rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movb   $0x0,-0x1(%rax)
cmpb   $0x0,(%rax)
lea    0x1(%rax),%rax
jne    1190 <squeeze_zeros+0x70>
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @squeeze_zeros(i8* %0) {
%2 = load i8, i8* %0
switch i8 %2, label %5 [
i8 43, label %3
i8 45, label %3
]
3: ; preds = %1, %1
%4 = getelementptr inbounds i8, i8* %0, i64 1
br label %5
5: ; preds = %1, %3
%6 = phi i8* [ %4, %3 ], [ %0, %1 ]
br label %7
7: ; preds = %10, %5
%8 = phi i8* [ %6, %5 ], [ %11, %10 ]
%9 = load i8, i8* %8
switch i8 %9, label %14 [
i8 48, label %10
i8 0, label %12
i8 46, label %12
]
10: ; preds = %7
%11 = getelementptr inbounds i8, i8* %8, i64 1
br label %7
12: ; preds = %7, %7
%13 = getelementptr inbounds i8, i8* %8, i64 -1
br label %14
14: ; preds = %7, %12
%15 = phi i8* [ %13, %12 ], [ %8, %7 ]
%16 = tail call i64 @strlen(i8* %15)
%17 = tail call i32 @memmove(i8* %6, i8* %15, i64 %16)
%18 = getelementptr inbounds i8, i8* %6, i64 %16
%19 = load i8, i8* %18
%20 = icmp eq i8 %19, 0
br i1 %20, label %26, label %21
21: ; preds = %14, %21
%22 = phi i8* [ %23, %21 ], [ %18, %14 ]
store i8 0, i8* %22
%23 = getelementptr inbounds i8, i8* %22, i64 1
%24 = load i8, i8* %23
%25 = icmp eq i8 %24, 0
br i1 %25, label %26, label %21
26: ; preds = %21, %14
ret void
}