#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 get_next_strings_ptr(char *, char *, int);
int strtol(char *, int /*<<< orphan*/ *, int);
int get_start_and_size(char line[], int ptr, int *start, int *size) {
  char buf[1024];
  if ((ptr = get_next_strings_ptr(line, buf, ptr)) != 0) {
    *start = strtol(buf, NULL, 16) & 0xffff;
    if ((ptr = get_next_strings_ptr(line, buf, ptr)) != 0) {
      if (buf[0] == '#')
        *size = strtol(&buf[1], NULL, 16) & 0xffff;
      else
        *size = (strtol(buf, NULL, 16) - (*start) + 1) & 0xffff;
    } else {
      return (0);
    }
  } else {
    return (0);
  }
  return (1);
}


x86 assembly (clang, -O0):
<get_start_and_size>:
push   %rbp
mov    %rsp,%rbp
sub    $0x430,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x430(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <get_next_strings_ptr@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
je     1219 <get_start_and_size+0xf9>
lea    -0x430(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x10,%edx
call   1040 <strtol@plt>
mov    %eax,%ecx
and    $0xffff,%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rdi
lea    -0x430(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <get_next_strings_ptr@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
je     1208 <get_start_and_size+0xe8>
movsbl -0x430(%rbp),%eax
cmp    $0x23,%eax
jne    11d7 <get_start_and_size+0xb7>
lea    -0x430(%rbp),%rdi
add    $0x1,%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x10,%edx
call   1040 <strtol@plt>
mov    %eax,%ecx
and    $0xffff,%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
jmp    1203 <get_start_and_size+0xe3>
lea    -0x430(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x10,%edx
call   1040 <strtol@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
sub    (%rax),%ecx
add    $0x1,%ecx
and    $0xffff,%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
jmp    1214 <get_start_and_size+0xf4>
movl   $0x0,-0x4(%rbp)
jmp    122c <get_start_and_size+0x10c>
jmp    1225 <get_start_and_size+0x105>
movl   $0x0,-0x4(%rbp)
jmp    122c <get_start_and_size+0x10c>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x430,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_start_and_size>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x408,%rsp
mov    %rcx,%r14
mov    %rdx,%r15
mov    %esi,%edx
mov    %rdi,%rbx
mov    %rsp,%rsi
call   1030 <get_next_strings_ptr@plt>
test   %eax,%eax
je     118f <get_start_and_size+0x6f>
mov    %eax,%ebp
xor    %r12d,%r12d
mov    %rsp,%r13
mov    %r13,%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1040 <strtol@plt>
movzwl %ax,%eax
mov    %eax,(%r15)
mov    %rbx,%rdi
mov    %r13,%rsi
mov    %ebp,%edx
call   1030 <get_next_strings_ptr@plt>
test   %eax,%eax
je     11b9 <get_start_and_size+0x99>
cmpb   $0x23,(%rsp)
jne    1194 <get_start_and_size+0x74>
lea    0x1(%rsp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1040 <strtol@plt>
jmp    11ad <get_start_and_size+0x8d>
xor    %r12d,%r12d
jmp    11b9 <get_start_and_size+0x99>
mov    %rsp,%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1040 <strtol@plt>
mov    (%r15),%ecx
neg    %ecx
add    %ecx,%eax
add    $0x1,%eax
movzwl %ax,%eax
mov    %eax,(%r14)
mov    $0x1,%r12d
mov    %r12d,%eax
add    $0x408,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @get_start_and_size(i8* %0, i32 %1, i32* %2, i32* %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca [1024 x i8]
store i8* %0, i8** %6
store i32 %1, i32* %7
store i32* %2, i32** %8
store i32* %3, i32** %9
%11 = load i8*, i8** %6
%12 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%13 = load i32, i32* %7
%14 = call i32 @get_next_strings_ptr(i8* %11, i8* %12, i32 %13)
store i32 %14, i32* %7
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %48
16: ; preds = %4
%17 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%18 = call i32 @strtol(i8* %17, i32* null, i32 16)
%19 = and i32 %18, 65535
%20 = load i32*, i32** %8
store i32 %19, i32* %20
%21 = load i8*, i8** %6
%22 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%23 = load i32, i32* %7
%24 = call i32 @get_next_strings_ptr(i8* %21, i8* %22, i32 %23)
store i32 %24, i32* %7
%25 = icmp ne i32 %24, 0
br i1 %25, label %26, label %46
26: ; preds = %16
%27 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%28 = load i8, i8* %27
%29 = sext i8 %28 to i32
%30 = icmp eq i32 %29, 35
br i1 %30, label %31, label %36
31: ; preds = %26
%32 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 1
%33 = call i32 @strtol(i8* %32, i32* null, i32 16)
%34 = and i32 %33, 65535
%35 = load i32*, i32** %9
store i32 %34, i32* %35
br label %45
36: ; preds = %26
%37 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%38 = call i32 @strtol(i8* %37, i32* null, i32 16)
%39 = load i32*, i32** %8
%40 = load i32, i32* %39
%41 = sub nsw i32 %38, %40
%42 = add nsw i32 %41, 1
%43 = and i32 %42, 65535
%44 = load i32*, i32** %9
store i32 %43, i32* %44
br label %45
45: ; preds = %36, %31
br label %47
46: ; preds = %16
store i32 0, i32* %5
br label %50
47: ; preds = %45
br label %49
48: ; preds = %4
store i32 0, i32* %5
br label %50
49: ; preds = %47
store i32 1, i32* %5
br label %50
50: ; preds = %49, %48, %46
%51 = load i32, i32* %5
ret i32 %51
}

LLVM IR (-O2):
define i32 @get_start_and_size(i8* %0, i32 %1, i32* nocapture %2, i32* nocapture writeonly %3) {
%5 = alloca [1024 x i8]
%6 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%7 = call i32 @get_next_strings_ptr(i8* %0, i8* %6, i32 %1)
%8 = icmp eq i32 %7, 0
br i1 %8, label %28, label %9
9: ; preds = %4
%10 = call i32 @strtol(i8* nocapture %6, i32* null, i32 16)
%11 = and i32 %10, 65535
store i32 %11, i32* %2
%12 = call i32 @get_next_strings_ptr(i8* %0, i8* %6, i32 %7)
%13 = icmp eq i32 %12, 0
br i1 %13, label %28, label %14
14: ; preds = %9
%15 = load i8, i8* %6
%16 = icmp eq i8 %15, 35
br i1 %16, label %17, label %20
17: ; preds = %14
%18 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 1
%19 = call i32 @strtol(i8* nocapture %18, i32* null, i32 16)
br label %25
20: ; preds = %14
%21 = call i32 @strtol(i8* nocapture %6, i32* null, i32 16)
%22 = load i32, i32* %2
%23 = add i32 %21, 1
%24 = sub i32 %23, %22
br label %25
25: ; preds = %20, %17
%26 = phi i32 [ %24, %20 ], [ %19, %17 ]
%27 = and i32 %26, 65535
store i32 %27, i32* %3
br label %28
28: ; preds = %4, %9, %25
%29 = phi i32 [ 1, %25 ], [ 0, %9 ], [ 0, %4 ]
ret i32 %29
}