#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*/ gets(char *);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  char yours[25];
  char mine[25];
  char x;
  printf("What is your name? ");
  gets(yours);
  while (mine[x] = yours[x])
    x++;
  printf("My name is %s, just like your name is %s\n\n\n", mine, yours);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x20(%rbp),%rdi
call   1040 <gets@plt>
movsbq -0x41(%rbp),%rax
mov    -0x20(%rbp,%rax,1),%al
movsbq -0x41(%rbp),%rcx
mov    %al,-0x40(%rbp,%rcx,1)
cmp    $0x0,%al
je     116d <main+0x4d>
mov    -0x41(%rbp),%al
add    $0x1,%al
mov    %al,-0x41(%rbp)
jmp    1146 <main+0x26>
lea    -0x40(%rbp),%rsi
lea    -0x20(%rbp),%rdx
lea    0xe98(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x48,%rsp
lea    0xed5(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rsp,%rdi
call   1040 <gets@plt>
nopw   0x0(%rax,%rax,1)
movsbq %al,%rax
movzbl (%rsp,%rax,1),%ecx
mov    %cl,0x20(%rsp,%rax,1)
add    $0x1,%al
test   %cl,%cl
jne    1140 <main+0x20>
lea    0xebb(%rip),%rdi
lea    0x20(%rsp),%rsi
mov    %rsp,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x48,%rsp
ret

LLVM IR (-O0):
@.str = [20 x i8] c"What is your name? \00"
@.str.1 = [44 x i8] c"My name is %s, just like your name is %s\0A\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [25 x i8]
%3 = alloca [25 x i8]
%4 = alloca i8
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds [25 x i8], [25 x i8]* %2, i64 0, i64 0
%7 = call i32 @gets(i8* %6)
br label %8
8: ; preds = %17, %0
%9 = load i8, i8* %4
%10 = sext i8 %9 to i64
%11 = getelementptr inbounds [25 x i8], [25 x i8]* %2, i64 0, i64 %10
%12 = load i8, i8* %11
%13 = load i8, i8* %4
%14 = sext i8 %13 to i64
%15 = getelementptr inbounds [25 x i8], [25 x i8]* %3, i64 0, i64 %14
store i8 %12, i8* %15
%16 = icmp ne i8 %12, 0
br i1 %16, label %17, label %20
17: ; preds = %8
%18 = load i8, i8* %4
%19 = add i8 %18, 1
store i8 %19, i8* %4
br label %8
20: ; preds = %8
%21 = getelementptr inbounds [25 x i8], [25 x i8]* %3, i64 0, i64 0
%22 = getelementptr inbounds [25 x i8], [25 x i8]* %2, i64 0, i64 0
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0), i8* %21, i8* %22)
ret i32 0
}

LLVM IR (-O2):
@.str = [20 x i8] c"What is your name? \00"
@.str.1 = [44 x i8] c"My name is %s, just like your name is %s\0A\0A\0A\00"
define i32 @main() {
%1 = alloca [25 x i8]
%2 = alloca [25 x i8]
%3 = getelementptr inbounds [25 x i8], [25 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [25 x i8], [25 x i8]* %2, i64 0, i64 0
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @gets(i8* %3)
br label %7
7: ; preds = %7, %0
%8 = phi i8 [ undef, %0 ], [ %14, %7 ]
%9 = sext i8 %8 to i64
%10 = getelementptr inbounds [25 x i8], [25 x i8]* %1, i64 0, i64 %9
%11 = load i8, i8* %10
%12 = getelementptr inbounds [25 x i8], [25 x i8]* %2, i64 0, i64 %9
store i8 %11, i8* %12
%13 = icmp eq i8 %11, 0
%14 = add i8 %8, 1
br i1 %13, label %15, label %7
15: ; preds = %7
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0), i8* %4, i8* %3)
ret i32 0
}