#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 */
scalar_t__ m_break_num(char);
char *Extract_num(char *exp, char s[]) {
  int i = 0;
  while (m_break_num(*exp) != 0) {
    s[i] = *exp;
    i++;
    exp++;
  }
  s[i] = '\0';
  return exp;
}


x86 assembly (clang, -O0):
<Extract_num>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <m_break_num@plt>
cmp    $0x0,%rax
je     1168 <Extract_num+0x58>
mov    -0x8(%rbp),%rax
mov    (%rax),%dl
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1127 <Extract_num+0x17>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Extract_num>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
movsbl (%rdi),%edi
call   1030 <m_break_num@plt>
test   %rax,%rax
je     1154 <Extract_num+0x44>
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
movzbl (%r15,%rbx,1),%eax
mov    %al,(%r14,%rbx,1)
movsbl 0x1(%r15,%rbx,1),%edi
add    $0x1,%rbx
call   1030 <m_break_num@plt>
test   %rax,%rax
jne    1130 <Extract_num+0x20>
mov    %ebx,%eax
add    %rbx,%r15
jmp    1156 <Extract_num+0x46>
xor    %eax,%eax
movb   $0x0,(%r14,%rax,1)
mov    %r15,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @Extract_num(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
store i32 0, i32* %5
br label %6
6: ; preds = %11, %2
%7 = load i8*, i8** %3
%8 = load i8, i8* %7
%9 = call i64 @m_break_num(i8 signext %8)
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %22
11: ; preds = %6
%12 = load i8*, i8** %3
%13 = load i8, i8* %12
%14 = load i8*, i8** %4
%15 = load i32, i32* %5
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8, i8* %14, i64 %16
store i8 %13, i8* %17
%18 = load i32, i32* %5
%19 = add nsw i32 %18, 1
store i32 %19, i32* %5
%20 = load i8*, i8** %3
%21 = getelementptr inbounds i8, i8* %20, i32 1
store i8* %21, i8** %3
br label %6
22: ; preds = %6
%23 = load i8*, i8** %4
%24 = load i32, i32* %5
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8, i8* %23, i64 %25
store i8 0, i8* %26
%27 = load i8*, i8** %3
ret i8* %27
}

LLVM IR (-O2):
define i8* @Extract_num(i8* %0, i8* nocapture writeonly %1) {
%3 = load i8, i8* %0
%4 = tail call i64 @m_break_num(i8 signext %3)
%5 = icmp eq i64 %4, 0
br i1 %5, label %18, label %6
6: ; preds = %2, %6
%7 = phi i64 [ %11, %6 ], [ 0, %2 ]
%8 = phi i8* [ %12, %6 ], [ %0, %2 ]
%9 = load i8, i8* %8
%10 = getelementptr inbounds i8, i8* %1, i64 %7
store i8 %9, i8* %10
%11 = add nuw i64 %7, 1
%12 = getelementptr inbounds i8, i8* %8, i64 1
%13 = load i8, i8* %12
%14 = tail call i64 @m_break_num(i8 signext %13)
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %6
16: ; preds = %6
%17 = and i64 %11, 4294967295
br label %18
18: ; preds = %16, %2
%19 = phi i8* [ %0, %2 ], [ %12, %16 ]
%20 = phi i64 [ 0, %2 ], [ %17, %16 ]
%21 = getelementptr inbounds i8, i8* %1, i64 %20
store i8 0, i8* %21
ret i8* %19
}