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

/* Variables and functions */
int /*<<< orphan*/ fread_unlocked(int *, int, int, int /*<<< orphan*/);
int /*<<< orphan*/ getchar_unlocked();
int /*<<< orphan*/ put_string_char(int /*<<< orphan*/);
int /*<<< orphan*/ putchar_unlocked(char);
int /*<<< orphan*/ readchar();
int /*<<< orphan*/ stdin;
void transform_string(void) {
  putchar_unlocked('"');
  int string_count;
  fread_unlocked(&string_count, sizeof(string_count), 1, stdin);
  for (int i = 0; i < string_count - 1; i++) {
    put_string_char(readchar());
  }
  getchar_unlocked();
  putchar_unlocked('"');
}


x86 assembly (clang, -O0):
<transform_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x22,%edi
call   1060 <putchar_unlocked@plt>
mov    0x2e7f(%rip),%rax
mov    (%rax),%ecx
lea    -0x4(%rbp),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
call   1050 <fread_unlocked@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    11b2 <transform_string+0x62>
mov    $0x0,%al
call   1030 <readchar@plt>
mov    %eax,%edi
call   1070 <put_string_char@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1185 <transform_string+0x35>
mov    $0x0,%al
call   1040 <getchar_unlocked@plt>
mov    $0x22,%edi
call   1060 <putchar_unlocked@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<transform_string>:
push   %rbx
sub    $0x10,%rsp
mov    $0x22,%edi
call   1060 <putchar_unlocked@plt>
mov    0x2e82(%rip),%rax
mov    (%rax),%ecx
lea    0xc(%rsp),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
call   1050 <fread_unlocked@plt>
cmpl   $0x2,0xc(%rsp)
jl     11ac <transform_string+0x5c>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
xor    %eax,%eax
call   1030 <readchar@plt>
mov    %eax,%edi
call   1070 <put_string_char@plt>
add    $0x1,%ebx
mov    0xc(%rsp),%eax
add    $0xffffffff,%eax
cmp    %eax,%ebx
jl     1190 <transform_string+0x40>
xor    %eax,%eax
call   1040 <getchar_unlocked@plt>
mov    $0x22,%edi
call   1060 <putchar_unlocked@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@stdin = global i32 0
define void @transform_string() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 @putchar_unlocked(i8 signext 34)
%4 = load i32, i32* @stdin
%5 = call i32 @fread_unlocked(i32* %1, i32 4, i32 1, i32 %4)
store i32 0, i32* %2
br label %6
6: ; preds = %14, %0
%7 = load i32, i32* %2
%8 = load i32, i32* %1
%9 = sub nsw i32 %8, 1
%10 = icmp slt i32 %7, %9
br i1 %10, label %11, label %17
11: ; preds = %6
%12 = call i32 (...) @readchar()
%13 = call i32 @put_string_char(i32 %12)
br label %14
14: ; preds = %11
%15 = load i32, i32* %2
%16 = add nsw i32 %15, 1
store i32 %16, i32* %2
br label %6
17: ; preds = %6
%18 = call i32 (...) @getchar_unlocked()
%19 = call i32 @putchar_unlocked(i8 signext 34)
ret void
}

LLVM IR (-O2):
@stdin = global i32 0
define void @transform_string() {
%1 = alloca i32
%2 = tail call i32 @putchar_unlocked(i8 signext 34)
%3 = bitcast i32* %1 to i8*
%4 = load i32, i32* @stdin
%5 = call i32 @fread_unlocked(i32* %1, i32 4, i32 1, i32 %4)
%6 = load i32, i32* %1
%7 = icmp sgt i32 %6, 1
br i1 %7, label %11, label %8
8: ; preds = %11, %0
%9 = call i32 (...) @getchar_unlocked()
%10 = call i32 @putchar_unlocked(i8 signext 34)
ret void
11: ; preds = %0, %11
%12 = phi i32 [ %15, %11 ], [ 0, %0 ]
%13 = call i32 (...) @readchar()
%14 = call i32 @put_string_char(i32 %13)
%15 = add nuw nsw i32 %12, 1
%16 = load i32, i32* %1
%17 = add nsw i32 %16, -1
%18 = icmp slt i32 %15, %17
br i1 %18, label %11, label %8
}