#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*/ FILE;

/* Variables and functions */
int EOF;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fputc(int, int /*<<< orphan*/);
int /*<<< orphan*/ *stdin;
int /*<<< orphan*/ stdout;
int main(int argc, char *argv[]) {
  FILE *ur_s = fopen("/dev/urandom", "r");
  int c;
  while ((c = fgetc(stdin)) != EOF) {
    fputc(c, stdout);
    fputc(fgetc(ur_s), stdout);
  }
  fclose(ur_s);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xea3(%rip),%rdi
lea    0xea9(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    0x2e74(%rip),%rax
mov    (%rax),%rdi
call   1040 <fgetc@plt>
mov    %eax,-0x1c(%rbp)
mov    0x2e5a(%rip),%rcx
cmp    (%rcx),%eax
je     11bd <main+0x7d>
mov    -0x1c(%rbp),%edi
mov    0x2e38(%rip),%rax
mov    (%rax),%esi
call   1050 <fputc@plt>
mov    -0x18(%rbp),%rdi
call   1040 <fgetc@plt>
mov    %eax,%edi
mov    0x2e1f(%rip),%rax
mov    (%rax),%esi
call   1050 <fputc@plt>
jmp    116d <main+0x2d>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
lea    0xeb1(%rip),%rdi
lea    0xeb7(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,%r12
mov    0x2e83(%rip),%r14
mov    (%r14),%rdi
call   1040 <fgetc@plt>
mov    0x2e6c(%rip),%r15
cmp    (%r15),%eax
je     11a7 <main+0x67>
mov    0x2e50(%rip),%rbx
mov    (%rbx),%esi
mov    %eax,%edi
call   1050 <fputc@plt>
mov    %r12,%rdi
call   1040 <fgetc@plt>
mov    (%rbx),%esi
mov    %eax,%edi
call   1050 <fputc@plt>
mov    (%r14),%rdi
call   1040 <fgetc@plt>
cmp    (%r15),%eax
jne    1180 <main+0x40>
mov    %r12,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [13 x i8] c"/dev/urandom\00"
@.str.1 = [2 x i8] c"r\00"
@stdin = global i32* null
@EOF = global i32 0
@stdout = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = call i32* @fopen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %8, i32** %6
br label %9
9: ; preds = %14, %2
%10 = load i32*, i32** @stdin
%11 = call i32 @fgetc(i32* %10)
store i32 %11, i32* %7
%12 = load i32, i32* @EOF
%13 = icmp ne i32 %11, %12
br i1 %13, label %14, label %22
14: ; preds = %9
%15 = load i32, i32* %7
%16 = load i32, i32* @stdout
%17 = call i32 @fputc(i32 %15, i32 %16)
%18 = load i32*, i32** %6
%19 = call i32 @fgetc(i32* %18)
%20 = load i32, i32* @stdout
%21 = call i32 @fputc(i32 %19, i32 %20)
br label %9
22: ; preds = %9
%23 = load i32*, i32** %6
%24 = call i32 @fclose(i32* %23)
ret i32 0
}

LLVM IR (-O2):
@.str = [13 x i8] c"/dev/urandom\00"
@.str.1 = [2 x i8] c"r\00"
@stdin = global i32* null
@EOF = global i32 0
@stdout = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32* @fopen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%4 = load i32*, i32** @stdin
%5 = tail call i32 @fgetc(i32* %4)
%6 = load i32, i32* @EOF
%7 = icmp eq i32 %5, %6
br i1 %7, label %19, label %8
8: ; preds = %2, %8
%9 = phi i32 [ %16, %8 ], [ %5, %2 ]
%10 = load i32, i32* @stdout
%11 = tail call i32 @fputc(i32 %9, i32 %10)
%12 = tail call i32 @fgetc(i32* %3)
%13 = load i32, i32* @stdout
%14 = tail call i32 @fputc(i32 %12, i32 %13)
%15 = load i32*, i32** @stdin
%16 = tail call i32 @fgetc(i32* %15)
%17 = load i32, i32* @EOF
%18 = icmp eq i32 %16, %17
br i1 %18, label %19, label %8
19: ; preds = %8, %2
%20 = tail call i32 @fclose(i32* %3)
ret i32 0
}