#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*/ syscall_printString(char *);
int /*<<< orphan*/ syscall_readSector(char *, int);
int /*<<< orphan*/ syscall_readString(char *);
void main() {
  char str[80], buffer[512];
  syscall_printString("Enter a line: ");
  syscall_readString(str);
  syscall_printString("\r\n");
  syscall_printString(str);
  syscall_printString("\r\n");
  syscall_printString("Reading sector 30 from floppy\r\n");
  syscall_readSector(buffer, 30);
  syscall_printString(buffer);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x250,%rsp
lea    0xebe(%rip),%rdi
call   1030 <syscall_printString@plt>
lea    -0x50(%rbp),%rdi
call   1050 <syscall_readString@plt>
lea    0xed5(%rip),%rdi
call   1030 <syscall_printString@plt>
lea    -0x50(%rbp),%rdi
call   1030 <syscall_printString@plt>
lea    0xec0(%rip),%rdi
call   1030 <syscall_printString@plt>
lea    0xe97(%rip),%rdi
call   1030 <syscall_printString@plt>
lea    -0x250(%rbp),%rdi
mov    $0x1e,%esi
call   1040 <syscall_readSector@plt>
lea    -0x250(%rbp),%rdi
call   1030 <syscall_printString@plt>
add    $0x250,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x258,%rsp
lea    0xebf(%rip),%rdi
call   1030 <syscall_printString@plt>
mov    %rsp,%r14
mov    %r14,%rdi
call   1050 <syscall_readString@plt>
lea    0xed4(%rip),%rbx
mov    %rbx,%rdi
call   1030 <syscall_printString@plt>
mov    %r14,%rdi
call   1030 <syscall_printString@plt>
mov    %rbx,%rdi
call   1030 <syscall_printString@plt>
lea    0xe98(%rip),%rdi
call   1030 <syscall_printString@plt>
lea    0x50(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x1e,%esi
call   1040 <syscall_readSector@plt>
mov    %rbx,%rdi
call   1030 <syscall_printString@plt>
add    $0x258,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [15 x i8] c"Enter a line: \00"
@.str.1 = [3 x i8] c"\0D\0A\00"
@.str.2 = [32 x i8] c"Reading sector 30 from floppy\0D\0A\00"
define void @main() {
%1 = alloca [80 x i8]
%2 = alloca [512 x i8]
%3 = call i32 @syscall_printString(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%4 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%5 = call i32 @syscall_readString(i8* %4)
%6 = call i32 @syscall_printString(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%7 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%8 = call i32 @syscall_printString(i8* %7)
%9 = call i32 @syscall_printString(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 @syscall_printString(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0))
%11 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
%12 = call i32 @syscall_readSector(i8* %11, i32 30)
%13 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
%14 = call i32 @syscall_printString(i8* %13)
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"Enter a line: \00"
@.str.1 = [3 x i8] c"\0D\0A\00"
@.str.2 = [32 x i8] c"Reading sector 30 from floppy\0D\0A\00"
define void @main() {
%1 = alloca [80 x i8]
%2 = alloca [512 x i8]
%3 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
%5 = tail call i32 @syscall_printString(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @syscall_readString(i8* %3)
%7 = call i32 @syscall_printString(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @syscall_printString(i8* %3)
%9 = call i32 @syscall_printString(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 @syscall_printString(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0))
%11 = call i32 @syscall_readSector(i8* %4, i32 30)
%12 = call i32 @syscall_printString(i8* %4)
ret void
}