#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 strtol(char *, char **, int);
int chop_input(char *buf, int *values, int *code) {
  char *p, *p2;
  int i, v;
  p = buf;
  for (i = 0; i <= 4; i++) {
    v = strtol(p, &p2, 16);
    values[i] = v;
    p = p2;
  }
  v = strtol(p, &p2, 16);
  *code = v;
  return (0);
}


x86 assembly (clang, -O0):
<chop_input>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x2c(%rbp)
cmpl   $0x4,-0x2c(%rbp)
jg     1176 <chop_input+0x66>
mov    -0x20(%rbp),%rdi
lea    -0x28(%rbp),%rsi
mov    $0x10,%edx
call   1030 <strtol@plt>
mov    %eax,-0x30(%rbp)
mov    -0x30(%rbp),%edx
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x28(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1133 <chop_input+0x23>
mov    -0x20(%rbp),%rdi
lea    -0x28(%rbp),%rsi
mov    $0x10,%edx
call   1030 <strtol@plt>
mov    %eax,-0x30(%rbp)
mov    -0x30(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<chop_input>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdx,%r14
mov    %rsi,%rbx
lea    0x8(%rsp),%r15
mov    %r15,%rsi
mov    $0x10,%edx
call   1030 <strtol@plt>
mov    %eax,(%rbx)
mov    0x8(%rsp),%rdi
mov    %r15,%rsi
mov    $0x10,%edx
call   1030 <strtol@plt>
mov    %eax,0x4(%rbx)
mov    0x8(%rsp),%rdi
mov    %r15,%rsi
mov    $0x10,%edx
call   1030 <strtol@plt>
mov    %eax,0x8(%rbx)
mov    0x8(%rsp),%rdi
mov    %r15,%rsi
mov    $0x10,%edx
call   1030 <strtol@plt>
mov    %eax,0xc(%rbx)
mov    0x8(%rsp),%rdi
mov    %r15,%rsi
mov    $0x10,%edx
call   1030 <strtol@plt>
mov    %eax,0x10(%rbx)
mov    0x8(%rsp),%rdi
mov    %r15,%rsi
mov    $0x10,%edx
call   1030 <strtol@plt>
mov    %eax,(%r14)
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i32 @chop_input(i8* %0, i32* nocapture writeonly %1, i32* nocapture writeonly %2) {
%4 = alloca i8*
%5 = bitcast i8** %4 to i8*
%6 = call i32 @strtol(i8* %0, i8** %4, i32 16)
store i32 %6, i32* %1
%7 = load i8*, i8** %4
%8 = call i32 @strtol(i8* %7, i8** %4, i32 16)
%9 = getelementptr inbounds i32, i32* %1, i64 1
store i32 %8, i32* %9
%10 = load i8*, i8** %4
%11 = call i32 @strtol(i8* %10, i8** %4, i32 16)
%12 = getelementptr inbounds i32, i32* %1, i64 2
store i32 %11, i32* %12
%13 = load i8*, i8** %4
%14 = call i32 @strtol(i8* %13, i8** %4, i32 16)
%15 = getelementptr inbounds i32, i32* %1, i64 3
store i32 %14, i32* %15
%16 = load i8*, i8** %4
%17 = call i32 @strtol(i8* %16, i8** %4, i32 16)
%18 = getelementptr inbounds i32, i32* %1, i64 4
store i32 %17, i32* %18
%19 = load i8*, i8** %4
%20 = call i32 @strtol(i8* %19, i8** %4, i32 16)
store i32 %20, i32* %2
ret i32 0
}