#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 EXIT_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ MB_CUR_MAX;
int /*<<< orphan*/ MB_LEN_MAX;
int RAND_MAX;
int /*<<< orphan*/ printf(char *, int, int /*<<< orphan*/ *, int, int, int,
                          int /*<<< orphan*/, int /*<<< orphan*/);
int rand();
int main() {
  int f = rand();
  printf("f: %d, NULL: %p, EXIT_FAILURE; %d, EXIT_SUCCESS: %d, RAND_MAX: 0x%x, "
         "MB_CUR_MAX: %ld, MB_LEN_MAX: %ld\n",
         f, NULL, EXIT_FAILURE, EXIT_SUCCESS, RAND_MAX, MB_CUR_MAX, MB_LEN_MAX);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <rand@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
mov    0x2e85(%rip),%rax
mov    (%rax),%ecx
mov    0x2e74(%rip),%rax
mov    (%rax),%r8d
mov    0x2e8a(%rip),%rax
mov    (%rax),%r9d
mov    0x2e98(%rip),%rax
mov    (%rax),%r10d
mov    0x2e66(%rip),%rax
mov    (%rax),%eax
lea    0xe8d(%rip),%rdi
xor    %edx,%edx
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
call   1030 <printf@plt>
mov    0x2e37(%rip),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1040 <rand@plt>
mov    0x2e96(%rip),%rcx
mov    (%rcx),%ecx
mov    0x2e85(%rip),%r14
mov    (%r14),%r8d
mov    0x2e9b(%rip),%rdx
mov    (%rdx),%r9d
mov    0x2ea9(%rip),%rdx
mov    (%rdx),%r10d
mov    0x2e77(%rip),%rdx
mov    (%rdx),%ebx
lea    0xe9e(%rip),%rdi
mov    %eax,%esi
xor    %edx,%edx
push   %rbx
push   %r10
call   1030 <printf@plt>
add    $0x10,%rsp
mov    (%r14),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [103 x i8] c"f: %d, NULL: %p, EXIT_FAILURE; %d, EXIT_SUCCESS: %d, RAND_MAX: 0x%x, MB_CUR_MAX: %ld, MB_LEN_MAX: %ld\0A\00"
@EXIT_FAILURE = global i32 0
@EXIT_SUCCESS = global i32 0
@RAND_MAX = global i32 0
@MB_CUR_MAX = global i32 0
@MB_LEN_MAX = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 (...) @rand()
store i32 %3, i32* %2
%4 = load i32, i32* %2
%5 = load i32, i32* @EXIT_FAILURE
%6 = load i32, i32* @EXIT_SUCCESS
%7 = load i32, i32* @RAND_MAX
%8 = load i32, i32* @MB_CUR_MAX
%9 = load i32, i32* @MB_LEN_MAX
%10 = call i32 @printf(i8* getelementptr inbounds ([103 x i8], [103 x i8]* @.str, i64 0, i64 0), i32 %4, i32* null, i32 %5, i32 %6, i32 %7, i32 %8, i32 %9)
%11 = load i32, i32* @EXIT_SUCCESS
ret i32 %11
}

LLVM IR (-O2):
@.str = [103 x i8] c"f: %d, NULL: %p, EXIT_FAILURE; %d, EXIT_SUCCESS: %d, RAND_MAX: 0x%x, MB_CUR_MAX: %ld, MB_LEN_MAX: %ld\0A\00"
@EXIT_FAILURE = global i32 0
@EXIT_SUCCESS = global i32 0
@RAND_MAX = global i32 0
@MB_CUR_MAX = global i32 0
@MB_LEN_MAX = global i32 0
define i32 @main() {
%1 = tail call i32 (...) @rand()
%2 = load i32, i32* @EXIT_FAILURE
%3 = load i32, i32* @EXIT_SUCCESS
%4 = load i32, i32* @RAND_MAX
%5 = load i32, i32* @MB_CUR_MAX
%6 = load i32, i32* @MB_LEN_MAX
%7 = tail call i32 @printf(i8* getelementptr inbounds ([103 x i8], [103 x i8]* @.str, i64 0, i64 0), i32 %1, i32* null, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6)
%8 = load i32, i32* @EXIT_SUCCESS
ret i32 %8
}