#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*/ isdigit(char);
int /*<<< orphan*/ strncpy(char *, char *, int);
void convert(char *str) {
  char tmp[100];
  int i, j;
  tmp[99] = 0;
  strncpy(tmp, str, 99);
  j = 0;
  for (i = 0; tmp[i]; ++i) {
    if (!isdigit(tmp[i])) {
      str[j] = tmp[i];
      ++j;
    }
  }
  str[j] = 0;
}


x86 assembly (clang, -O0):
<convert>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x8(%rbp)
movb   $0x0,-0xd(%rbp)
lea    -0x70(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    $0x63,%edx
call   1030 <strncpy@plt>
movl   $0x0,-0x78(%rbp)
movl   $0x0,-0x74(%rbp)
movslq -0x74(%rbp),%rax
cmpb   $0x0,-0x70(%rbp,%rax,1)
je     11a8 <convert+0x88>
movslq -0x74(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%edi
call   1040 <isdigit@plt>
cmp    $0x0,%eax
jne    1195 <convert+0x75>
movslq -0x74(%rbp),%rax
mov    -0x70(%rbp,%rax,1),%dl
mov    -0x8(%rbp),%rax
movslq -0x78(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x78(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x78(%rbp)
jmp    119a <convert+0x7a>
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    1153 <convert+0x33>
mov    -0x8(%rbp),%rax
movslq -0x78(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<convert>:
push   %r15
push   %r14
push   %rbx
sub    $0x70,%rsp
mov    %rdi,%r14
movb   $0x0,0x63(%rsp)
mov    %rsp,%rdi
mov    %r14,%rsi
mov    $0x63,%edx
call   1030 <strncpy@plt>
mov    (%rsp),%al
test   %al,%al
je     1188 <convert+0x68>
lea    0x1(%rsp),%rbx
xor    %r15d,%r15d
jmp    116b <convert+0x4b>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
je     118b <convert+0x6b>
movsbl %al,%edi
call   1040 <isdigit@plt>
test   %eax,%eax
jne    1160 <convert+0x40>
movzbl -0x1(%rbx),%eax
movslq %r15d,%r15
mov    %al,(%r14,%r15,1)
add    $0x1,%r15d
jmp    1160 <convert+0x40>
xor    %r15d,%r15d
movslq %r15d,%rax
movb   $0x0,(%r14,%rax,1)
add    $0x70,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @convert(i8* %0) {
%2 = alloca i8*
%3 = alloca [100 x i8]
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %2
%6 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 99
store i8 0, i8* %6
%7 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%8 = load i8*, i8** %2
%9 = call i32 @strncpy(i8* %7, i8* %8, i32 99)
store i32 0, i32* %5
store i32 0, i32* %4
br label %10
10: ; preds = %35, %1
%11 = load i32, i32* %4
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 %12
%14 = load i8, i8* %13
%15 = icmp ne i8 %14, 0
br i1 %15, label %16, label %38
16: ; preds = %10
%17 = load i32, i32* %4
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 %18
%20 = load i8, i8* %19
%21 = call i32 @isdigit(i8 signext %20)
%22 = icmp ne i32 %21, 0
br i1 %22, label %34, label %23
23: ; preds = %16
%24 = load i32, i32* %4
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 %25
%27 = load i8, i8* %26
%28 = load i8*, i8** %2
%29 = load i32, i32* %5
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i8, i8* %28, i64 %30
store i8 %27, i8* %31
%32 = load i32, i32* %5
%33 = add nsw i32 %32, 1
store i32 %33, i32* %5
br label %34
34: ; preds = %23, %16
br label %35
35: ; preds = %34
%36 = load i32, i32* %4
%37 = add nsw i32 %36, 1
store i32 %37, i32* %4
br label %10
38: ; preds = %10
%39 = load i8*, i8** %2
%40 = load i32, i32* %5
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds i8, i8* %39, i64 %41
store i8 0, i8* %42
ret void
}

LLVM IR (-O2):
define void @convert(i8* %0) {
%2 = alloca [100 x i8]
%3 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 99
store i8 0, i8* %4
%5 = call i32 @strncpy(i8* %3, i8* %0, i32 99)
%6 = load i8, i8* %3
%7 = icmp eq i8 %6, 0
br i1 %7, label %26, label %8
8: ; preds = %1, %20
%9 = phi i64 [ %22, %20 ], [ 0, %1 ]
%10 = phi i8 [ %24, %20 ], [ %6, %1 ]
%11 = phi i8* [ %23, %20 ], [ %3, %1 ]
%12 = phi i32 [ %21, %20 ], [ 0, %1 ]
%13 = call i32 @isdigit(i8 signext %10)
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %20
15: ; preds = %8
%16 = load i8, i8* %11
%17 = sext i32 %12 to i64
%18 = getelementptr inbounds i8, i8* %0, i64 %17
store i8 %16, i8* %18
%19 = add nsw i32 %12, 1
br label %20
20: ; preds = %8, %15
%21 = phi i32 [ %12, %8 ], [ %19, %15 ]
%22 = add nuw i64 %9, 1
%23 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %22
%24 = load i8, i8* %23
%25 = icmp eq i8 %24, 0
br i1 %25, label %26, label %8
26: ; preds = %20, %1
%27 = phi i32 [ 0, %1 ], [ %21, %20 ]
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds i8, i8* %0, i64 %28
store i8 0, i8* %29
ret void
}