#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 */
struct sigcontext {
  struct _fpstate *fpstate;
};
struct _fpstate {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ memcpy(struct sigcontext *, struct sigcontext *, int);
void sc_to_sc(void *to_ptr, void *from_ptr) {
  struct sigcontext *to = to_ptr, *from = from_ptr;
  int size = sizeof(*to);
  memcpy(to, from, size);
  if (from->fpstate != NULL)
    to->fpstate = (struct _fpstate *)(to + 1);
  to->fpstate = NULL;
}


x86 assembly (clang, -O0):
<sc_to_sc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
movl   $0x8,-0x24(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x24(%rbp),%edx
call   1030 <memcpy@plt>
mov    -0x20(%rbp),%rax
cmpq   $0x0,(%rax)
je     1164 <sc_to_sc+0x54>
mov    -0x18(%rbp),%rcx
add    $0x8,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
movq   $0x0,(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sc_to_sc>:
push   %rbx
mov    %rdi,%rbx
mov    $0x8,%edx
call   1030 <memcpy@plt>
movq   $0x0,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
%struct.sigcontext = type { %struct._fpstate* }
%struct._fpstate = type { i32 }
define void @sc_to_sc(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca %struct.sigcontext*
%6 = alloca %struct.sigcontext*
%7 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%8 = load i8*, i8** %3
%9 = bitcast i8* %8 to %struct.sigcontext*
store %struct.sigcontext* %9, %struct.sigcontext** %5
%10 = load i8*, i8** %4
%11 = bitcast i8* %10 to %struct.sigcontext*
store %struct.sigcontext* %11, %struct.sigcontext** %6
store i32 8, i32* %7
%12 = load %struct.sigcontext*, %struct.sigcontext** %5
%13 = load %struct.sigcontext*, %struct.sigcontext** %6
%14 = load i32, i32* %7
%15 = call i32 @memcpy(%struct.sigcontext* %12, %struct.sigcontext* %13, i32 %14)
%16 = load %struct.sigcontext*, %struct.sigcontext** %6
%17 = getelementptr inbounds %struct.sigcontext, %struct.sigcontext* %16, i32 0, i32 0
%18 = load %struct._fpstate*, %struct._fpstate** %17
%19 = icmp ne %struct._fpstate* %18, null
br i1 %19, label %20, label %26
20: ; preds = %2
%21 = load %struct.sigcontext*, %struct.sigcontext** %5
%22 = getelementptr inbounds %struct.sigcontext, %struct.sigcontext* %21, i64 1
%23 = bitcast %struct.sigcontext* %22 to %struct._fpstate*
%24 = load %struct.sigcontext*, %struct.sigcontext** %5
%25 = getelementptr inbounds %struct.sigcontext, %struct.sigcontext* %24, i32 0, i32 0
store %struct._fpstate* %23, %struct._fpstate** %25
br label %26
26: ; preds = %20, %2
%27 = load %struct.sigcontext*, %struct.sigcontext** %5
%28 = getelementptr inbounds %struct.sigcontext, %struct.sigcontext* %27, i32 0, i32 0
store %struct._fpstate* null, %struct._fpstate** %28
ret void
}

LLVM IR (-O2):
%struct.sigcontext = type { %struct._fpstate* }
%struct._fpstate = type { i32 }
define void @sc_to_sc(i8* %0, i8* %1) {
%3 = bitcast i8* %0 to %struct.sigcontext*
%4 = bitcast i8* %1 to %struct.sigcontext*
%5 = tail call i32 @memcpy(%struct.sigcontext* %3, %struct.sigcontext* %4, i32 8)
%6 = bitcast i8* %0 to %struct._fpstate**
store %struct._fpstate* null, %struct._fpstate** %6
ret void
}