#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*/ exit(int);
int /*<<< orphan*/ printf(char *);
char *strstr(char *, char *);
int strtoul(char *, int /*<<< orphan*/ *, int);
void get_ir_opts(char *optstr, int *idx, int *val) {
  char *ptr;
  ptr = strstr(optstr, ":");
  if (ptr == NULL) {
    printf("Error: badly formatted IR length option.  Use format "
           "\'<index>:<value>\', without spaces, where both args are in base "
           "10\n");
    exit(1);
  }
  *ptr = '\0';
  ptr++;
  *idx = strtoul(optstr, NULL, 10);
  *val = strtoul(ptr, NULL, 10);
}


x86 assembly (clang, -O0):
<get_ir_opts>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xea1(%rip),%rsi
call   1060 <strstr@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1189 <get_ir_opts+0x49>
lea    0xe88(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x20(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1040 <strtoul@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x20(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1040 <strtoul@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_ir_opts>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%r12
mov    $0x3a,%esi
call   1040 <strchr@plt>
test   %rax,%rax
je     119a <get_ir_opts+0x5a>
mov    %rax,%rbx
movb   $0x0,(%rax)
add    $0x1,%rbx
mov    %r12,%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1050 <strtoul@plt>
mov    %eax,(%r15)
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1050 <strtoul@plt>
mov    %eax,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
lea    0xe5f(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [2 x i8] c":\00"
@.str.1 = [120 x i8] c"Error: badly formatted IR length option. Use format '<index>:<value>', without spaces, where both args are in base 10\0A\00"
define void @get_ir_opts(i8* %0, i32* %1, i32* %2) {
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i8*
store i8* %0, i8** %4
store i32* %1, i32** %5
store i32* %2, i32** %6
%8 = load i8*, i8** %4
%9 = call i8* @strstr(i8* %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* %9, i8** %7
%10 = load i8*, i8** %7
%11 = icmp eq i8* %10, null
br i1 %11, label %12, label %15
12: ; preds = %3
%13 = call i32 @printf(i8* getelementptr inbounds ([120 x i8], [120 x i8]* @.str.1, i64 0, i64 0))
%14 = call i32 @exit(i32 1)
unreachable
15: ; preds = %3
%16 = load i8*, i8** %7
store i8 0, i8* %16
%17 = load i8*, i8** %7
%18 = getelementptr inbounds i8, i8* %17, i32 1
store i8* %18, i8** %7
%19 = load i8*, i8** %4
%20 = call i32 @strtoul(i8* %19, i32* null, i32 10)
%21 = load i32*, i32** %5
store i32 %20, i32* %21
%22 = load i8*, i8** %7
%23 = call i32 @strtoul(i8* %22, i32* null, i32 10)
%24 = load i32*, i32** %6
store i32 %23, i32* %24
ret void
}

LLVM IR (-O2):
@str = [119 x i8] c"Error: badly formatted IR length option. Use format '<index>:<value>', without spaces, where both args are in base 10\00"
define void @get_ir_opts(i8* %0, i32* nocapture writeonly %1, i32* nocapture writeonly %2) {
%4 = tail call i8* @strchr(i8* dereferenceable(1) %0, i32 58)
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %9
6: ; preds = %3
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([119 x i8], [119 x i8]* @str, i64 0, i64 0))
%8 = tail call i32 @exit(i32 1)
unreachable
9: ; preds = %3
store i8 0, i8* %4
%10 = getelementptr inbounds i8, i8* %4, i64 1
%11 = tail call i32 @strtoul(i8* nocapture %0, i32* null, i32 10)
store i32 %11, i32* %1
%12 = tail call i32 @strtoul(i8* nocapture %10, i32* null, i32 10)
store i32 %12, i32* %2
ret void
}