#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 atoi(char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ snprintf(char *, int, char *, int);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcat(char *, char *);
int main(int argc, char const *argv[]) {
  int size = 50;
  char string[] = {0, 0, 0, 10, 02, 49, 49, 03};
  int cont = 0;
  int i;
  char buffer[3];
  char d[5] = "";
  int n = 0;
  while (cont < 50) {
    i = string[cont];
    if (i == 02) {
      do {
        cont++;
        i = string[cont];
        if (i > 47 && i < 58) {
          snprintf(buffer, 3, "%c", i);
          strcat(d, buffer);
        }
      } while (i != 03);
    }
    cont++;
  }
  n = atoi(d);
  fprintf(stderr, " %d\n", n);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x32,-0x14(%rbp)
mov    0xe8c(%rip),%rax
mov    %rax,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
lea    -0x2c(%rbp),%rdi
xor    %esi,%esi
mov    $0x5,%edx
call   1040 <memset@plt>
movl   $0x0,-0x30(%rbp)
cmpl   $0x32,-0x20(%rbp)
jge    122b <main+0xdb>
movslq -0x20(%rbp),%rax
movsbl -0x1c(%rbp,%rax,1),%eax
mov    %eax,-0x24(%rbp)
cmpl   $0x2,-0x24(%rbp)
jne    121d <main+0xcd>
jmp    11bb <main+0x6b>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
movslq -0x20(%rbp),%rax
movsbl -0x1c(%rbp,%rax,1),%eax
mov    %eax,-0x24(%rbp)
cmpl   $0x2f,-0x24(%rbp)
jle    1209 <main+0xb9>
cmpl   $0x3a,-0x24(%rbp)
jge    1209 <main+0xb9>
lea    -0x27(%rbp),%rdi
mov    -0x24(%rbp),%ecx
mov    $0x3,%esi
lea    0xe11(%rip),%rdx
call   1030 <snprintf@plt>
lea    -0x2c(%rbp),%rdi
lea    -0x27(%rbp),%rsi
call   1070 <strcat@plt>
jmp    120e <main+0xbe>
cmpl   $0x3,-0x24(%rbp)
jne    11bb <main+0x6b>
jmp    121d <main+0xcd>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1196 <main+0x46>
lea    -0x2c(%rbp),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x30(%rbp)
mov    0x2da2(%rip),%rax
mov    (%rax),%edi
mov    -0x30(%rbp),%edx
lea    0xdc1(%rip),%rsi
call   1050 <fprintf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
movb   $0x0,0xc(%rsp)
movl   $0x0,0x8(%rsp)
xor    %eax,%eax
lea    0xea1(%rip),%r14
lea    0xd(%rsp),%rbx
lea    0x8(%rsp),%r15
jmp    117a <main+0x3a>
nopl   0x0(%rax,%rax,1)
lea    0x1(%rax),%ecx
cmp    $0x31,%eax
mov    %ecx,%eax
jge    11c6 <main+0x86>
cmp    $0x4,%eax
jne    1170 <main+0x30>
mov    %rbx,%rdi
mov    $0x3,%esi
mov    %r14,%rdx
mov    $0x31,%ecx
call   1030 <snprintf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1060 <strcat@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
mov    %r14,%rdx
mov    $0x31,%ecx
call   1030 <snprintf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1060 <strcat@plt>
mov    $0x7,%eax
jmp    1170 <main+0x30>
lea    0x8(%rsp),%rdi
call   1050 <atoi@plt>
mov    0x2e09(%rip),%rcx
mov    (%rcx),%edi
lea    0xe23(%rip),%rsi
mov    %eax,%edx
call   1040 <fprintf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.string = [8 x i8] c"\00\00\00\0A\0211\03"
@.str = [3 x i8] c"%c\00"
@stderr = global i32 0
@.str.1 = [5 x i8] c" %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca [8 x i8]
%8 = alloca i32
%9 = alloca i32
%10 = alloca [3 x i8]
%11 = alloca [5 x i8]
%12 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 50, i32* %6
%13 = bitcast [8 x i8]* %7 to i8*
store i32 0, i32* %8
%14 = bitcast [5 x i8]* %11 to i8*
store i32 0, i32* %12
br label %15
15: ; preds = %52, %2
%16 = load i32, i32* %8
%17 = icmp slt i32 %16, 50
br i1 %17, label %18, label %55
18: ; preds = %15
%19 = load i32, i32* %8
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [8 x i8], [8 x i8]* %7, i64 0, i64 %20
%22 = load i8, i8* %21
%23 = sext i8 %22 to i32
store i32 %23, i32* %9
%24 = load i32, i32* %9
%25 = icmp eq i32 %24, 2
br i1 %25, label %26, label %52
26: ; preds = %18
br label %27
27: ; preds = %48, %26
%28 = load i32, i32* %8
%29 = add nsw i32 %28, 1
store i32 %29, i32* %8
%30 = load i32, i32* %8
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [8 x i8], [8 x i8]* %7, i64 0, i64 %31
%33 = load i8, i8* %32
%34 = sext i8 %33 to i32
store i32 %34, i32* %9
%35 = load i32, i32* %9
%36 = icmp sgt i32 %35, 47
br i1 %36, label %37, label %47
37: ; preds = %27
%38 = load i32, i32* %9
%39 = icmp slt i32 %38, 58
br i1 %39, label %40, label %47
40: ; preds = %37
%41 = getelementptr inbounds [3 x i8], [3 x i8]* %10, i64 0, i64 0
%42 = load i32, i32* %9
%43 = call i32 @snprintf(i8* %41, i32 3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %42)
%44 = getelementptr inbounds [5 x i8], [5 x i8]* %11, i64 0, i64 0
%45 = getelementptr inbounds [3 x i8], [3 x i8]* %10, i64 0, i64 0
%46 = call i32 @strcat(i8* %44, i8* %45)
br label %47
47: ; preds = %40, %37, %27
br label %48
48: ; preds = %47
%49 = load i32, i32* %9
%50 = icmp ne i32 %49, 3
br i1 %50, label %27, label %51
51: ; preds = %48
br label %52
52: ; preds = %51, %18
%53 = load i32, i32* %8
%54 = add nsw i32 %53, 1
store i32 %54, i32* %8
br label %15
55: ; preds = %15
%56 = getelementptr inbounds [5 x i8], [5 x i8]* %11, i64 0, i64 0
%57 = call i32 @atoi(i8* %56)
store i32 %57, i32* %12
%58 = load i32, i32* @stderr
%59 = load i32, i32* %12
%60 = call i32 @fprintf(i32 %58, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %59)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%c\00"
@stderr = global i32 0
@.str.1 = [5 x i8] c" %d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [3 x i8]
%4 = alloca [5 x i8]
%5 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [5 x i8], [5 x i8]* %4, i64 0, i64 0
br label %7
7: ; preds = %2, %15
%8 = phi i32 [ 0, %2 ], [ %17, %15 ]
%9 = icmp eq i32 %8, 4
br i1 %9, label %10, label %15
10: ; preds = %7
%11 = call i32 @snprintf(i8* %5, i32 3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 49)
%12 = call i32 @strcat(i8* %6, i8* %5)
%13 = call i32 @snprintf(i8* %5, i32 3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 49)
%14 = call i32 @strcat(i8* %6, i8* %5)
br label %15
15: ; preds = %10, %7
%16 = phi i32 [ %8, %7 ], [ 7, %10 ]
%17 = add nsw i32 %16, 1
%18 = icmp slt i32 %16, 49
br i1 %18, label %7, label %19
19: ; preds = %15
%20 = call i32 @atoi(i8* %6)
%21 = load i32, i32* @stderr
%22 = call i32 @fprintf(i32 %21, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %20)
ret i32 0
}