#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 stat {
  int dummy;
};
struct file_stream {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ restore_mode(struct file_stream *, struct stat const *);
int /*<<< orphan*/ restore_owner_and_group(struct file_stream *,
                                           struct stat const *);
int /*<<< orphan*/ restore_timestamps(struct file_stream *, char const *,
                                      struct stat const *);
void restore_metadata(struct file_stream *out, const char *newpath,
                      const struct stat *stbuf) {
  restore_mode(out, stbuf);
  restore_owner_and_group(out, stbuf);
  restore_timestamps(out, newpath, stbuf);
}


x86 assembly (clang, -O0):
<restore_metadata>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <restore_mode@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1050 <restore_owner_and_group@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1040 <restore_timestamps@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<restore_metadata>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r15
mov    %rsi,%r14
mov    %rdi,%rbx
mov    %rdx,%rsi
call   1030 <restore_mode@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1050 <restore_owner_and_group@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <restore_timestamps@plt>

LLVM IR (-O0):
%struct.file_stream = type { i32 }
%struct.stat = type { i32 }
define void @restore_metadata(%struct.file_stream* %0, i8* %1, %struct.stat* %2) {
%4 = alloca %struct.file_stream*
%5 = alloca i8*
%6 = alloca %struct.stat*
store %struct.file_stream* %0, %struct.file_stream** %4
store i8* %1, i8** %5
store %struct.stat* %2, %struct.stat** %6
%7 = load %struct.file_stream*, %struct.file_stream** %4
%8 = load %struct.stat*, %struct.stat** %6
%9 = call i32 @restore_mode(%struct.file_stream* %7, %struct.stat* %8)
%10 = load %struct.file_stream*, %struct.file_stream** %4
%11 = load %struct.stat*, %struct.stat** %6
%12 = call i32 @restore_owner_and_group(%struct.file_stream* %10, %struct.stat* %11)
%13 = load %struct.file_stream*, %struct.file_stream** %4
%14 = load i8*, i8** %5
%15 = load %struct.stat*, %struct.stat** %6
%16 = call i32 @restore_timestamps(%struct.file_stream* %13, i8* %14, %struct.stat* %15)
ret void
}

LLVM IR (-O2):
%struct.file_stream = type { i32 }
%struct.stat = type { i32 }
define void @restore_metadata(%struct.file_stream* %0, i8* %1, %struct.stat* %2) {
%4 = tail call i32 @restore_mode(%struct.file_stream* %0, %struct.stat* %2)
%5 = tail call i32 @restore_owner_and_group(%struct.file_stream* %0, %struct.stat* %2)
%6 = tail call i32 @restore_timestamps(%struct.file_stream* %0, i8* %1, %struct.stat* %2)
ret void
}