#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 uint32_t;

/* Variables and functions */
void flash_ram_copy(uint32_t *dst, const uint32_t *src, uint32_t words_number) {
  uint32_t buf[32], i;
  while (words_number) {
    for (i = 0; i < 32; i++) {
      buf[i] = src[i];
    }
    for (i = 0; i < 32; i++) {
      dst[i] = buf[i];
    }
    dst += 32;
    src += 32;
    words_number -= 32;
  }
}


x86 assembly (clang, -O0):
<flash_ram_copy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     11d5 <flash_ram_copy+0xd5>
movl   $0x0,-0xa4(%rbp)
cmpl   $0x20,-0xa4(%rbp)
jge    1164 <flash_ram_copy+0x64>
mov    -0x10(%rbp),%rax
movslq -0xa4(%rbp),%rcx
mov    (%rax,%rcx,4),%ecx
movslq -0xa4(%rbp),%rax
mov    %ecx,-0xa0(%rbp,%rax,4)
mov    -0xa4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xa4(%rbp)
jmp    1127 <flash_ram_copy+0x27>
movl   $0x0,-0xa4(%rbp)
cmpl   $0x20,-0xa4(%rbp)
jge    11ab <flash_ram_copy+0xab>
movslq -0xa4(%rbp),%rax
mov    -0xa0(%rbp,%rax,4),%edx
mov    -0x8(%rbp),%rax
movslq -0xa4(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0xa4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xa4(%rbp)
jmp    116e <flash_ram_copy+0x6e>
mov    -0x8(%rbp),%rax
add    $0x80,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x80,%rax
mov    %rax,-0x10(%rbp)
mov    -0x14(%rbp),%eax
sub    $0x20,%eax
mov    %eax,-0x14(%rbp)
jmp    1113 <flash_ram_copy+0x13>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<flash_ram_copy>:
test   %edx,%edx
je     157d <flash_ram_copy+0x47d>
lea    -0x20(%rdx),%r8d
mov    %r8d,%eax
shr    $0x5,%eax
lea    0x1(%rax),%ecx
test   $0x7,%cl
je     1180 <flash_ram_copy+0x80>
add    $0x1,%al
movzbl %al,%ecx
and    $0x7,%ecx
shl    $0x5,%rcx
xor    %eax,%eax
nopl   0x0(%rax,%rax,1)
movups (%rsi),%xmm0
movups 0x10(%rsi),%xmm1
movups 0x20(%rsi),%xmm2
movups 0x30(%rsi),%xmm3
movups 0x40(%rsi),%xmm4
movups 0x50(%rsi),%xmm5
movups 0x60(%rsi),%xmm6
movups 0x70(%rsi),%xmm7
movups %xmm7,0x70(%rdi)
movups %xmm6,0x60(%rdi)
movups %xmm5,0x50(%rdi)
movups %xmm4,0x40(%rdi)
movups %xmm3,0x30(%rdi)
movups %xmm2,0x20(%rdi)
movups %xmm1,0x10(%rdi)
movups %xmm0,(%rdi)
sub    $0xffffffffffffff80,%rdi
sub    $0xffffffffffffff80,%rsi
add    $0x20,%rax
cmp    %eax,%ecx
jne    1130 <flash_ram_copy+0x30>
sub    %eax,%edx
cmp    $0xe0,%r8d
jb     157d <flash_ram_copy+0x47d>
mov    %edx,%eax
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movups (%rsi,%rcx,4),%xmm0
movups 0x10(%rsi,%rcx,4),%xmm1
movups 0x20(%rsi,%rcx,4),%xmm2
movups 0x30(%rsi,%rcx,4),%xmm3
movups 0x40(%rsi,%rcx,4),%xmm4
movups 0x50(%rsi,%rcx,4),%xmm5
movups 0x60(%rsi,%rcx,4),%xmm6
movups 0x70(%rsi,%rcx,4),%xmm7
movups %xmm7,0x70(%rdi,%rcx,4)
movups %xmm6,0x60(%rdi,%rcx,4)
movups %xmm5,0x50(%rdi,%rcx,4)
movups %xmm4,0x40(%rdi,%rcx,4)
movups %xmm3,0x30(%rdi,%rcx,4)
movups %xmm2,0x20(%rdi,%rcx,4)
movups %xmm1,0x10(%rdi,%rcx,4)
movups %xmm0,(%rdi,%rcx,4)
movups 0x80(%rsi,%rcx,4),%xmm0
movups 0x90(%rsi,%rcx,4),%xmm1
movups 0xa0(%rsi,%rcx,4),%xmm2
movups 0xb0(%rsi,%rcx,4),%xmm3
movups 0xc0(%rsi,%rcx,4),%xmm4
movups 0xd0(%rsi,%rcx,4),%xmm5
movups 0xe0(%rsi,%rcx,4),%xmm6
movups 0xf0(%rsi,%rcx,4),%xmm7
movups %xmm7,0xf0(%rdi,%rcx,4)
movups %xmm6,0xe0(%rdi,%rcx,4)
movups %xmm5,0xd0(%rdi,%rcx,4)
movups %xmm4,0xc0(%rdi,%rcx,4)
movups %xmm3,0xb0(%rdi,%rcx,4)
movups %xmm2,0xa0(%rdi,%rcx,4)
movups %xmm1,0x90(%rdi,%rcx,4)
movups %xmm0,0x80(%rdi,%rcx,4)
movups 0x100(%rsi,%rcx,4),%xmm0
movups 0x110(%rsi,%rcx,4),%xmm1
movups 0x120(%rsi,%rcx,4),%xmm2
movups 0x130(%rsi,%rcx,4),%xmm3
movups 0x140(%rsi,%rcx,4),%xmm4
movups 0x150(%rsi,%rcx,4),%xmm5
movups 0x160(%rsi,%rcx,4),%xmm6
movups 0x170(%rsi,%rcx,4),%xmm7
movups %xmm7,0x170(%rdi,%rcx,4)
movups %xmm6,0x160(%rdi,%rcx,4)
movups %xmm5,0x150(%rdi,%rcx,4)
movups %xmm4,0x140(%rdi,%rcx,4)
movups %xmm3,0x130(%rdi,%rcx,4)
movups %xmm2,0x120(%rdi,%rcx,4)
movups %xmm1,0x110(%rdi,%rcx,4)
movups %xmm0,0x100(%rdi,%rcx,4)
movups 0x180(%rsi,%rcx,4),%xmm0
movups 0x190(%rsi,%rcx,4),%xmm1
movups 0x1a0(%rsi,%rcx,4),%xmm2
movups 0x1b0(%rsi,%rcx,4),%xmm3
movups 0x1c0(%rsi,%rcx,4),%xmm4
movups 0x1d0(%rsi,%rcx,4),%xmm5
movups 0x1e0(%rsi,%rcx,4),%xmm6
movups 0x1f0(%rsi,%rcx,4),%xmm7
movups %xmm7,0x1f0(%rdi,%rcx,4)
movups %xmm6,0x1e0(%rdi,%rcx,4)
movups %xmm5,0x1d0(%rdi,%rcx,4)
movups %xmm4,0x1c0(%rdi,%rcx,4)
movups %xmm3,0x1b0(%rdi,%rcx,4)
movups %xmm2,0x1a0(%rdi,%rcx,4)
movups %xmm1,0x190(%rdi,%rcx,4)
movups %xmm0,0x180(%rdi,%rcx,4)
movups 0x200(%rsi,%rcx,4),%xmm0
movups 0x210(%rsi,%rcx,4),%xmm1
movups 0x220(%rsi,%rcx,4),%xmm2
movups 0x230(%rsi,%rcx,4),%xmm3
movups 0x240(%rsi,%rcx,4),%xmm4
movups 0x250(%rsi,%rcx,4),%xmm5
movups 0x260(%rsi,%rcx,4),%xmm6
movups 0x270(%rsi,%rcx,4),%xmm7
movups %xmm7,0x270(%rdi,%rcx,4)
movups %xmm6,0x260(%rdi,%rcx,4)
movups %xmm5,0x250(%rdi,%rcx,4)
movups %xmm4,0x240(%rdi,%rcx,4)
movups %xmm3,0x230(%rdi,%rcx,4)
movups %xmm2,0x220(%rdi,%rcx,4)
movups %xmm1,0x210(%rdi,%rcx,4)
movups %xmm0,0x200(%rdi,%rcx,4)
movups 0x280(%rsi,%rcx,4),%xmm0
movups 0x290(%rsi,%rcx,4),%xmm1
movups 0x2a0(%rsi,%rcx,4),%xmm2
movups 0x2b0(%rsi,%rcx,4),%xmm3
movups 0x2c0(%rsi,%rcx,4),%xmm4
movups 0x2d0(%rsi,%rcx,4),%xmm5
movups 0x2e0(%rsi,%rcx,4),%xmm6
movups 0x2f0(%rsi,%rcx,4),%xmm7
movups %xmm7,0x2f0(%rdi,%rcx,4)
movups %xmm6,0x2e0(%rdi,%rcx,4)
movups %xmm5,0x2d0(%rdi,%rcx,4)
movups %xmm4,0x2c0(%rdi,%rcx,4)
movups %xmm3,0x2b0(%rdi,%rcx,4)
movups %xmm2,0x2a0(%rdi,%rcx,4)
movups %xmm1,0x290(%rdi,%rcx,4)
movups %xmm0,0x280(%rdi,%rcx,4)
movups 0x300(%rsi,%rcx,4),%xmm0
movups 0x310(%rsi,%rcx,4),%xmm1
movups 0x320(%rsi,%rcx,4),%xmm2
movups 0x330(%rsi,%rcx,4),%xmm3
movups 0x340(%rsi,%rcx,4),%xmm4
movups 0x350(%rsi,%rcx,4),%xmm5
movups 0x360(%rsi,%rcx,4),%xmm6
movups 0x370(%rsi,%rcx,4),%xmm7
movups %xmm7,0x370(%rdi,%rcx,4)
movups %xmm6,0x360(%rdi,%rcx,4)
movups %xmm5,0x350(%rdi,%rcx,4)
movups %xmm4,0x340(%rdi,%rcx,4)
movups %xmm3,0x330(%rdi,%rcx,4)
movups %xmm2,0x320(%rdi,%rcx,4)
movups %xmm1,0x310(%rdi,%rcx,4)
movups %xmm0,0x300(%rdi,%rcx,4)
movups 0x380(%rsi,%rcx,4),%xmm0
movups 0x390(%rsi,%rcx,4),%xmm1
movups 0x3a0(%rsi,%rcx,4),%xmm2
movups 0x3b0(%rsi,%rcx,4),%xmm3
movups 0x3c0(%rsi,%rcx,4),%xmm4
movups 0x3d0(%rsi,%rcx,4),%xmm5
movups 0x3e0(%rsi,%rcx,4),%xmm6
movups 0x3f0(%rsi,%rcx,4),%xmm7
movups %xmm7,0x3f0(%rdi,%rcx,4)
movups %xmm6,0x3e0(%rdi,%rcx,4)
movups %xmm5,0x3d0(%rdi,%rcx,4)
movups %xmm4,0x3c0(%rdi,%rcx,4)
movups %xmm3,0x3b0(%rdi,%rcx,4)
movups %xmm2,0x3a0(%rdi,%rcx,4)
movups %xmm1,0x390(%rdi,%rcx,4)
movups %xmm0,0x380(%rdi,%rcx,4)
add    $0x100,%rcx
cmp    %ecx,%eax
jne    11a0 <flash_ram_copy+0xa0>
ret

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

LLVM IR (-O2):
define void @flash_ram_copy(i32* nocapture writeonly %0, i32* nocapture %1, i32 %2) {
%4 = icmp eq i32 %2, 0
br i1 %4, label %66, label %5
5: ; preds = %3
%6 = add i32 %2, -32
%7 = lshr i32 %6, 5
%8 = add nuw nsw i32 %7, 1
%9 = and i32 %8, 7
%10 = icmp eq i32 %9, 0
br i1 %10, label %23, label %11
11: ; preds = %5, %11
%12 = phi i32 [ %20, %11 ], [ %2, %5 ]
%13 = phi i32* [ %19, %11 ], [ %1, %5 ]
%14 = phi i32* [ %18, %11 ], [ %0, %5 ]
%15 = phi i32 [ %21, %11 ], [ 0, %5 ]
%16 = bitcast i32* %14 to i8*
%17 = bitcast i32* %13 to i8*
%18 = getelementptr inbounds i32, i32* %14, i64 32
%19 = getelementptr inbounds i32, i32* %13, i64 32
%20 = add nsw i32 %12, -32
%21 = add i32 %15, 1
%22 = icmp eq i32 %21, %9
br i1 %22, label %23, label %11
23: ; preds = %11, %5
%24 = phi i32 [ %2, %5 ], [ %20, %11 ]
%25 = phi i32* [ %1, %5 ], [ %19, %11 ]
%26 = phi i32* [ %0, %5 ], [ %18, %11 ]
%27 = icmp ult i32 %6, 224
br i1 %27, label %66, label %28
28: ; preds = %23, %28
%29 = phi i32 [ %64, %28 ], [ %24, %23 ]
%30 = phi i32* [ %63, %28 ], [ %25, %23 ]
%31 = phi i32* [ %62, %28 ], [ %26, %23 ]
%32 = bitcast i32* %31 to i8*
%33 = bitcast i32* %30 to i8*
%34 = getelementptr inbounds i32, i32* %31, i64 32
%35 = getelementptr inbounds i32, i32* %30, i64 32
%36 = bitcast i32* %34 to i8*
%37 = bitcast i32* %35 to i8*
%38 = getelementptr inbounds i32, i32* %31, i64 64
%39 = getelementptr inbounds i32, i32* %30, i64 64
%40 = bitcast i32* %38 to i8*
%41 = bitcast i32* %39 to i8*
%42 = getelementptr inbounds i32, i32* %31, i64 96
%43 = getelementptr inbounds i32, i32* %30, i64 96
%44 = bitcast i32* %42 to i8*
%45 = bitcast i32* %43 to i8*
%46 = getelementptr inbounds i32, i32* %31, i64 128
%47 = getelementptr inbounds i32, i32* %30, i64 128
%48 = bitcast i32* %46 to i8*
%49 = bitcast i32* %47 to i8*
%50 = getelementptr inbounds i32, i32* %31, i64 160
%51 = getelementptr inbounds i32, i32* %30, i64 160
%52 = bitcast i32* %50 to i8*
%53 = bitcast i32* %51 to i8*
%54 = getelementptr inbounds i32, i32* %31, i64 192
%55 = getelementptr inbounds i32, i32* %30, i64 192
%56 = bitcast i32* %54 to i8*
%57 = bitcast i32* %55 to i8*
%58 = getelementptr inbounds i32, i32* %31, i64 224
%59 = getelementptr inbounds i32, i32* %30, i64 224
%60 = bitcast i32* %58 to i8*
%61 = bitcast i32* %59 to i8*
%62 = getelementptr inbounds i32, i32* %31, i64 256
%63 = getelementptr inbounds i32, i32* %30, i64 256
%64 = add nsw i32 %29, -256
%65 = icmp eq i32 %64, 0
br i1 %65, label %66, label %28
66: ; preds = %23, %28, %3
ret void
}