#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*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char *);
int strlen(char *);
int main() {
  char s1[80], s2[80];
  int i;
  printf("input s2:");
  scanf("%s", s2);
  for (i = 0; i <= strlen(s2); i++)
    s1[i] = s2[i];
  printf("s1:%s\n", s1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeb7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0xb0(%rbp),%rsi
lea    0xeac(%rip),%rdi
call   1050 <scanf@plt>
movl   $0x0,-0xb4(%rbp)
mov    -0xb4(%rbp),%eax
mov    %eax,-0xb8(%rbp)
lea    -0xb0(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0xb8(%rbp),%eax
cmp    %ecx,%eax
jg     11c2 <main+0x92>
movslq -0xb4(%rbp),%rax
mov    -0xb0(%rbp,%rax,1),%cl
movslq -0xb4(%rbp),%rax
mov    %cl,-0x60(%rbp,%rax,1)
mov    -0xb4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb4(%rbp)
jmp    116d <main+0x3d>
lea    -0x60(%rbp),%rsi
lea    0xe40(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0xa8,%rsp
lea    0xebf(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xebb(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1050 <scanf@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
test   %eax,%eax
js     118c <main+0x5c>
mov    $0xffffffffffffffff,%rbx
mov    %rsp,%r14
movzbl 0x1(%rsp,%rbx,1),%eax
mov    %al,0x51(%rsp,%rbx,1)
mov    %r14,%rdi
call   1030 <strlen@plt>
cltq
add    $0x1,%rbx
cmp    %rax,%rbx
jl     1170 <main+0x40>
lea    0xe7a(%rip),%rdi
lea    0x50(%rsp),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0xa8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [10 x i8] c"input s2:\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [7 x i8] c"s1:%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [80 x i8]
%3 = alloca [80 x i8]
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %6)
store i32 0, i32* %4
br label %8
8: ; preds = %21, %0
%9 = load i32, i32* %4
%10 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%11 = call i32 @strlen(i8* %10)
%12 = icmp sle i32 %9, %11
br i1 %12, label %13, label %24
13: ; preds = %8
%14 = load i32, i32* %4
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 %15
%17 = load i8, i8* %16
%18 = load i32, i32* %4
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 %19
store i8 %17, i8* %20
br label %21
21: ; preds = %13
%22 = load i32, i32* %4
%23 = add nsw i32 %22, 1
store i32 %23, i32* %4
br label %8
24: ; preds = %8
%25 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* %25)
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c"input s2:\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [7 x i8] c"s1:%s\0A\00"
define i32 @main() {
%1 = alloca [80 x i8]
%2 = alloca [80 x i8]
%3 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%7 = call i32 @strlen(i8* %4)
%8 = icmp slt i32 %7, 0
br i1 %8, label %18, label %9
9: ; preds = %0, %9
%10 = phi i64 [ %14, %9 ], [ 0, %0 ]
%11 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 %10
%12 = load i8, i8* %11
%13 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 %10
store i8 %12, i8* %13
%14 = add nuw nsw i64 %10, 1
%15 = call i32 @strlen(i8* %4)
%16 = sext i32 %15 to i64
%17 = icmp slt i64 %10, %16
br i1 %17, label %9, label %18
18: ; preds = %9, %0
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* %3)
ret i32 0
}