#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 sscanf(char const *, char *, int *, int *);
bool parse_node(const char **p, int *id, int *data) {
  int n;
  if (sscanf(*p, "%d%n", id, &n) != 1)
    return false;
  *p += n;
  *data = *id;
  if (sscanf(*p, ":%d%n", data, &n) == 1)
    *p += n;
  return true;
}


x86 assembly (clang, -O0):
<parse_node>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    -0x18(%rbp),%rdx
lea    0xecb(%rip),%rsi
lea    -0x24(%rbp),%rcx
call   1030 <sscanf@plt>
cmp    $0x1,%eax
je     1154 <parse_node+0x44>
movl   $0x0,-0x4(%rbp)
jmp    11b1 <parse_node+0xa1>
mov    -0x24(%rbp),%edx
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
movslq %edx,%rdx
add    %rdx,%rcx
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    -0x20(%rbp),%rdx
lea    0xe7b(%rip),%rsi
lea    -0x24(%rbp),%rcx
call   1030 <sscanf@plt>
cmp    $0x1,%eax
jne    11aa <parse_node+0x9a>
mov    -0x24(%rbp),%edx
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
movslq %edx,%rdx
add    %rdx,%rcx
mov    %rcx,(%rax)
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_node>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rdi,%r15
mov    (%rdi),%rdi
lea    0xed5(%rip),%rsi
lea    0xc(%rsp),%rcx
mov    %rbx,%rdx
call   1030 <sscanf@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x1,%ecx
jne    117a <parse_node+0x6a>
movslq 0xc(%rsp),%rdi
add    (%r15),%rdi
mov    %rdi,(%r15)
mov    (%rbx),%eax
mov    %eax,(%r14)
lea    0xea7(%rip),%rsi
lea    0xc(%rsp),%rcx
mov    %r14,%rdx
call   1030 <sscanf@plt>
mov    %eax,%ecx
mov    $0x1,%eax
cmp    $0x1,%ecx
jne    117a <parse_node+0x6a>
movslq 0xc(%rsp),%rcx
add    %rcx,(%r15)
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%d%n\00"
@.str.1 = [6 x i8] c":%d%n\00"
define i32 @parse_node(i8** %0, i32* %1, i32* %2) {
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32
store i8** %0, i8*** %5
store i32* %1, i32** %6
store i32* %2, i32** %7
%9 = load i8**, i8*** %5
%10 = load i8*, i8** %9
%11 = load i32*, i32** %6
%12 = call i32 @sscanf(i8* %10, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32* %11, i32* %8)
%13 = icmp ne i32 %12, 1
br i1 %13, label %14, label %15
14: ; preds = %3
store i32 0, i32* %4
br label %36
15: ; preds = %3
%16 = load i32, i32* %8
%17 = load i8**, i8*** %5
%18 = load i8*, i8** %17
%19 = sext i32 %16 to i64
%20 = getelementptr inbounds i8, i8* %18, i64 %19
store i8* %20, i8** %17
%21 = load i32*, i32** %6
%22 = load i32, i32* %21
%23 = load i32*, i32** %7
store i32 %22, i32* %23
%24 = load i8**, i8*** %5
%25 = load i8*, i8** %24
%26 = load i32*, i32** %7
%27 = call i32 @sscanf(i8* %25, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %26, i32* %8)
%28 = icmp eq i32 %27, 1
br i1 %28, label %29, label %35
29: ; preds = %15
%30 = load i32, i32* %8
%31 = load i8**, i8*** %5
%32 = load i8*, i8** %31
%33 = sext i32 %30 to i64
%34 = getelementptr inbounds i8, i8* %32, i64 %33
store i8* %34, i8** %31
br label %35
35: ; preds = %29, %15
store i32 1, i32* %4
br label %36
36: ; preds = %35, %14
%37 = load i32, i32* %4
ret i32 %37
}

LLVM IR (-O2):
@.str = [5 x i8] c"%d%n\00"
@.str.1 = [6 x i8] c":%d%n\00"
define i32 @parse_node(i8** nocapture %0, i32* %1, i32* %2) {
%4 = alloca i32
%5 = bitcast i32* %4 to i8*
%6 = load i8*, i8** %0
%7 = call i32 @sscanf(i8* %6, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %4)
%8 = icmp eq i32 %7, 1
br i1 %8, label %9, label %22
9: ; preds = %3
%10 = load i32, i32* %4
%11 = load i8*, i8** %0
%12 = sext i32 %10 to i64
%13 = getelementptr inbounds i8, i8* %11, i64 %12
store i8* %13, i8** %0
%14 = load i32, i32* %1
store i32 %14, i32* %2
%15 = call i32 @sscanf(i8* %13, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %4)
%16 = icmp eq i32 %15, 1
br i1 %16, label %17, label %22
17: ; preds = %9
%18 = load i32, i32* %4
%19 = load i8*, i8** %0
%20 = sext i32 %18 to i64
%21 = getelementptr inbounds i8, i8* %19, i64 %20
store i8* %21, i8** %0
br label %22
22: ; preds = %9, %17, %3
%23 = phi i32 [ 0, %3 ], [ 1, %17 ], [ 1, %9 ]
ret i32 %23
}