#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 /*<<< orphan*/ draw_back(int, char *);
int /*<<< orphan*/ draw_dots(int, int, char *);
int /*<<< orphan*/ draw_ghost_lr(int, int, char *);
int /*<<< orphan*/ draw_ghost_rl(int, int, char *);
int /*<<< orphan*/ draw_pac_lr(int, int, char *);
int /*<<< orphan*/ draw_pac_rl(int, int, char *);
int /*<<< orphan*/ save_image(int, char *);
int main(int argc, char *argv[]) {
  int frame;
  char image[8][80];
  int pos_pac, pos_ghost;
  int distance;
  (void)argc;
  (void)argv;
  for (frame = 0; frame < 72; frame++) {
    draw_back(frame, (char *)image);
    distance = (72 - frame) / 4;
    if (frame < 36) {
      pos_pac = 2 * frame;
      pos_ghost = pos_pac - distance - 8;
      draw_dots(frame, pos_pac, (char *)image);
      draw_pac_lr(frame, pos_pac, (char *)image);
      draw_ghost_lr(frame, pos_ghost, (char *)image);
    } else {
      pos_pac = 72 - 2 * (frame - 36);
      pos_ghost = pos_pac - distance - 8;
      draw_pac_rl(frame, pos_pac, (char *)image);
      draw_ghost_rl(frame, pos_ghost, (char *)image);
    }
    save_image(frame, (char *)image);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2b0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x48,-0x14(%rbp)
jge    12a0 <main+0x130>
mov    -0x14(%rbp),%edi
lea    -0x2a0(%rbp),%rsi
call   1050 <draw_back@plt>
mov    $0x48,%eax
sub    -0x14(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %eax,-0x2ac(%rbp)
cmpl   $0x24,-0x14(%rbp)
jge    122e <main+0xbe>
mov    -0x14(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x2a4(%rbp)
mov    -0x2a4(%rbp),%eax
sub    -0x2ac(%rbp),%eax
sub    $0x8,%eax
mov    %eax,-0x2a8(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x2a4(%rbp),%esi
lea    -0x2a0(%rbp),%rdx
call   1080 <draw_dots@plt>
mov    -0x14(%rbp),%edi
mov    -0x2a4(%rbp),%esi
lea    -0x2a0(%rbp),%rdx
call   1070 <draw_pac_lr@plt>
mov    -0x14(%rbp),%edi
mov    -0x2a8(%rbp),%esi
lea    -0x2a0(%rbp),%rdx
call   1090 <draw_ghost_lr@plt>
jmp    1283 <main+0x113>
mov    -0x14(%rbp),%ecx
sub    $0x24,%ecx
shl    $0x1,%ecx
mov    $0x48,%eax
sub    %ecx,%eax
mov    %eax,-0x2a4(%rbp)
mov    -0x2a4(%rbp),%eax
sub    -0x2ac(%rbp),%eax
sub    $0x8,%eax
mov    %eax,-0x2a8(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x2a4(%rbp),%esi
lea    -0x2a0(%rbp),%rdx
call   1030 <draw_pac_rl@plt>
mov    -0x14(%rbp),%edi
mov    -0x2a8(%rbp),%esi
lea    -0x2a0(%rbp),%rdx
call   1040 <draw_ghost_rl@plt>
mov    -0x14(%rbp),%edi
lea    -0x2a0(%rbp),%rsi
call   1060 <save_image@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1190 <main+0x20>
xor    %eax,%eax
add    $0x2b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x298,%rsp
mov    $0x88,%ebp
mov    $0x48,%r15d
mov    $0x90,%r14d
mov    $0xfffffff8,%r12d
xor    %r13d,%r13d
xor    %ebx,%ebx
jmp    11fa <main+0x8a>
nop
mov    %r12d,0x8(%rsp)
mov    %ebp,%r12d
sub    %r14d,%r12d
mov    %ebx,%edi
mov    0xc(%rsp),%r14d
mov    %r14d,%esi
lea    0x10(%rsp),%rdx
call   1030 <draw_pac_rl@plt>
mov    %ebx,%edi
mov    %r12d,%esi
mov    0x8(%rsp),%r12d
lea    0x10(%rsp),%rdx
call   1040 <draw_ghost_rl@plt>
mov    %ebx,%edi
lea    0x10(%rsp),%rsi
call   1060 <save_image@plt>
add    $0x1,%ebx
add    $0xfffffffe,%ebp
add    $0xffffffff,%r15d
add    $0xfffffffe,%r14d
add    $0x2,%r12d
add    $0x2,%r13d
cmp    $0x48,%ebx
je     125e <main+0xee>
mov    %r14d,0xc(%rsp)
mov    %r15d,%r14d
shr    $0x2,%r14d
mov    %ebx,%edi
lea    0x10(%rsp),%rsi
call   1050 <draw_back@plt>
cmp    $0x23,%ebx
ja     11a0 <main+0x30>
mov    %ebp,0x8(%rsp)
mov    %r12d,%ebp
sub    %r14d,%r12d
mov    %ebx,%edi
mov    %r13d,%esi
lea    0x10(%rsp),%r14
mov    %r14,%rdx
call   1080 <draw_dots@plt>
mov    %ebx,%edi
mov    %r13d,%esi
mov    %r14,%rdx
call   1070 <draw_pac_lr@plt>
mov    %ebx,%edi
mov    %r12d,%esi
mov    %ebp,%r12d
mov    0x8(%rsp),%ebp
mov    %r14,%rdx
call   1090 <draw_ghost_lr@plt>
mov    0xc(%rsp),%r14d
jmp    11d3 <main+0x63>
xor    %eax,%eax
add    $0x298,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca [8 x [80 x i8]]
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = load i32, i32* %4
%12 = load i8**, i8*** %5
store i32 0, i32* %6
br label %13
13: ; preds = %72, %2
%14 = load i32, i32* %6
%15 = icmp slt i32 %14, 72
br i1 %15, label %16, label %75
16: ; preds = %13
%17 = load i32, i32* %6
%18 = getelementptr inbounds [8 x [80 x i8]], [8 x [80 x i8]]* %7, i64 0, i64 0
%19 = bitcast [80 x i8]* %18 to i8*
%20 = call i32 @draw_back(i32 %17, i8* %19)
%21 = load i32, i32* %6
%22 = sub nsw i32 72, %21
%23 = sdiv i32 %22, 4
store i32 %23, i32* %10
%24 = load i32, i32* %6
%25 = icmp slt i32 %24, 36
br i1 %25, label %26, label %48
26: ; preds = %16
%27 = load i32, i32* %6
%28 = mul nsw i32 2, %27
store i32 %28, i32* %8
%29 = load i32, i32* %8
%30 = load i32, i32* %10
%31 = sub nsw i32 %29, %30
%32 = sub nsw i32 %31, 8
store i32 %32, i32* %9
%33 = load i32, i32* %6
%34 = load i32, i32* %8
%35 = getelementptr inbounds [8 x [80 x i8]], [8 x [80 x i8]]* %7, i64 0, i64 0
%36 = bitcast [80 x i8]* %35 to i8*
%37 = call i32 @draw_dots(i32 %33, i32 %34, i8* %36)
%38 = load i32, i32* %6
%39 = load i32, i32* %8
%40 = getelementptr inbounds [8 x [80 x i8]], [8 x [80 x i8]]* %7, i64 0, i64 0
%41 = bitcast [80 x i8]* %40 to i8*
%42 = call i32 @draw_pac_lr(i32 %38, i32 %39, i8* %41)
%43 = load i32, i32* %6
%44 = load i32, i32* %9
%45 = getelementptr inbounds [8 x [80 x i8]], [8 x [80 x i8]]* %7, i64 0, i64 0
%46 = bitcast [80 x i8]* %45 to i8*
%47 = call i32 @draw_ghost_lr(i32 %43, i32 %44, i8* %46)
br label %67
48: ; preds = %16
%49 = load i32, i32* %6
%50 = sub nsw i32 %49, 36
%51 = mul nsw i32 2, %50
%52 = sub nsw i32 72, %51
store i32 %52, i32* %8
%53 = load i32, i32* %8
%54 = load i32, i32* %10
%55 = sub nsw i32 %53, %54
%56 = sub nsw i32 %55, 8
store i32 %56, i32* %9
%57 = load i32, i32* %6
%58 = load i32, i32* %8
%59 = getelementptr inbounds [8 x [80 x i8]], [8 x [80 x i8]]* %7, i64 0, i64 0
%60 = bitcast [80 x i8]* %59 to i8*
%61 = call i32 @draw_pac_rl(i32 %57, i32 %58, i8* %60)
%62 = load i32, i32* %6
%63 = load i32, i32* %9
%64 = getelementptr inbounds [8 x [80 x i8]], [8 x [80 x i8]]* %7, i64 0, i64 0
%65 = bitcast [80 x i8]* %64 to i8*
%66 = call i32 @draw_ghost_rl(i32 %62, i32 %63, i8* %65)
br label %67
67: ; preds = %48, %26
%68 = load i32, i32* %6
%69 = getelementptr inbounds [8 x [80 x i8]], [8 x [80 x i8]]* %7, i64 0, i64 0
%70 = bitcast [80 x i8]* %69 to i8*
%71 = call i32 @save_image(i32 %68, i8* %70)
br label %72
72: ; preds = %67
%73 = load i32, i32* %6
%74 = add nsw i32 %73, 1
store i32 %74, i32* %6
br label %13
75: ; preds = %13
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [8 x [80 x i8]]
%4 = getelementptr inbounds [8 x [80 x i8]], [8 x [80 x i8]]* %3, i64 0, i64 0, i64 0
br label %5
5: ; preds = %2, %25
%6 = phi i32 [ 0, %2 ], [ %27, %25 ]
%7 = call i32 @draw_back(i32 %6, i8* %4)
%8 = sub nuw nsw i32 72, %6
%9 = lshr i32 %8, 2
%10 = icmp ult i32 %6, 36
br i1 %10, label %11, label %18
11: ; preds = %5
%12 = shl nuw nsw i32 %6, 1
%13 = add nsw i32 %12, -8
%14 = sub nsw i32 %13, %9
%15 = call i32 @draw_dots(i32 %6, i32 %12, i8* %4)
%16 = call i32 @draw_pac_lr(i32 %6, i32 %12, i8* %4)
%17 = call i32 @draw_ghost_lr(i32 %6, i32 %14, i8* %4)
br label %25
18: ; preds = %5
%19 = mul nsw i32 %6, -2
%20 = add nsw i32 %19, 144
%21 = add nsw i32 %19, 136
%22 = sub nsw i32 %21, %9
%23 = call i32 @draw_pac_rl(i32 %6, i32 %20, i8* %4)
%24 = call i32 @draw_ghost_rl(i32 %6, i32 %22, i8* %4)
br label %25
25: ; preds = %18, %11
%26 = call i32 @save_image(i32 %6, i8* %4)
%27 = add nuw nsw i32 %6, 1
%28 = icmp eq i32 %27, 72
br i1 %28, label %29, label %5
29: ; preds = %25
ret i32 0
}