int main(int argc, char *argv[]) {
  char user_input[100];
  int *secret;
  int int_input;
  int a, b, c, d;
  a = (int *)malloc(16 * sizeof(int));
  secret = (int *)malloc(2 * sizeof(int));
  secret[0] = 0x44;
  secret[1] = 0x55;
  printf("The variable secret's address is 0x%8x (on stack)\n", &secret);
  printf("The variable secret's value is 0x%8x (on heap)\n", secret);
  printf("secret[0]'s address is 0x%8x (on heap)\n", &secret[0]);
  printf("secret[1]'s address is 0x%8x (on heap)\n", &secret[1]);
  printf("Please enter a string\n");
  scanf("%s", user_input);
  printf(user_input);
  printf("\n");
  printf("The original secrets: 0x%x -- 0x%x\n", 0x44, 0x55);
  printf("The new secrets:      0x%x -- 0x%x\n", secret[0], secret[1]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x40,%edi
call   1040 <malloc@plt>
mov    %eax,-0x90(%rbp)
mov    $0x8,%edi
call   1040 <malloc@plt>
mov    %rax,-0x88(%rbp)
mov    -0x88(%rbp),%rax
movl   $0x44,(%rax)
mov    -0x88(%rbp),%rax
movl   $0x55,0x4(%rax)
lea    0xe74(%rip),%rdi
lea    -0x88(%rbp),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x88(%rbp),%rsi
lea    0xe8b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x88(%rbp),%rsi
lea    0xea6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x88(%rbp),%rsi
add    $0x4,%rsi
lea    0xeb5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xecf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x80(%rbp),%rsi
lea    0xed4(%rip),%rdi
mov    $0x0,%al
call   1050 <scanf@plt>
lea    -0x80(%rbp),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe22(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb0(%rip),%rdi
mov    $0x44,%esi
mov    $0x55,%edx
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x88(%rbp),%rax
mov    (%rax),%esi
mov    -0x88(%rbp),%rax
mov    0x4(%rax),%edx
lea    0xea9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x80,%rsp
mov    $0x8,%edi
call   1060 <malloc@plt>
mov    %rax,0x8(%rsp)
movabs $0x5500000044,%rcx
mov    %rcx,(%rax)
lea    0xe85(%rip),%rdi
lea    0x8(%rsp),%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x8(%rsp),%rsi
lea    0xea0(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x8(%rsp),%rsi
lea    0xebd(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x8(%rsp),%rsi
add    $0x4,%rsi
lea    0xece(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xf33(%rip),%rdi
call   1040 <puts@plt>
lea    0xedc(%rip),%rdi
lea    0x10(%rsp),%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xeb5(%rip),%rdi
mov    $0x44,%esi
mov    $0x55,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x8(%rsp),%rax
mov    (%rax),%esi
mov    0x4(%rax),%edx
lea    0xeb7(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [51 x i8] c"The variable secret's address is 0x%8x (on stack)\0A\00"
@.str.1 = [48 x i8] c"The variable secret's value is 0x%8x (on heap)\0A\00"
@.str.2 = [40 x i8] c"secret[0]'s address is 0x%8x (on heap)\0A\00"
@.str.3 = [40 x i8] c"secret[1]'s address is 0x%8x (on heap)\0A\00"
@.str.4 = [23 x i8] c"Please enter a string\0A\00"
@.str.5 = [3 x i8] c"%s\00"
@.str.6 = [2 x i8] c"\0A\00"
@.str.7 = [36 x i8] c"The original secrets: 0x%x -- 0x%x\0A\00"
@.str.8 = [36 x i8] c"The new secrets: 0x%x -- 0x%x\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [100 x i8]
%7 = alloca i32*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%13 = call i8* @malloc(i64 64)
%14 = bitcast i8* %13 to i32*
%15 = ptrtoint i32* %14 to i32
store i32 %15, i32* %9
%16 = call i8* @malloc(i64 8)
%17 = bitcast i8* %16 to i32*
store i32* %17, i32** %7
%18 = load i32*, i32** %7
%19 = getelementptr inbounds i32, i32* %18, i64 0
store i32 68, i32* %19
%20 = load i32*, i32** %7
%21 = getelementptr inbounds i32, i32* %20, i64 1
store i32 85, i32* %21
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0), i32** %7)
%23 = load i32*, i32** %7
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.1, i64 0, i64 0), i32* %23)
%25 = load i32*, i32** %7
%26 = getelementptr inbounds i32, i32* %25, i64 0
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0), i32* %26)
%28 = load i32*, i32** %7
%29 = getelementptr inbounds i32, i32* %28, i64 1
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.3, i64 0, i64 0), i32* %29)
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0))
%32 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%33 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %32)
%34 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%35 = call i32 (i8*, ...) @printf(i8* %34)
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.7, i64 0, i64 0), i32 68, i32 85)
%38 = load i32*, i32** %7
%39 = getelementptr inbounds i32, i32* %38, i64 0
%40 = load i32, i32* %39
%41 = load i32*, i32** %7
%42 = getelementptr inbounds i32, i32* %41, i64 1
%43 = load i32, i32* %42
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.8, i64 0, i64 0), i32 %40, i32 %43)
ret i32 0
}

LLVM IR (-O2):
@.str = [51 x i8] c"The variable secret's address is 0x%8x (on stack)\0A\00"
@.str.1 = [48 x i8] c"The variable secret's value is 0x%8x (on heap)\0A\00"
@.str.2 = [40 x i8] c"secret[0]'s address is 0x%8x (on heap)\0A\00"
@.str.3 = [40 x i8] c"secret[1]'s address is 0x%8x (on heap)\0A\00"
@.str.5 = [3 x i8] c"%s\00"
@.str.7 = [36 x i8] c"The original secrets: 0x%x -- 0x%x\0A\00"
@.str.8 = [36 x i8] c"The new secrets: 0x%x -- 0x%x\0A\00"
@str = [22 x i8] c"Please enter a string\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [100 x i8]
%4 = alloca i32*
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%6 = bitcast i32** %4 to i8*
%7 = tail call dereferenceable_or_null(8) i8* @malloc(i64 8)
%8 = bitcast i8* %7 to i32*
%9 = bitcast i32** %4 to i8**
store i8* %7, i8** %9
store i32 68, i32* %8
%10 = getelementptr inbounds i32, i32* %8, i64 1
store i32 85, i32* %10
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0), i32** %4)
%12 = load i32*, i32** %4
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str.1, i64 0, i64 0), i32* %12)
%14 = load i32*, i32** %4
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0), i32* %14)
%16 = load i32*, i32** %4
%17 = getelementptr inbounds i32, i32* %16, i64 1
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.3, i64 0, i64 0), i32* %17)
%19 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
%20 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %5)
%21 = call i32 (i8*, ...) @printf(i8* %5)
%22 = call i32 @putchar(i32 10)
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.7, i64 0, i64 0), i32 68, i32 85)
%24 = load i32*, i32** %4
%25 = load i32, i32* %24
%26 = getelementptr inbounds i32, i32* %24, i64 1
%27 = load i32, i32* %26
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.8, i64 0, i64 0), i32 %25, i32 %27)
ret i32 0
}