#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 */
typedef int /*<<< orphan*/ XDR;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ XDR_DECODE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ printf(char *, long, float, char *);
int /*<<< orphan*/ xdr_float(int /*<<< orphan*/ *, float *);
int /*<<< orphan*/ xdr_long(int /*<<< orphan*/ *, long *);
int /*<<< orphan*/ xdr_string(int /*<<< orphan*/ *, char **, int);
int /*<<< orphan*/ xdrstdio_create(int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                                   int /*<<< orphan*/);
main() {
  FILE *fp;
  XDR xdrs;
  long val1;
  float val2;
  char *val3;
  val3 = NULL;
  fp = fopen("/tmp/test.xdr", "r");
  xdrstdio_create(&xdrs, fp, XDR_DECODE);
  xdr_long(&xdrs, &val1);
  xdr_float(&xdrs, &val2);
  xdr_string(&xdrs, &val3, 20);
  printf("%ld %f %s\n", val1, val2, val3);
  free(val3);
  fclose(fp);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x30(%rbp)
lea    0xe52(%rip),%rdi
lea    0xe57(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
mov    0x2e27(%rip),%rax
mov    (%rax),%edx
lea    -0x14(%rbp),%rdi
call   1040 <xdrstdio_create@plt>
lea    -0x14(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1090 <xdr_long@plt>
lea    -0x14(%rbp),%rdi
lea    -0x24(%rbp),%rsi
call   10b0 <xdr_float@plt>
lea    -0x14(%rbp),%rdi
lea    -0x30(%rbp),%rsi
mov    $0x14,%edx
call   1070 <xdr_string@plt>
mov    -0x20(%rbp),%rsi
movss  -0x24(%rbp),%xmm0
mov    -0x30(%rbp),%rdx
lea    0xdfa(%rip),%rdi
call   1060 <printf@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
mov    -0x10(%rbp),%rdi
call   1050 <fclose@plt>
xor    %edi,%edi
call   10a0 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x28,%rsp
movq   $0x0,0x8(%rsp)
lea    0xe59(%rip),%rdi
lea    0xe5e(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,%r14
mov    0x2e33(%rip),%rax
mov    (%rax),%edx
lea    0x24(%rsp),%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <xdrstdio_create@plt>
lea    0x18(%rsp),%rsi
mov    %rbx,%rdi
call   1090 <xdr_long@plt>
lea    0x14(%rsp),%rsi
mov    %rbx,%rdi
call   10b0 <xdr_float@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
mov    $0x14,%edx
call   1070 <xdr_string@plt>
mov    0x18(%rsp),%rsi
movss  0x14(%rsp),%xmm0
mov    0x8(%rsp),%rdx
lea    0xdfc(%rip),%rdi
call   1060 <printf@plt>
mov    0x8(%rsp),%rdi
call   1030 <free@plt>
mov    %r14,%rdi
call   1050 <fclose@plt>
xor    %edi,%edi
call   10a0 <exit@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"/tmp/test.xdr\00"
@.str.1 = [2 x i8] c"r\00"
@XDR_DECODE = global i32 0
@.str.2 = [11 x i8] c"%ld %f %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i64
%5 = alloca float
%6 = alloca i8*
store i32 0, i32* %1
store i8* null, i8** %6
%7 = call i32* @fopen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %7, i32** %2
%8 = load i32*, i32** %2
%9 = load i32, i32* @XDR_DECODE
%10 = call i32 @xdrstdio_create(i32* %3, i32* %8, i32 %9)
%11 = call i32 @xdr_long(i32* %3, i64* %4)
%12 = call i32 @xdr_float(i32* %3, float* %5)
%13 = call i32 @xdr_string(i32* %3, i8** %6, i32 20)
%14 = load i64, i64* %4
%15 = load float, float* %5
%16 = load i8*, i8** %6
%17 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i64 %14, float %15, i8* %16)
%18 = load i8*, i8** %6
%19 = call i32 @free(i8* %18)
%20 = load i32*, i32** %2
%21 = call i32 @fclose(i32* %20)
%22 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [14 x i8] c"/tmp/test.xdr\00"
@.str.1 = [2 x i8] c"r\00"
@XDR_DECODE = global i32 0
@.str.2 = [11 x i8] c"%ld %f %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca float
%4 = alloca i8*
%5 = bitcast i32* %1 to i8*
%6 = bitcast i64* %2 to i8*
%7 = bitcast float* %3 to i8*
%8 = bitcast i8** %4 to i8*
store i8* null, i8** %4
%9 = tail call i32* @fopen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%10 = load i32, i32* @XDR_DECODE
%11 = call i32 @xdrstdio_create(i32* %1, i32* %9, i32 %10)
%12 = call i32 @xdr_long(i32* %1, i64* %2)
%13 = call i32 @xdr_float(i32* %1, float* %3)
%14 = call i32 @xdr_string(i32* %1, i8** %4, i32 20)
%15 = load i64, i64* %2
%16 = load float, float* %3
%17 = load i8*, i8** %4
%18 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i64 %15, float %16, i8* %17)
%19 = load i8*, i8** %4
%20 = call i32 @free(i8* %19)
%21 = call i32 @fclose(i32* %9)
%22 = call i32 @exit(i32 0)
unreachable
}