#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 */
char load_u8(char const *, int, int);
void load_sign(const char *icc, int length, int offset, char *sign) {
  sign[0] = load_u8(icc, length, offset);
  sign[1] = load_u8(icc, length, offset + 1);
  sign[2] = load_u8(icc, length, offset + 2);
  sign[3] = load_u8(icc, length, offset + 3);
  sign[4] = 0;
}


x86 assembly (clang, -O0):
<load_sign>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <load_u8@plt>
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %cl,(%rax)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
add    $0x1,%edx
call   1030 <load_u8@plt>
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %cl,0x1(%rax)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
add    $0x2,%edx
call   1030 <load_u8@plt>
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %cl,0x2(%rax)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
add    $0x3,%edx
call   1030 <load_u8@plt>
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %cl,0x3(%rax)
mov    -0x18(%rbp),%rax
movb   $0x0,0x4(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<load_sign>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %edx,%ebx
mov    %esi,%r15d
mov    %rdi,%rbp
call   1030 <load_u8@plt>
mov    %al,(%r14)
lea    0x1(%rbx),%edx
mov    %rbp,%rdi
mov    %r15d,%esi
call   1030 <load_u8@plt>
mov    %al,0x1(%r14)
lea    0x2(%rbx),%edx
mov    %rbp,%rdi
mov    %r15d,%esi
call   1030 <load_u8@plt>
mov    %al,0x2(%r14)
add    $0x3,%ebx
mov    %rbp,%rdi
mov    %r15d,%esi
mov    %ebx,%edx
call   1030 <load_u8@plt>
mov    %al,0x3(%r14)
movb   $0x0,0x4(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @load_sign(i8* %0, i32 %1, i32 %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
store i8* %0, i8** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i8* %3, i8** %8
%9 = load i8*, i8** %5
%10 = load i32, i32* %6
%11 = load i32, i32* %7
%12 = call signext i8 @load_u8(i8* %9, i32 %10, i32 %11)
%13 = load i8*, i8** %8
%14 = getelementptr inbounds i8, i8* %13, i64 0
store i8 %12, i8* %14
%15 = load i8*, i8** %5
%16 = load i32, i32* %6
%17 = load i32, i32* %7
%18 = add nsw i32 %17, 1
%19 = call signext i8 @load_u8(i8* %15, i32 %16, i32 %18)
%20 = load i8*, i8** %8
%21 = getelementptr inbounds i8, i8* %20, i64 1
store i8 %19, i8* %21
%22 = load i8*, i8** %5
%23 = load i32, i32* %6
%24 = load i32, i32* %7
%25 = add nsw i32 %24, 2
%26 = call signext i8 @load_u8(i8* %22, i32 %23, i32 %25)
%27 = load i8*, i8** %8
%28 = getelementptr inbounds i8, i8* %27, i64 2
store i8 %26, i8* %28
%29 = load i8*, i8** %5
%30 = load i32, i32* %6
%31 = load i32, i32* %7
%32 = add nsw i32 %31, 3
%33 = call signext i8 @load_u8(i8* %29, i32 %30, i32 %32)
%34 = load i8*, i8** %8
%35 = getelementptr inbounds i8, i8* %34, i64 3
store i8 %33, i8* %35
%36 = load i8*, i8** %8
%37 = getelementptr inbounds i8, i8* %36, i64 4
store i8 0, i8* %37
ret void
}

LLVM IR (-O2):
define void @load_sign(i8* %0, i32 %1, i32 %2, i8* nocapture writeonly %3) {
%5 = tail call signext i8 @load_u8(i8* %0, i32 %1, i32 %2)
store i8 %5, i8* %3
%6 = add nsw i32 %2, 1
%7 = tail call signext i8 @load_u8(i8* %0, i32 %1, i32 %6)
%8 = getelementptr inbounds i8, i8* %3, i64 1
store i8 %7, i8* %8
%9 = add nsw i32 %2, 2
%10 = tail call signext i8 @load_u8(i8* %0, i32 %1, i32 %9)
%11 = getelementptr inbounds i8, i8* %3, i64 2
store i8 %10, i8* %11
%12 = add nsw i32 %2, 3
%13 = tail call signext i8 @load_u8(i8* %0, i32 %1, i32 %12)
%14 = getelementptr inbounds i8, i8* %3, i64 3
store i8 %13, i8* %14
%15 = getelementptr inbounds i8, i8* %3, i64 4
store i8 0, i8* %15
ret void
}