#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*/ abort();
int /*<<< orphan*/ printf(char *, char *);
char *stpcpy(char *, char *);
size_t strlen(char *);
int main(int argc, char *argv[]) {
  char b[10];
  char *q = stpcpy(b, argv[1]);
  if ((size_t)(q - b) != strlen(argv[1]))
    abort();
  (void)printf("%s\n", b);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x1a(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
call   1040 <stpcpy@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
lea    -0x1a(%rbp),%rcx
sub    %rcx,%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <strlen@plt>
mov    %rax,%rcx
mov    -0x30(%rbp),%rax
cmp    %rcx,%rax
je     119e <main+0x5e>
mov    $0x0,%al
call   1030 <abort@plt>
lea    -0x1a(%rbp),%rsi
lea    0xe57(%rip),%rdi
call   1060 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    0x8(%rsi),%r15
lea    0x6(%rsp),%r14
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <stpcpy@plt>
mov    %rax,%rbx
sub    %r14,%rbx
mov    %r15,%rdi
call   1050 <strlen@plt>
cmp    %rax,%rbx
jne    118d <main+0x4d>
lea    0xe89(%rip),%rdi
lea    0x6(%rsp),%rsi
call   1060 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret
xor    %eax,%eax
call   1030 <abort@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [10 x i8]
%4 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = call i8* @stpcpy(i8* %4, i8* %6)
%8 = ptrtoint i8* %7 to i64
%9 = ptrtoint [10 x i8]* %3 to i64
%10 = sub i64 %8, %9
%11 = call i64 @strlen(i8* dereferenceable(1) %6)
%12 = icmp eq i64 %10, %11
br i1 %12, label %15, label %13
13: ; preds = %2
%14 = call i32 (...) @abort()
unreachable
15: ; preds = %2
%16 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %4)
ret i32 0
}