#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 */
int /*<<< orphan*/ create_frame(int, int /*<<< orphan*/ ***,
                                int /*<<< orphan*/ ***);
int /*<<< orphan*/ load_image(char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ save_image(int, int /*<<< orphan*/ ***);
int main(int argc, char *argv[]) {
  int i;
  uint8_t image[4 * 100][80][3];
  uint8_t frame[8][80][3];
  (void)argc;
  (void)argv;
  load_image("scroll.rgb", (uint8_t *)image);
  int range = (8 * 4) + 4 * 100;
  for (i = 0; i < range; i++) {
    create_frame(i - (8 * 4), frame, image);
    save_image(i, frame);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x5fa30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x5dc20(%rbp),%rsi
lea    0xea9(%rip),%rdi
call   1040 <load_image@plt>
movl   $0x1b0,-0x5fa24(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x5fa24(%rbp),%eax
jge    11b2 <main+0x82>
mov    -0x14(%rbp),%edi
sub    $0x20,%edi
lea    -0x5fa20(%rbp),%rsi
lea    -0x5dc20(%rbp),%rdx
call   1050 <create_frame@plt>
mov    -0x14(%rbp),%edi
lea    -0x5fa20(%rbp),%rsi
call   1030 <save_image@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    116d <main+0x3d>
xor    %eax,%eax
add    $0x5fa30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x5fa08,%rsp
lea    0xebc(%rip),%rdi
lea    0x1e00(%rsp),%r14
mov    %r14,%rsi
call   1040 <load_image@plt>
mov    $0xffffffe0,%ebx
mov    %rsp,%r15
nopl   0x0(%rax)
lea    0x20(%rbx),%ebp
mov    %ebx,%edi
mov    %r15,%rsi
mov    %r14,%rdx
call   1050 <create_frame@plt>
mov    %ebp,%edi
mov    %r15,%rsi
call   1030 <save_image@plt>
add    $0x1,%ebx
cmp    $0x190,%ebx
jne    1160 <main+0x30>
xor    %eax,%eax
add    $0x5fa08,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [11 x i8] c"scroll.rgb\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca [400 x [80 x [3 x i32]]]
%8 = alloca [8 x [80 x [3 x i32]]]
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i32, i32* %4
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds [400 x [80 x [3 x i32]]], [400 x [80 x [3 x i32]]]* %7, i64 0, i64 0
%13 = bitcast [80 x [3 x i32]]* %12 to i32*
%14 = call i32 @load_image(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32* %13)
store i32 432, i32* %9
store i32 0, i32* %6
br label %15
15: ; preds = %31, %2
%16 = load i32, i32* %6
%17 = load i32, i32* %9
%18 = icmp slt i32 %16, %17
br i1 %18, label %19, label %34
19: ; preds = %15
%20 = load i32, i32* %6
%21 = sub nsw i32 %20, 32
%22 = getelementptr inbounds [8 x [80 x [3 x i32]]], [8 x [80 x [3 x i32]]]* %8, i64 0, i64 0
%23 = bitcast [80 x [3 x i32]]* %22 to i32***
%24 = getelementptr inbounds [400 x [80 x [3 x i32]]], [400 x [80 x [3 x i32]]]* %7, i64 0, i64 0
%25 = bitcast [80 x [3 x i32]]* %24 to i32***
%26 = call i32 @create_frame(i32 %21, i32*** %23, i32*** %25)
%27 = load i32, i32* %6
%28 = getelementptr inbounds [8 x [80 x [3 x i32]]], [8 x [80 x [3 x i32]]]* %8, i64 0, i64 0
%29 = bitcast [80 x [3 x i32]]* %28 to i32***
%30 = call i32 @save_image(i32 %27, i32*** %29)
br label %31
31: ; preds = %19
%32 = load i32, i32* %6
%33 = add nsw i32 %32, 1
store i32 %33, i32* %6
br label %15
34: ; preds = %15
ret i32 0
}

LLVM IR (-O2):
@.str = [11 x i8] c"scroll.rgb\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [400 x [80 x [3 x i32]]]
%4 = alloca [8 x [80 x [3 x i32]]]
%5 = bitcast [400 x [80 x [3 x i32]]]* %3 to i8*
%6 = bitcast [8 x [80 x [3 x i32]]]* %4 to i8*
%7 = getelementptr inbounds [400 x [80 x [3 x i32]]], [400 x [80 x [3 x i32]]]* %3, i64 0, i64 0, i64 0, i64 0
%8 = call i32 @load_image(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32* %7)
%9 = bitcast [8 x [80 x [3 x i32]]]* %4 to i32***
%10 = bitcast [400 x [80 x [3 x i32]]]* %3 to i32***
br label %11
11: ; preds = %2, %11
%12 = phi i32 [ 0, %2 ], [ %16, %11 ]
%13 = add nsw i32 %12, -32
%14 = call i32 @create_frame(i32 %13, i32*** %9, i32*** %10)
%15 = call i32 @save_image(i32 %12, i32*** %9)
%16 = add nuw nsw i32 %12, 1
%17 = icmp eq i32 %16, 432
br i1 %17, label %18, label %11
18: ; preds = %11
ret i32 0
}