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 decimal integer\n");
  scanf("%d", &int_input);
  printf("Please enter a string\n");
  scanf("%99s", user_input);
  printf("%s", 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    0xee1(%rip),%rdi
lea    -0x8c(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@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),%rsi
lea    0xec7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xdf8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeae(%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    0xea7(%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,(%rsp)
movabs $0x5500000044,%rcx
mov    %rcx,(%rax)
lea    0xe86(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    (%rsp),%rsi
lea    0xea4(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    (%rsp),%rsi
lea    0xec2(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    (%rsp),%rsi
add    $0x4,%rsi
lea    0xed4(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xf41(%rip),%rdi
call   1040 <puts@plt>
lea    0xee2(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
lea    0xf41(%rip),%rdi
call   1040 <puts@plt>
lea    0xec6(%rip),%rdi
lea    0x10(%rsp),%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
lea    0xeb5(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe9d(%rip),%rdi
mov    $0x44,%esi
mov    $0x55,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    (%rsp),%rax
mov    (%rax),%esi
mov    0x4(%rax),%edx
lea    0xea0(%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 = [32 x i8] c"Please enter a decimal integer\0A\00"
@.str.5 = [3 x i8] c"%d\00"
@.str.6 = [23 x i8] c"Please enter a string\0A\00"
@.str.7 = [5 x i8] c"%99s\00"
@.str.8 = [3 x i8] c"%s\00"
@.str.9 = [2 x i8] c"\0A\00"
@.str.10 = [36 x i8] c"The original secrets: 0x%x -- 0x%x\0A\00"
@.str.11 = [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 ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0))
%32 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %8)
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0))
%34 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%35 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i8* %34)
%36 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i8* %36)
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.10, i64 0, i64 0), i32 68, i32 85)
%40 = load i32*, i32** %7
%41 = getelementptr inbounds i32, i32* %40, i64 0
%42 = load i32, i32* %41
%43 = load i32*, i32** %7
%44 = getelementptr inbounds i32, i32* %43, i64 1
%45 = load i32, i32* %44
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.11, i64 0, i64 0), i32 %42, i32 %45)
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"%d\00"
@.str.7 = [5 x i8] c"%99s\00"
@.str.8 = [3 x i8] c"%s\00"
@.str.10 = [36 x i8] c"The original secrets: 0x%x -- 0x%x\0A\00"
@.str.11 = [36 x i8] c"The new secrets: 0x%x -- 0x%x\0A\00"
@str = [31 x i8] c"Please enter a decimal integer\00"
@str.12 = [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 = alloca i32
%6 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%7 = bitcast i32** %4 to i8*
%8 = bitcast i32* %5 to i8*
%9 = tail call dereferenceable_or_null(8) i8* @malloc(i64 8)
%10 = bitcast i8* %9 to i32*
%11 = bitcast i32** %4 to i8**
store i8* %9, i8** %11
store i32 68, i32* %10
%12 = getelementptr inbounds i32, i32* %10, i64 1
store i32 85, i32* %12
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0), i32** %4)
%14 = load i32*, i32** %4
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str.1, i64 0, i64 0), i32* %14)
%16 = load i32*, i32** %4
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0), i32* %16)
%18 = load i32*, i32** %4
%19 = getelementptr inbounds i32, i32* %18, i64 1
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.3, i64 0, i64 0), i32* %19)
%21 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str, i64 0, i64 0))
%22 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %5)
%23 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.12, i64 0, i64 0))
%24 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i8* %6)
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i8* %6)
%26 = call i32 @putchar(i32 10)
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.10, i64 0, i64 0), i32 68, i32 85)
%28 = load i32*, i32** %4
%29 = load i32, i32* %28
%30 = getelementptr inbounds i32, i32* %28, i64 1
%31 = load i32, i32* %30
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.11, i64 0, i64 0), i32 %29, i32 %31)
ret i32 0
}