#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*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  int test = 0;
  int *p = &test;
  printf("the address of test is: %p\nthe value of test pointer is: %d\n\n",
         (void *)&test, *p);
  char *address_p = (void *)&test;
  printf("setting test = 1\n\n");
  test = 1;
  printf("the address of test is: %p\nthe value of test pointer is: %d\n\n\n",
         (void *)&test, *p);
  int *data;
  printf("sizeof(int) == 4 -> %d\n", (sizeof(int) == 4));
  printf("sizeof(int) -> %ld\n\n", sizeof(int));
  printf("data address: L%p\n\n", (void *)&data);
  int val2 = 1;
  int val3 = 2;
  int val4 = 128;
  int *p2 = &val2;
  int *p3 = &val3;
  int *p4 = &val4;
  unsigned char *bytep1 = (unsigned char *)p;
  unsigned char *bytep2 = (unsigned char *)p2;
  unsigned char *bytep3 = (unsigned char *)p3;
  unsigned char *bytep4 = (unsigned char *)p4;
  for (int i = 0; i < 32; i++) {
    printf("bytep1[%d]: %d\tbytep2[%d]: %d\tbytep3[%d]: %d\tbytep4[%d]: %d\n",
           i, bytep1[i], i, bytep2[i], i, bytep3[i], i, bytep4[i]);
    if (bytep1[i] == 255) {
      printf(" <-- found 255!!! ");
    }
  }
  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)
movl   $0x0,-0x14(%rbp)
lea    -0x14(%rbp),%rax
mov    %rax,-0x20(%rbp)
lea    -0x14(%rbp),%rsi
mov    -0x20(%rbp),%rax
mov    (%rax),%edx
lea    0xeb7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x14(%rbp),%rax
mov    %rax,-0x28(%rbp)
lea    0xedf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x14(%rbp)
lea    -0x14(%rbp),%rsi
mov    -0x20(%rbp),%rax
mov    (%rax),%edx
lea    0xed3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf04(%rip),%rdi
mov    $0x1,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf09(%rip),%rdi
mov    $0x4,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x30(%rbp),%rsi
lea    0xf07(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x34(%rbp)
movl   $0x2,-0x38(%rbp)
movl   $0x80,-0x3c(%rbp)
lea    -0x34(%rbp),%rax
mov    %rax,-0x48(%rbp)
lea    -0x38(%rbp),%rax
mov    %rax,-0x50(%rbp)
lea    -0x3c(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x60(%rbp)
mov    -0x48(%rbp),%rax
mov    %rax,-0x68(%rbp)
mov    -0x50(%rbp),%rax
mov    %rax,-0x70(%rbp)
mov    -0x58(%rbp),%rax
mov    %rax,-0x78(%rbp)
movl   $0x0,-0x7c(%rbp)
cmpl   $0x20,-0x7c(%rbp)
jge    12ae <main+0x19e>
mov    -0x7c(%rbp),%esi
mov    -0x60(%rbp),%rax
movslq -0x7c(%rbp),%rcx
movzbl (%rax,%rcx,1),%edx
mov    -0x7c(%rbp),%ecx
mov    -0x68(%rbp),%rax
movslq -0x7c(%rbp),%rdi
movzbl (%rax,%rdi,1),%r8d
mov    -0x7c(%rbp),%r9d
mov    -0x70(%rbp),%rax
movslq -0x7c(%rbp),%rdi
movzbl (%rax,%rdi,1),%r11d
mov    -0x7c(%rbp),%r10d
mov    -0x78(%rbp),%rax
movslq -0x7c(%rbp),%rdi
movzbl (%rax,%rdi,1),%eax
lea    0xe6f(%rip),%rdi
mov    %r11d,(%rsp)
mov    %r10d,0x8(%rsp)
mov    %eax,0x10(%rsp)
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x60(%rbp),%rax
movslq -0x7c(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
cmp    $0xff,%eax
jne    129b <main+0x18b>
lea    0xe7a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12a0 <main+0x190>
mov    -0x7c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7c(%rbp)
jmp    1211 <main+0x101>
xor    %eax,%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
movl   $0x0,0x8(%rsp)
lea    0xec8(%rip),%rdi
lea    0x8(%rsp),%rbx
mov    %rbx,%rsi
xor    %edx,%edx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xfbe(%rip),%rdi
call   1030 <puts@plt>
movl   $0x1,0x8(%rsp)
lea    0xeda(%rip),%rdi
mov    %rbx,%rsi
mov    $0x1,%edx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xf03(%rip),%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xf08(%rip),%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xf0a(%rip),%rdi
lea    0x18(%rsp),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
movl   $0x1,0x14(%rsp)
movl   $0x2,0x10(%rsp)
movl   $0x80,0xc(%rsp)
mov    $0x1,%sil
mov    $0x2,%cl
mov    $0x80,%al
lea    0xeec(%rip),%r15
lea    0xf22(%rip),%r14
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
movzbl 0x8(%rsp,%rbx,1),%edx
movzbl %sil,%r8d
movzbl %cl,%r10d
movzbl %al,%r11d
sub    $0x8,%rsp
mov    %r15,%rdi
mov    %ebx,%esi
mov    %ebx,%ecx
mov    %ebx,%r9d
xor    %eax,%eax
push   %r11
push   %rbx
push   %r10
call   1040 <printf@plt>
add    $0x20,%rsp
cmpb   $0xff,0x8(%rsp,%rbx,1)
jne    1220 <main+0x100>
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    $0x1f,%rbx
je     123b <main+0x11b>
movzbl 0x15(%rsp,%rbx,1),%esi
movzbl 0x11(%rsp,%rbx,1),%ecx
movzbl 0xd(%rsp,%rbx,1),%eax
add    $0x1,%rbx
jmp    11e0 <main+0xc0>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [62 x i8] c"the address of test is: %p\0Athe value of test pointer is: %d\0A\0A\00"
@.str.1 = [19 x i8] c"setting test = 1\0A\0A\00"
@.str.2 = [63 x i8] c"the address of test is: %p\0Athe value of test pointer is: %d\0A\0A\0A\00"
@.str.3 = [24 x i8] c"sizeof(int) == 4 -> %d\0A\00"
@.str.4 = [21 x i8] c"sizeof(int) -> %ld\0A\0A\00"
@.str.5 = [20 x i8] c"data address: L%p\0A\0A\00"
@.str.6 = [61 x i8] c"bytep1[%d]: %d\09bytep2[%d]: %d\09bytep3[%d]: %d\09bytep4[%d]: %d\0A\00"
@.str.7 = [19 x i8] c" <-- found 255!!! \00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i8*
%9 = alloca i32*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32*
%14 = alloca i32*
%15 = alloca i32*
%16 = alloca i8*
%17 = alloca i8*
%18 = alloca i8*
%19 = alloca i8*
%20 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
store i32* %6, i32** %7
%21 = bitcast i32* %6 to i8*
%22 = load i32*, i32** %7
%23 = load i32, i32* %22
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str, i64 0, i64 0), i8* %21, i32 %23)
%25 = bitcast i32* %6 to i8*
store i8* %25, i8** %8
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %6
%27 = bitcast i32* %6 to i8*
%28 = load i32*, i32** %7
%29 = load i32, i32* %28
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.2, i64 0, i64 0), i8* %27, i32 %29)
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i32 1)
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i64 4)
%33 = bitcast i32** %9 to i8*
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0), i8* %33)
store i32 1, i32* %10
store i32 2, i32* %11
store i32 128, i32* %12
store i32* %10, i32** %13
store i32* %11, i32** %14
store i32* %12, i32** %15
%35 = load i32*, i32** %7
%36 = bitcast i32* %35 to i8*
store i8* %36, i8** %16
%37 = load i32*, i32** %13
%38 = bitcast i32* %37 to i8*
store i8* %38, i8** %17
%39 = load i32*, i32** %14
%40 = bitcast i32* %39 to i8*
store i8* %40, i8** %18
%41 = load i32*, i32** %15
%42 = bitcast i32* %41 to i8*
store i8* %42, i8** %19
store i32 0, i32* %20
br label %43
43: ; preds = %86, %2
%44 = load i32, i32* %20
%45 = icmp slt i32 %44, 32
br i1 %45, label %46, label %89
46: ; preds = %43
%47 = load i32, i32* %20
%48 = load i8*, i8** %16
%49 = load i32, i32* %20
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds i8, i8* %48, i64 %50
%52 = load i8, i8* %51
%53 = zext i8 %52 to i32
%54 = load i32, i32* %20
%55 = load i8*, i8** %17
%56 = load i32, i32* %20
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds i8, i8* %55, i64 %57
%59 = load i8, i8* %58
%60 = zext i8 %59 to i32
%61 = load i32, i32* %20
%62 = load i8*, i8** %18
%63 = load i32, i32* %20
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds i8, i8* %62, i64 %64
%66 = load i8, i8* %65
%67 = zext i8 %66 to i32
%68 = load i32, i32* %20
%69 = load i8*, i8** %19
%70 = load i32, i32* %20
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds i8, i8* %69, i64 %71
%73 = load i8, i8* %72
%74 = zext i8 %73 to i32
%75 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.6, i64 0, i64 0), i32 %47, i32 %53, i32 %54, i32 %60, i32 %61, i32 %67, i32 %68, i32 %74)
%76 = load i8*, i8** %16
%77 = load i32, i32* %20
%78 = sext i32 %77 to i64
%79 = getelementptr inbounds i8, i8* %76, i64 %78
%80 = load i8, i8* %79
%81 = zext i8 %80 to i32
%82 = icmp eq i32 %81, 255
br i1 %82, label %83, label %85
83: ; preds = %46
%84 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0))
br label %85
85: ; preds = %83, %46
br label %86
86: ; preds = %85
%87 = load i32, i32* %20
%88 = add nsw i32 %87, 1
store i32 %88, i32* %20
br label %43
89: ; preds = %43
ret i32 0
}

LLVM IR (-O2):
@.str = [62 x i8] c"the address of test is: %p\0Athe value of test pointer is: %d\0A\0A\00"
@.str.2 = [63 x i8] c"the address of test is: %p\0Athe value of test pointer is: %d\0A\0A\0A\00"
@.str.3 = [24 x i8] c"sizeof(int) == 4 -> %d\0A\00"
@.str.4 = [21 x i8] c"sizeof(int) -> %ld\0A\0A\00"
@.str.5 = [20 x i8] c"data address: L%p\0A\0A\00"
@.str.6 = [61 x i8] c"bytep1[%d]: %d\09bytep2[%d]: %d\09bytep3[%d]: %d\09bytep4[%d]: %d\0A\00"
@.str.7 = [19 x i8] c" <-- found 255!!! \00"
@str = [18 x i8] c"setting test = 1\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([62 x i8], [62 x i8]* @.str, i64 0, i64 0), i32* %3, i32 0)
%10 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
store i32 1, i32* %3
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([63 x i8], [63 x i8]* @.str.2, i64 0, i64 0), i32* %3, i32 1)
%12 = bitcast i32** %4 to i8*
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i32 1)
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i64 4)
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0), i32** %4)
%16 = bitcast i32* %5 to i8*
store i32 1, i32* %5
%17 = bitcast i32* %6 to i8*
store i32 2, i32* %6
%18 = bitcast i32* %7 to i8*
store i32 128, i32* %7
br label %20
19: ; preds = %37
ret i32 0
20: ; preds = %40, %2
%21 = phi i8 [ -128, %2 ], [ %46, %40 ]
%22 = phi i8 [ 2, %2 ], [ %44, %40 ]
%23 = phi i8 [ 1, %2 ], [ %42, %40 ]
%24 = phi i64 [ 0, %2 ], [ %38, %40 ]
%25 = getelementptr inbounds i8, i8* %8, i64 %24
%26 = load i8, i8* %25
%27 = zext i8 %26 to i32
%28 = zext i8 %23 to i32
%29 = zext i8 %22 to i32
%30 = zext i8 %21 to i32
%31 = trunc i64 %24 to i32
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @.str.6, i64 0, i64 0), i32 %31, i32 %27, i32 %31, i32 %28, i32 %31, i32 %29, i32 %31, i32 %30)
%33 = load i8, i8* %25
%34 = icmp eq i8 %33, -1
br i1 %34, label %35, label %37
35: ; preds = %20
%36 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0))
br label %37
37: ; preds = %20, %35
%38 = add nuw nsw i64 %24, 1
%39 = icmp eq i64 %38, 32
br i1 %39, label %19, label %40
40: ; preds = %37
%41 = getelementptr inbounds i8, i8* %16, i64 %38
%42 = load i8, i8* %41
%43 = getelementptr inbounds i8, i8* %17, i64 %38
%44 = load i8, i8* %43
%45 = getelementptr inbounds i8, i8* %18, i64 %38
%46 = load i8, i8* %45
br label %20
}