#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 /*<<< orphan*/ fputc(int, unsigned int);
unsigned int output(char *);
int /*<<< orphan*/ wait_clocks(int);
void main() {
  unsigned z = output("z");
  wait_clocks(1000);
  fputc(1, z);
  wait_clocks(1000);
  fputc(2, z);
  wait_clocks(1000);
  fputc(3, z);
  wait_clocks(1000);
  fputc(4, z);
  wait_clocks(1000);
  fputc(5, z);
  wait_clocks(1000);
  fputc(6, z);
  wait_clocks(1000);
  fputc(7, z);
  wait_clocks(1000);
  fputc(8, z);
  wait_clocks(1000);
  fputc(9, z);
  wait_clocks(1000);
  fputc(10, z);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
call   1030 <output@plt>
mov    %eax,-0x4(%rbp)
mov    $0x3e8,%edi
call   1050 <wait_clocks@plt>
mov    -0x4(%rbp),%esi
mov    $0x1,%edi
call   1040 <fputc@plt>
mov    $0x3e8,%edi
call   1050 <wait_clocks@plt>
mov    -0x4(%rbp),%esi
mov    $0x2,%edi
call   1040 <fputc@plt>
mov    $0x3e8,%edi
call   1050 <wait_clocks@plt>
mov    -0x4(%rbp),%esi
mov    $0x3,%edi
call   1040 <fputc@plt>
mov    $0x3e8,%edi
call   1050 <wait_clocks@plt>
mov    -0x4(%rbp),%esi
mov    $0x4,%edi
call   1040 <fputc@plt>
mov    $0x3e8,%edi
call   1050 <wait_clocks@plt>
mov    -0x4(%rbp),%esi
mov    $0x5,%edi
call   1040 <fputc@plt>
mov    $0x3e8,%edi
call   1050 <wait_clocks@plt>
mov    -0x4(%rbp),%esi
mov    $0x6,%edi
call   1040 <fputc@plt>
mov    $0x3e8,%edi
call   1050 <wait_clocks@plt>
mov    -0x4(%rbp),%esi
mov    $0x7,%edi
call   1040 <fputc@plt>
mov    $0x3e8,%edi
call   1050 <wait_clocks@plt>
mov    -0x4(%rbp),%esi
mov    $0x8,%edi
call   1040 <fputc@plt>
mov    $0x3e8,%edi
call   1050 <wait_clocks@plt>
mov    -0x4(%rbp),%esi
mov    $0x9,%edi
call   1040 <fputc@plt>
mov    $0x3e8,%edi
call   1050 <wait_clocks@plt>
mov    -0x4(%rbp),%esi
mov    $0xa,%edi
call   1040 <fputc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xec8(%rip),%rdi
call   1030 <output@plt>
mov    %eax,%ebx
mov    $0x3e8,%edi
call   1050 <wait_clocks@plt>
mov    $0x1,%edi
mov    %ebx,%esi
call   1040 <fputc@plt>
mov    $0x3e8,%edi
call   1050 <wait_clocks@plt>
mov    $0x2,%edi
mov    %ebx,%esi
call   1040 <fputc@plt>
mov    $0x3e8,%edi
call   1050 <wait_clocks@plt>
mov    $0x3,%edi
mov    %ebx,%esi
call   1040 <fputc@plt>
mov    $0x3e8,%edi
call   1050 <wait_clocks@plt>
mov    $0x4,%edi
mov    %ebx,%esi
call   1040 <fputc@plt>
mov    $0x3e8,%edi
call   1050 <wait_clocks@plt>
mov    $0x5,%edi
mov    %ebx,%esi
call   1040 <fputc@plt>
mov    $0x3e8,%edi
call   1050 <wait_clocks@plt>
mov    $0x6,%edi
mov    %ebx,%esi
call   1040 <fputc@plt>
mov    $0x3e8,%edi
call   1050 <wait_clocks@plt>
mov    $0x7,%edi
mov    %ebx,%esi
call   1040 <fputc@plt>
mov    $0x3e8,%edi
call   1050 <wait_clocks@plt>
mov    $0x8,%edi
mov    %ebx,%esi
call   1040 <fputc@plt>
mov    $0x3e8,%edi
call   1050 <wait_clocks@plt>
mov    $0x9,%edi
mov    %ebx,%esi
call   1040 <fputc@plt>
mov    $0x3e8,%edi
call   1050 <wait_clocks@plt>
mov    $0xa,%edi
mov    %ebx,%esi
pop    %rbx
jmp    1040 <fputc@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"z\00"
define void @main() {
%1 = alloca i32
%2 = call i32 @output(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32 %2, i32* %1
%3 = call i32 @wait_clocks(i32 1000)
%4 = load i32, i32* %1
%5 = call i32 @fputc(i32 1, i32 %4)
%6 = call i32 @wait_clocks(i32 1000)
%7 = load i32, i32* %1
%8 = call i32 @fputc(i32 2, i32 %7)
%9 = call i32 @wait_clocks(i32 1000)
%10 = load i32, i32* %1
%11 = call i32 @fputc(i32 3, i32 %10)
%12 = call i32 @wait_clocks(i32 1000)
%13 = load i32, i32* %1
%14 = call i32 @fputc(i32 4, i32 %13)
%15 = call i32 @wait_clocks(i32 1000)
%16 = load i32, i32* %1
%17 = call i32 @fputc(i32 5, i32 %16)
%18 = call i32 @wait_clocks(i32 1000)
%19 = load i32, i32* %1
%20 = call i32 @fputc(i32 6, i32 %19)
%21 = call i32 @wait_clocks(i32 1000)
%22 = load i32, i32* %1
%23 = call i32 @fputc(i32 7, i32 %22)
%24 = call i32 @wait_clocks(i32 1000)
%25 = load i32, i32* %1
%26 = call i32 @fputc(i32 8, i32 %25)
%27 = call i32 @wait_clocks(i32 1000)
%28 = load i32, i32* %1
%29 = call i32 @fputc(i32 9, i32 %28)
%30 = call i32 @wait_clocks(i32 1000)
%31 = load i32, i32* %1
%32 = call i32 @fputc(i32 10, i32 %31)
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"z\00"
define void @main() {
%1 = tail call i32 @output(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @wait_clocks(i32 1000)
%3 = tail call i32 @fputc(i32 1, i32 %1)
%4 = tail call i32 @wait_clocks(i32 1000)
%5 = tail call i32 @fputc(i32 2, i32 %1)
%6 = tail call i32 @wait_clocks(i32 1000)
%7 = tail call i32 @fputc(i32 3, i32 %1)
%8 = tail call i32 @wait_clocks(i32 1000)
%9 = tail call i32 @fputc(i32 4, i32 %1)
%10 = tail call i32 @wait_clocks(i32 1000)
%11 = tail call i32 @fputc(i32 5, i32 %1)
%12 = tail call i32 @wait_clocks(i32 1000)
%13 = tail call i32 @fputc(i32 6, i32 %1)
%14 = tail call i32 @wait_clocks(i32 1000)
%15 = tail call i32 @fputc(i32 7, i32 %1)
%16 = tail call i32 @wait_clocks(i32 1000)
%17 = tail call i32 @fputc(i32 8, i32 %1)
%18 = tail call i32 @wait_clocks(i32 1000)
%19 = tail call i32 @fputc(i32 9, i32 %1)
%20 = tail call i32 @wait_clocks(i32 1000)
%21 = tail call i32 @fputc(i32 10, i32 %1)
ret void
}