#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*/ *SU_memcpy(char *, char *, int);
int /*<<< orphan*/ abort();
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char **argv) {
  char dest[255];
  int i;
  if (argc < 2)
    abort();
  if (SU_memcpy(dest, argv[1], 255) != NULL) {
    printf("dest is: %s\n", dest);
    for (i = 0; dest[i] != '\0'; i++)
      printf("dest[%d]: %c\n", i, dest[i]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    115a <main+0x2a>
mov    $0x0,%al
call   1040 <abort@plt>
lea    -0x110(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
mov    $0xff,%edx
call   1030 <SU_memcpy@plt>
cmp    $0x0,%rax
je     11f0 <main+0xc0>
lea    -0x110(%rbp),%rsi
lea    0xe75(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x114(%rbp)
movslq -0x114(%rbp),%rax
movsbl -0x110(%rbp,%rax,1),%eax
ff
cmp    $0x0,%eax
je     11eb <main+0xbb>
mov    -0x114(%rbp),%esi
movslq -0x114(%rbp),%rax
movsbl -0x110(%rbp,%rax,1),%edx
ff
lea    0xe3d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x114(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x114(%rbp)
jmp    119c <main+0x6c>
jmp    11f0 <main+0xc0>
xor    %eax,%eax
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x108,%rsp
cmp    $0x1,%edi
jle    11a9 <main+0x79>
mov    0x8(%rsi),%rsi
mov    %rsp,%rdi
mov    $0xff,%edx
call   1030 <SU_memcpy@plt>
test   %rax,%rax
je     119c <main+0x6c>
lea    0xea4(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    (%rsp),%al
test   %al,%al
je     119c <main+0x6c>
lea    0xe99(%rip),%r14
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
movsbl %al,%edx
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
movzbl 0x1(%rsp,%rbx,1),%eax
add    $0x1,%rbx
test   %al,%al
jne    1180 <main+0x50>
xor    %eax,%eax
add    $0x108,%rsp
pop    %rbx
pop    %r14
ret
xor    %eax,%eax
call   1040 <abort@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"dest is: %s\0A\00"
@.str.1 = [14 x i8] c"dest[%d]: %c\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [255 x i8]
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %8, 2
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = call i32 (...) @abort()
unreachable
12: ; preds = %2
%13 = getelementptr inbounds [255 x i8], [255 x i8]* %6, i64 0, i64 0
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = call i32* @SU_memcpy(i8* %13, i8* %16, i32 255)
%18 = icmp ne i32* %17, null
br i1 %18, label %19, label %41
19: ; preds = %12
%20 = getelementptr inbounds [255 x i8], [255 x i8]* %6, i64 0, i64 0
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %20)
store i32 0, i32* %7
br label %22
22: ; preds = %37, %19
%23 = load i32, i32* %7
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [255 x i8], [255 x i8]* %6, i64 0, i64 %24
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = icmp ne i32 %27, 0
br i1 %28, label %29, label %40
29: ; preds = %22
%30 = load i32, i32* %7
%31 = load i32, i32* %7
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [255 x i8], [255 x i8]* %6, i64 0, i64 %32
%34 = load i8, i8* %33
%35 = sext i8 %34 to i32
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %30, i32 %35)
br label %37
37: ; preds = %29
%38 = load i32, i32* %7
%39 = add nsw i32 %38, 1
store i32 %39, i32* %7
br label %22
40: ; preds = %22
br label %41
41: ; preds = %40, %12
ret i32 0
}

LLVM IR (-O2):
@.str = [13 x i8] c"dest is: %s\0A\00"
@.str.1 = [14 x i8] c"dest[%d]: %c\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [255 x i8]
%4 = getelementptr inbounds [255 x i8], [255 x i8]* %3, i64 0, i64 0
%5 = icmp slt i32 %0, 2
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call i32 (...) @abort()
unreachable
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = call i32* @SU_memcpy(i8* %4, i8* %10, i32 255)
%12 = icmp eq i32* %11, null
br i1 %12, label %27, label %13
13: ; preds = %8
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %4)
%15 = load i8, i8* %4
%16 = icmp eq i8 %15, 0
br i1 %16, label %27, label %17
17: ; preds = %13, %17
%18 = phi i64 [ %23, %17 ], [ 0, %13 ]
%19 = phi i8 [ %25, %17 ], [ %15, %13 ]
%20 = sext i8 %19 to i32
%21 = trunc i64 %18 to i32
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %21, i32 %20)
%23 = add nuw i64 %18, 1
%24 = getelementptr inbounds [255 x i8], [255 x i8]* %3, i64 0, i64 %23
%25 = load i8, i8* %24
%26 = icmp eq i8 %25, 0
br i1 %26, label %27, label %17
27: ; preds = %17, %13, %8
ret i32 0
}