#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 */
unsigned short peek(int);
char peek_far_b(unsigned short, unsigned short);
int /*<<< orphan*/ putch(char);
int /*<<< orphan*/ puts0(char *);
void main(void) {
  char c;
  short int i;
  unsigned short int arg_off, arg_seg;
  arg_off = peek(6);
  arg_seg = peek(8);
  putch('\'');
  while (1) {
    c = peek_far_b(arg_seg, arg_off);
    if (c == 0)
      break;
    putch(c);
    arg_off++;
  }
  putch('\'');
  puts0("\r\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x6,%edi
call   1040 <peek@plt>
mov    %ax,-0x6(%rbp)
mov    $0x8,%edi
call   1040 <peek@plt>
mov    %ax,-0x8(%rbp)
mov    $0x27,%edi
call   1060 <putch@plt>
mov    -0x8(%rbp),%ax
movzwl %ax,%edi
movzwl -0x6(%rbp),%esi
call   1030 <peek_far_b@plt>
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x0,%eax
jne    1193 <main+0x53>
jmp    11ad <main+0x6d>
movsbl -0x1(%rbp),%edi
call   1060 <putch@plt>
mov    -0x6(%rbp),%ax
add    $0x1,%ax
mov    %ax,-0x6(%rbp)
jmp    116e <main+0x2e>
mov    $0x27,%edi
call   1060 <putch@plt>
lea    0xe42(%rip),%rdi
call   1050 <puts0@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    $0x6,%edi
call   1040 <peek@plt>
mov    %eax,%ebx
mov    $0x8,%edi
call   1040 <peek@plt>
mov    %eax,%ebp
mov    $0x27,%edi
call   1060 <putch@plt>
movzwl %bx,%esi
movzwl %bp,%ebp
mov    %ebp,%edi
call   1030 <peek_far_b@plt>
test   %al,%al
je     119b <main+0x5b>
add    $0x1,%ebx
nopl   0x0(%rax)
movsbl %al,%edi
call   1060 <putch@plt>
movzwl %bx,%ebx
mov    %ebp,%edi
mov    %ebx,%esi
call   1030 <peek_far_b@plt>
add    $0x1,%ebx
test   %al,%al
jne    1180 <main+0x40>
mov    $0x27,%edi
call   1060 <putch@plt>
lea    0xe54(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1050 <puts0@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"\0D\0A\00"
define void @main() {
%1 = alloca i8
%2 = alloca i16
%3 = alloca i16
%4 = alloca i16
%5 = call zeroext i16 @peek(i32 6)
store i16 %5, i16* %3
%6 = call zeroext i16 @peek(i32 8)
store i16 %6, i16* %4
%7 = call i32 @putch(i8 signext 39)
br label %8
8: ; preds = %0, %16
%9 = load i16, i16* %4
%10 = load i16, i16* %3
%11 = call signext i8 @peek_far_b(i16 zeroext %9, i16 zeroext %10)
store i8 %11, i8* %1
%12 = load i8, i8* %1
%13 = sext i8 %12 to i32
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %8
br label %21
16: ; preds = %8
%17 = load i8, i8* %1
%18 = call i32 @putch(i8 signext %17)
%19 = load i16, i16* %3
%20 = add i16 %19, 1
store i16 %20, i16* %3
br label %8
21: ; preds = %15
%22 = call i32 @putch(i8 signext 39)
%23 = call i32 @puts0(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"\0D\0A\00"
define void @main() {
%1 = tail call zeroext i16 @peek(i32 6)
%2 = tail call zeroext i16 @peek(i32 8)
%3 = tail call i32 @putch(i8 signext 39)
%4 = tail call signext i8 @peek_far_b(i16 zeroext %2, i16 zeroext %1)
%5 = icmp eq i8 %4, 0
br i1 %5, label %13, label %6
6: ; preds = %0, %6
%7 = phi i8 [ %11, %6 ], [ %4, %0 ]
%8 = phi i16 [ %10, %6 ], [ %1, %0 ]
%9 = tail call i32 @putch(i8 signext %7)
%10 = add i16 %8, 1
%11 = tail call signext i8 @peek_far_b(i16 zeroext %2, i16 zeroext %10)
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %6
13: ; preds = %6, %0
%14 = tail call i32 @putch(i8 signext 39)
%15 = tail call i32 @puts0(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
ret void
}