#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*/ errx(int, char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ strcpy(char *, char *);
int main(int argc, char **argv) {
  volatile int modified;
  char buffer[64];
  if (argc == 1) {
    errx(1, "please specify an argument\n");
  }
  modified = 0;
  strcpy(buffer, argv[1]);
  if (modified == 0x61626364) {
    printf("you have correctly got the variable to the right value\n");
  } else {
    printf("Try again, you got 0x%08x\n", modified);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    1161 <main+0x31>
mov    $0x1,%edi
lea    0xea4(%rip),%rsi
call   1040 <errx@plt>
movl   $0x0,-0x14(%rbp)
lea    -0x60(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
call   1030 <strcpy@plt>
mov    -0x14(%rbp),%eax
cmp    $0x61626364,%eax
jne    119a <main+0x6a>
lea    0xe8e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    11ab <main+0x7b>
mov    -0x14(%rbp),%esi
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x50,%rsp
mov    %rsi,%rbx
cmp    $0x1,%edi
jne    115e <main+0x1e>
lea    0xeac(%rip),%rsi
mov    $0x1,%edi
call   1050 <errx@plt>
movl   $0x0,0xc(%rsp)
mov    0x8(%rbx),%rsi
lea    0x10(%rsp),%rdi
call   1030 <strcpy@plt>
mov    0xc(%rsp),%eax
cmp    $0x61626364,%eax
jne    118d <main+0x4d>
lea    0xeb1(%rip),%rdi
call   1040 <puts@plt>
jmp    119f <main+0x5f>
mov    0xc(%rsp),%esi
lea    0xe84(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [28 x i8] c"please specify an argument\0A\00"
@.str.1 = [56 x i8] c"you have correctly got the variable to the right value\0A\00"
@.str.2 = [27 x i8] c"Try again, you got 0x%08x\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca [64 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = icmp eq i32 %8, 1
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = call i32 @errx(i32 1, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
br label %12
12: ; preds = %10, %2
store volatile i32 0, i32* %6
%13 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 0
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = call i32 @strcpy(i8* %13, i8* %16)
%18 = load volatile i32, i32* %6
%19 = icmp eq i32 %18, 1633837924
br i1 %19, label %20, label %22
20: ; preds = %12
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.1, i64 0, i64 0))
br label %25
22: ; preds = %12
%23 = load volatile i32, i32* %6
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i32 %23)
br label %25
25: ; preds = %22, %20
%26 = load i32, i32* %3
ret i32 %26
}

LLVM IR (-O2):
@.str = [28 x i8] c"please specify an argument\0A\00"
@.str.2 = [27 x i8] c"Try again, you got 0x%08x\0A\00"
@str = [55 x i8] c"you have correctly got the variable to the right value\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca [64 x i8]
%5 = bitcast i32* %3 to i8*
%6 = getelementptr inbounds [64 x i8], [64 x i8]* %4, i64 0, i64 0
%7 = icmp eq i32 %0, 1
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = tail call i32 @errx(i32 1, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %8, %2
store volatile i32 0, i32* %3
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = call i32 @strcpy(i8* %6, i8* %12)
%14 = load volatile i32, i32* %3
%15 = icmp eq i32 %14, 1633837924
br i1 %15, label %16, label %18
16: ; preds = %10
%17 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @str, i64 0, i64 0))
br label %21
18: ; preds = %10
%19 = load volatile i32, i32* %3
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i32 %19)
br label %21
21: ; preds = %18, %16
ret i32 0
}