#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*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ strcpy(char *, char *);
int main(void) {
  char string_1[20] = {'\0'};
  char string_2[20] = {'\0'};
  int offset = 2;
  printf("You want to say:");
  fgets(string_1, 20, stdin);
  strcpy(string_2, string_1 + offset);
  printf("\nI understood: %s", string_2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x20(%rbp),%rdi
xor    %esi,%esi
mov    $0x14,%edx
call   1050 <memset@plt>
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x14,%edx
call   1050 <memset@plt>
movl   $0x2,-0x44(%rbp)
lea    0xe83(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x20(%rbp),%rdi
mov    0x2e59(%rip),%rax
mov    (%rax),%edx
mov    $0x14,%esi
call   1060 <fgets@plt>
lea    -0x40(%rbp),%rdi
lea    -0x20(%rbp),%rsi
movslq -0x44(%rbp),%rax
add    %rax,%rsi
call   1030 <strcpy@plt>
lea    -0x40(%rbp),%rsi
lea    0xe57(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x40,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,(%rsp)
movl   $0x0,0x10(%rsp)
movaps %xmm0,0x20(%rsp)
movl   $0x0,0x30(%rsp)
lea    0xea8(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x2e82(%rip),%rax
mov    (%rax),%edx
mov    %rsp,%rdi
mov    $0x14,%esi
call   1050 <fgets@plt>
lea    0x2(%rsp),%rsi
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <strcpy@plt>
lea    0xe83(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [17 x i8] c"You want to say:\00"
@stdin = global i32 0
@.str.1 = [18 x i8] c"\0AI understood: %s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [20 x i8]
%3 = alloca [20 x i8]
%4 = alloca i32
store i32 0, i32* %1
%5 = bitcast [20 x i8]* %2 to i8*
%6 = bitcast [20 x i8]* %3 to i8*
store i32 2, i32* %4
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%8 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%9 = load i32, i32* @stdin
%10 = call i32 @fgets(i8* %8, i32 20, i32 %9)
%11 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%12 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%13 = load i32, i32* %4
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8, i8* %12, i64 %14
%16 = call i32 @strcpy(i8* %11, i8* %15)
%17 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* %17)
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"You want to say:\00"
@stdin = global i32 0
@.str.1 = [18 x i8] c"\0AI understood: %s\00"
define i32 @main() {
%1 = alloca [20 x i8]
%2 = alloca [20 x i8]
%3 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%6 = load i32, i32* @stdin
%7 = call i32 @fgets(i8* %3, i32 20, i32 %6)
%8 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 2
%9 = call i32 @strcpy(i8* %4, i8* %8)
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* %4)
ret i32 0
}