#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*/ fprintf(int /*<<< orphan*/, char *, int, char);
int /*<<< orphan*/ memcpy(char *, void *, int);
int /*<<< orphan*/ set_bytes(long, int, char *);
int /*<<< orphan*/ stderr;
main() {
  int i;
  long longint = -10342;
  char charstring[sizeof(long)];
  char charstring_orig[sizeof(long)];
  memcpy(charstring_orig, (void *)&longint, 8);
  set_bytes(longint, 3, charstring);
  for (i = 0; i < sizeof(long); i++) {
    fprintf(stderr, "new:  %d: %d\n", i, charstring[i]);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0xffffffffffffd79a,-0x10(%rbp)
ff
lea    -0x20(%rbp),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x8,%edx
call   1040 <memcpy@plt>
mov    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rdx
mov    $0x3,%esi
call   1050 <set_bytes@plt>
movl   $0x0,-0x8(%rbp)
movslq -0x8(%rbp),%rax
cmp    $0x8,%rax
jae    11af <main+0x7f>
mov    0x2e59(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%edx
movslq -0x8(%rbp),%rax
lea    0xe69(%rip),%rsi
movsbl -0x18(%rbp,%rax,1),%ecx
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1172 <main+0x42>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
movq   $0xffffffffffffd79a,0x8(%rsp)
ff ff
lea    0x10(%rsp),%rdi
lea    0x8(%rsp),%rsi
mov    $0x8,%edx
call   1040 <memcpy@plt>
mov    0x8(%rsp),%rdi
mov    %rsp,%rdx
mov    $0x3,%esi
call   1050 <set_bytes@plt>
mov    0x2e73(%rip),%rbx
mov    (%rbx),%edi
movsbl (%rsp),%ecx
lea    0xe86(%rip),%r14
mov    %r14,%rsi
xor    %edx,%edx
call   1030 <fprintf@plt>
mov    (%rbx),%edi
movsbl 0x1(%rsp),%ecx
mov    %r14,%rsi
mov    $0x1,%edx
call   1030 <fprintf@plt>
mov    (%rbx),%edi
movsbl 0x2(%rsp),%ecx
mov    %r14,%rsi
mov    $0x2,%edx
call   1030 <fprintf@plt>
mov    (%rbx),%edi
movsbl 0x3(%rsp),%ecx
mov    %r14,%rsi
mov    $0x3,%edx
call   1030 <fprintf@plt>
mov    (%rbx),%edi
movsbl 0x4(%rsp),%ecx
mov    %r14,%rsi
mov    $0x4,%edx
call   1030 <fprintf@plt>
mov    (%rbx),%edi
movsbl 0x5(%rsp),%ecx
mov    %r14,%rsi
mov    $0x5,%edx
call   1030 <fprintf@plt>
mov    (%rbx),%edi
movsbl 0x6(%rsp),%ecx
mov    %r14,%rsi
mov    $0x6,%edx
call   1030 <fprintf@plt>
mov    (%rbx),%edi
movsbl 0x7(%rsp),%ecx
mov    %r14,%rsi
mov    $0x7,%edx
call   1030 <fprintf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [14 x i8] c"new: %d: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i64
%4 = alloca [8 x i8]
%5 = alloca [8 x i8]
store i32 0, i32* %1
store i64 -10342, i64* %3
%6 = getelementptr inbounds [8 x i8], [8 x i8]* %5, i64 0, i64 0
%7 = bitcast i64* %3 to i8*
%8 = call i32 @memcpy(i8* %6, i8* %7, i32 8)
%9 = load i64, i64* %3
%10 = getelementptr inbounds [8 x i8], [8 x i8]* %4, i64 0, i64 0
%11 = call i32 @set_bytes(i64 %9, i32 3, i8* %10)
store i32 0, i32* %2
br label %12
12: ; preds = %24, %0
%13 = load i32, i32* %2
%14 = sext i32 %13 to i64
%15 = icmp ult i64 %14, 8
br i1 %15, label %16, label %27
16: ; preds = %12
%17 = load i32, i32* @stderr
%18 = load i32, i32* %2
%19 = load i32, i32* %2
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [8 x i8], [8 x i8]* %4, i64 0, i64 %20
%22 = load i8, i8* %21
%23 = call i32 @fprintf(i32 %17, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %18, i8 signext %22)
br label %24
24: ; preds = %16
%25 = load i32, i32* %2
%26 = add nsw i32 %25, 1
store i32 %26, i32* %2
br label %12
27: ; preds = %12
%28 = load i32, i32* %1
ret i32 %28
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [14 x i8] c"new: %d: %d\0A\00"
define i32 @main() {
%1 = alloca i64
%2 = alloca [8 x i8]
%3 = alloca [8 x i8]
%4 = bitcast i64* %1 to i8*
store i64 -10342, i64* %1
%5 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 0
%7 = call i32 @memcpy(i8* %6, i8* %4, i32 8)
%8 = load i64, i64* %1
%9 = call i32 @set_bytes(i64 %8, i32 3, i8* %5)
%10 = load i32, i32* @stderr
%11 = load i8, i8* %5
%12 = call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 0, i8 signext %11)
%13 = load i32, i32* @stderr
%14 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 1
%15 = load i8, i8* %14
%16 = call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 1, i8 signext %15)
%17 = load i32, i32* @stderr
%18 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 2
%19 = load i8, i8* %18
%20 = call i32 @fprintf(i32 %17, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 2, i8 signext %19)
%21 = load i32, i32* @stderr
%22 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 3
%23 = load i8, i8* %22
%24 = call i32 @fprintf(i32 %21, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 3, i8 signext %23)
%25 = load i32, i32* @stderr
%26 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 4
%27 = load i8, i8* %26
%28 = call i32 @fprintf(i32 %25, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 4, i8 signext %27)
%29 = load i32, i32* @stderr
%30 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 5
%31 = load i8, i8* %30
%32 = call i32 @fprintf(i32 %29, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 5, i8 signext %31)
%33 = load i32, i32* @stderr
%34 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 6
%35 = load i8, i8* %34
%36 = call i32 @fprintf(i32 %33, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 6, i8 signext %35)
%37 = load i32, i32* @stderr
%38 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 7
%39 = load i8, i8* %38
%40 = call i32 @fprintf(i32 %37, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 7, i8 signext %39)
ret i32 0
}