#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 */
long pop();
int /*<<< orphan*/ push(long);
void stack_move(char *start, char *end) {
  long items[255];
  for (char *c = start; *c; c++)
    items[(int)*c] = pop();
  for (char *c = end; *c; c++)
    push(items[(int)*c]);
}


x86 assembly (clang, -O0):
<stack_move>:
push   %rbp
mov    %rsp,%rbp
sub    $0x820,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x818(%rbp)
mov    -0x818(%rbp),%rax
cmpb   $0x0,(%rax)
je     1183 <stack_move+0x63>
mov    $0x0,%al
call   1030 <pop@plt>
mov    %rax,%rcx
mov    -0x818(%rbp),%rax
movsbl (%rax),%eax
cltq
mov    %rcx,-0x810(%rbp,%rax,8)
ff
mov    -0x818(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x818(%rbp)
jmp    113e <stack_move+0x1e>
mov    -0x10(%rbp),%rax
mov    %rax,-0x820(%rbp)
mov    -0x820(%rbp),%rax
cmpb   $0x0,(%rax)
je     11ce <stack_move+0xae>
mov    -0x820(%rbp),%rax
movsbl (%rax),%eax
cltq
mov    -0x810(%rbp,%rax,8),%rdi
ff
call   1040 <push@plt>
mov    -0x820(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x820(%rbp)
jmp    118e <stack_move+0x6e>
add    $0x820,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stack_move>:
push   %r14
push   %rbx
sub    $0x7f8,%rsp
mov    %rsi,%r14
cmpb   $0x0,(%rdi)
je     1159 <stack_move+0x39>
mov    %rdi,%rbx
add    $0x1,%rbx
nopl   0x0(%rax)
xor    %eax,%eax
call   1030 <pop@plt>
movsbq -0x1(%rbx),%rcx
mov    %rax,(%rsp,%rcx,8)
cmpb   $0x0,(%rbx)
lea    0x1(%rbx),%rbx
jne    1140 <stack_move+0x20>
mov    (%r14),%al
test   %al,%al
je     1189 <stack_move+0x69>
add    $0x1,%r14
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsbq %al,%rax
mov    (%rsp,%rax,8),%rdi
call   1040 <push@plt>
movzbl (%r14),%eax
add    $0x1,%r14
test   %al,%al
jne    1170 <stack_move+0x50>
add    $0x7f8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define void @stack_move(i8* nocapture %0, i8* nocapture %1) {
%3 = alloca [255 x i64]
%4 = bitcast [255 x i64]* %3 to i8*
%5 = load i8, i8* %0
%6 = icmp eq i8 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %10, %2
%8 = load i8, i8* %1
%9 = icmp eq i8 %8, 0
br i1 %9, label %19, label %20
10: ; preds = %2, %10
%11 = phi i8* [ %16, %10 ], [ %0, %2 ]
%12 = tail call i64 (...) @pop()
%13 = load i8, i8* %11
%14 = sext i8 %13 to i64
%15 = getelementptr inbounds [255 x i64], [255 x i64]* %3, i64 0, i64 %14
store i64 %12, i64* %15
%16 = getelementptr inbounds i8, i8* %11, i64 1
%17 = load i8, i8* %16
%18 = icmp eq i8 %17, 0
br i1 %18, label %7, label %10
19: ; preds = %20, %7
ret void
20: ; preds = %7, %20
%21 = phi i8 [ %28, %20 ], [ %8, %7 ]
%22 = phi i8* [ %27, %20 ], [ %1, %7 ]
%23 = sext i8 %21 to i64
%24 = getelementptr inbounds [255 x i64], [255 x i64]* %3, i64 0, i64 %23
%25 = load i64, i64* %24
%26 = tail call i32 @push(i64 %25)
%27 = getelementptr inbounds i8, i8* %22, i64 1
%28 = load i8, i8* %27
%29 = icmp eq i8 %28, 0
br i1 %29, label %19, label %20
}