#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 */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
void rgb24to32_C(const uint8_t *src, uint8_t *dst, unsigned src_size) {
  uint8_t *dest = dst;
  const uint8_t *s = src;
  const uint8_t *end;
  end = s + src_size;
  while (s < end) {
    *dest++ = *s++;
    *dest++ = *s++;
    *dest++ = *s++;
    *dest++ = 0;
  }
}


x86 assembly (clang, -O0):
<rgb24to32_C>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    -0x14(%rbp),%ecx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x30(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x30(%rbp),%rax
jae    11bf <rgb24to32_C+0xbf>
mov    -0x28(%rbp),%rax
mov    %rax,%rcx
add    $0x4,%rcx
mov    %rcx,-0x28(%rbp)
mov    (%rax),%ecx
mov    -0x20(%rbp),%rax
mov    %rax,%rdx
add    $0x4,%rdx
mov    %rdx,-0x20(%rbp)
mov    %ecx,(%rax)
mov    -0x28(%rbp),%rax
mov    %rax,%rcx
add    $0x4,%rcx
mov    %rcx,-0x28(%rbp)
mov    (%rax),%ecx
mov    -0x20(%rbp),%rax
mov    %rax,%rdx
add    $0x4,%rdx
mov    %rdx,-0x20(%rbp)
mov    %ecx,(%rax)
mov    -0x28(%rbp),%rax
mov    %rax,%rcx
add    $0x4,%rcx
mov    %rcx,-0x28(%rbp)
mov    (%rax),%ecx
mov    -0x20(%rbp),%rax
mov    %rax,%rdx
add    $0x4,%rdx
mov    %rdx,-0x20(%rbp)
mov    %ecx,(%rax)
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0x4,%rcx
mov    %rcx,-0x20(%rbp)
movl   $0x0,(%rax)
jmp    1131 <rgb24to32_C+0x31>
pop    %rbp
ret

x86 assembly (clang, -O2):
<rgb24to32_C>:
test   %edx,%edx
je     1134 <rgb24to32_C+0x34>
mov    %edx,%eax
lea    (%rdi,%rax,4),%rax
nopw   0x0(%rax,%rax,1)
mov    (%rdi),%ecx
mov    %ecx,(%rsi)
mov    0x4(%rdi),%ecx
mov    %ecx,0x4(%rsi)
mov    0x8(%rdi),%ecx
mov    %ecx,0x8(%rsi)
movl   $0x0,0xc(%rsi)
add    $0xc,%rdi
add    $0x10,%rsi
cmp    %rax,%rdi
jb     1110 <rgb24to32_C+0x10>
ret

LLVM IR (-O0):
define void @rgb24to32_C(i32* %0, i32* %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32*
store i32* %0, i32** %4
store i32* %1, i32** %5
store i32 %2, i32* %6
%10 = load i32*, i32** %5
store i32* %10, i32** %7
%11 = load i32*, i32** %4
store i32* %11, i32** %8
%12 = load i32*, i32** %8
%13 = load i32, i32* %6
%14 = zext i32 %13 to i64
%15 = getelementptr inbounds i32, i32* %12, i64 %14
store i32* %15, i32** %9
br label %16
16: ; preds = %20, %3
%17 = load i32*, i32** %8
%18 = load i32*, i32** %9
%19 = icmp ult i32* %17, %18
br i1 %19, label %20, label %38
20: ; preds = %16
%21 = load i32*, i32** %8
%22 = getelementptr inbounds i32, i32* %21, i32 1
store i32* %22, i32** %8
%23 = load i32, i32* %21
%24 = load i32*, i32** %7
%25 = getelementptr inbounds i32, i32* %24, i32 1
store i32* %25, i32** %7
store i32 %23, i32* %24
%26 = load i32*, i32** %8
%27 = getelementptr inbounds i32, i32* %26, i32 1
store i32* %27, i32** %8
%28 = load i32, i32* %26
%29 = load i32*, i32** %7
%30 = getelementptr inbounds i32, i32* %29, i32 1
store i32* %30, i32** %7
store i32 %28, i32* %29
%31 = load i32*, i32** %8
%32 = getelementptr inbounds i32, i32* %31, i32 1
store i32* %32, i32** %8
%33 = load i32, i32* %31
%34 = load i32*, i32** %7
%35 = getelementptr inbounds i32, i32* %34, i32 1
store i32* %35, i32** %7
store i32 %33, i32* %34
%36 = load i32*, i32** %7
%37 = getelementptr inbounds i32, i32* %36, i32 1
store i32* %37, i32** %7
store i32 0, i32* %36
br label %16
38: ; preds = %16
ret void
}

LLVM IR (-O2):
define void @rgb24to32_C(i32* %0, i32* nocapture writeonly %1, i32 %2) {
%4 = zext i32 %2 to i64
%5 = getelementptr inbounds i32, i32* %0, i64 %4
%6 = icmp eq i32 %2, 0
br i1 %6, label %21, label %7
7: ; preds = %3, %7
%8 = phi i32* [ %19, %7 ], [ %1, %3 ]
%9 = phi i32* [ %16, %7 ], [ %0, %3 ]
%10 = getelementptr inbounds i32, i32* %9, i64 1
%11 = load i32, i32* %9
%12 = getelementptr inbounds i32, i32* %8, i64 1
store i32 %11, i32* %8
%13 = getelementptr inbounds i32, i32* %9, i64 2
%14 = load i32, i32* %10
%15 = getelementptr inbounds i32, i32* %8, i64 2
store i32 %14, i32* %12
%16 = getelementptr inbounds i32, i32* %9, i64 3
%17 = load i32, i32* %13
%18 = getelementptr inbounds i32, i32* %8, i64 3
store i32 %17, i32* %15
%19 = getelementptr inbounds i32, i32* %8, i64 4
store i32 0, i32* %18
%20 = icmp ult i32* %16, %5
br i1 %20, label %7, label %21
21: ; preds = %7, %3
ret void
}