#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 jid {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ jid_domain(struct jid const *);
int /*<<< orphan*/ jid_local(struct jid const *);
struct jid *jid_new();
int /*<<< orphan*/ jid_resource(struct jid const *);
int /*<<< orphan*/ jid_set_domain(struct jid *, int /*<<< orphan*/);
int /*<<< orphan*/ jid_set_local(struct jid *, int /*<<< orphan*/);
int /*<<< orphan*/ jid_set_resource(struct jid *, int /*<<< orphan*/);
struct jid *jid_new_from_jid(const struct jid *jid) {
  struct jid *newjid = jid_new();
  jid_set_local(newjid, jid_local(jid));
  jid_set_domain(newjid, jid_domain(jid));
  jid_set_resource(newjid, jid_resource(jid));
  return newjid;
}


x86 assembly (clang, -O0):
<jid_new_from_jid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1070 <jid_new@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <jid_local@plt>
mov    -0x28(%rbp),%rdi
mov    %eax,%esi
call   1060 <jid_set_local@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
call   1080 <jid_domain@plt>
mov    -0x20(%rbp),%rdi
mov    %eax,%esi
call   1040 <jid_set_domain@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1090 <jid_resource@plt>
mov    -0x18(%rbp),%rdi
mov    %eax,%esi
call   1030 <jid_set_resource@plt>
mov    -0x10(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<jid_new_from_jid>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
xor    %eax,%eax
call   1070 <jid_new@plt>
mov    %rax,%rbx
mov    %r14,%rdi
call   1050 <jid_local@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1060 <jid_set_local@plt>
mov    %r14,%rdi
call   1080 <jid_domain@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <jid_set_domain@plt>
mov    %r14,%rdi
call   1090 <jid_resource@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <jid_set_resource@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.jid = type { i32 }
define %struct.jid* @jid_new_from_jid(%struct.jid* %0) {
%2 = alloca %struct.jid*
%3 = alloca %struct.jid*
store %struct.jid* %0, %struct.jid** %2
%4 = call %struct.jid* (...) @jid_new()
store %struct.jid* %4, %struct.jid** %3
%5 = load %struct.jid*, %struct.jid** %3
%6 = load %struct.jid*, %struct.jid** %2
%7 = call i32 @jid_local(%struct.jid* %6)
%8 = call i32 @jid_set_local(%struct.jid* %5, i32 %7)
%9 = load %struct.jid*, %struct.jid** %3
%10 = load %struct.jid*, %struct.jid** %2
%11 = call i32 @jid_domain(%struct.jid* %10)
%12 = call i32 @jid_set_domain(%struct.jid* %9, i32 %11)
%13 = load %struct.jid*, %struct.jid** %3
%14 = load %struct.jid*, %struct.jid** %2
%15 = call i32 @jid_resource(%struct.jid* %14)
%16 = call i32 @jid_set_resource(%struct.jid* %13, i32 %15)
%17 = load %struct.jid*, %struct.jid** %3
ret %struct.jid* %17
}

LLVM IR (-O2):
%struct.jid = type { i32 }
define %struct.jid* @jid_new_from_jid(%struct.jid* %0) {
%2 = tail call %struct.jid* (...) @jid_new()
%3 = tail call i32 @jid_local(%struct.jid* %0)
%4 = tail call i32 @jid_set_local(%struct.jid* %2, i32 %3)
%5 = tail call i32 @jid_domain(%struct.jid* %0)
%6 = tail call i32 @jid_set_domain(%struct.jid* %2, i32 %5)
%7 = tail call i32 @jid_resource(%struct.jid* %0)
%8 = tail call i32 @jid_set_resource(%struct.jid* %2, i32 %7)
ret %struct.jid* %2
}