#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*/ memcpy(char *, char *, int);
int sequence_convert_int(char *p_int) {
  int i;
  char *p_loc;
  char tmp_int[4];
  p_loc = p_int;
  memcpy(tmp_int, p_loc, 4);
  for (i = 0; i < 4; i++) {
    *p_loc = tmp_int[3 - i];
    p_loc++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<sequence_convert_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
lea    -0x1c(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    $0x4,%edx
call   1030 <memcpy@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0x4,-0xc(%rbp)
jge    1175 <sequence_convert_int+0x65>
mov    $0x3,%eax
sub    -0xc(%rbp),%eax
cltq
mov    -0x1c(%rbp,%rax,1),%cl
mov    -0x18(%rbp),%rax
mov    %cl,(%rax)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    113d <sequence_convert_int+0x2d>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sequence_convert_int>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
lea    0xc(%rsp),%rdi
mov    %rbx,%rsi
mov    $0x4,%edx
call   1030 <memcpy@plt>
mov    0xf(%rsp),%al
mov    %al,(%rbx)
mov    0xe(%rsp),%al
mov    %al,0x1(%rbx)
mov    0xd(%rsp),%al
mov    %al,0x2(%rbx)
mov    0xc(%rsp),%al
mov    %al,0x3(%rbx)
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @sequence_convert_int(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i8*
%5 = alloca [4 x i8]
store i8* %0, i8** %2
%6 = load i8*, i8** %2
store i8* %6, i8** %4
%7 = getelementptr inbounds [4 x i8], [4 x i8]* %5, i64 0, i64 0
%8 = load i8*, i8** %4
%9 = call i32 @memcpy(i8* %7, i8* %8, i32 4)
store i32 0, i32* %3
br label %10
10: ; preds = %22, %1
%11 = load i32, i32* %3
%12 = icmp slt i32 %11, 4
br i1 %12, label %13, label %25
13: ; preds = %10
%14 = load i32, i32* %3
%15 = sub nsw i32 3, %14
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [4 x i8], [4 x i8]* %5, i64 0, i64 %16
%18 = load i8, i8* %17
%19 = load i8*, i8** %4
store i8 %18, i8* %19
%20 = load i8*, i8** %4
%21 = getelementptr inbounds i8, i8* %20, i32 1
store i8* %21, i8** %4
br label %22
22: ; preds = %13
%23 = load i32, i32* %3
%24 = add nsw i32 %23, 1
store i32 %24, i32* %3
br label %10
25: ; preds = %10
ret i32 0
}

LLVM IR (-O2):
define i32 @sequence_convert_int(i8* %0) {
%2 = alloca [4 x i8]
%3 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%4 = call i32 @memcpy(i8* %3, i8* %0, i32 4)
%5 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 3
%6 = load i8, i8* %5
store i8 %6, i8* %0
%7 = getelementptr inbounds i8, i8* %0, i64 1
%8 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 2
%9 = load i8, i8* %8
store i8 %9, i8* %7
%10 = getelementptr inbounds i8, i8* %0, i64 2
%11 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 1
%12 = load i8, i8* %11
store i8 %12, i8* %10
%13 = getelementptr inbounds i8, i8* %0, i64 3
%14 = load i8, i8* %3
store i8 %14, i8* %13
ret i32 0
}