#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*/ Assign(int *);
int /*<<< orphan*/ free(int *);
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, int);
void TestAssign(void) {
  int *myint = (int *)malloc(10 * sizeof(int));
  int i;
  Assign(myint);
  for (i = 0; i < 10; ++i) {
    printf("TestAssign %d\n", myint[i]);
  }
  if (myint != NULL)
    free(myint);
}


x86 assembly (clang, -O0):
<TestAssign>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x28,%edi
call   1060 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <Assign@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jge    1195 <TestAssign+0x55>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe7e(%rip),%rdi
call   1040 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1166 <TestAssign+0x26>
cmpq   $0x0,-0x8(%rbp)
je     11a9 <TestAssign+0x69>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<TestAssign>:
push   %r14
push   %rbx
push   %rax
mov    $0x28,%edi
call   1060 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1050 <Assign@plt>
mov    (%rbx),%esi
lea    0xe9e(%rip),%r14
mov    %r14,%rdi
call   1040 <printf@plt>
mov    0x4(%rbx),%esi
mov    %r14,%rdi
call   1040 <printf@plt>
mov    0x8(%rbx),%esi
mov    %r14,%rdi
call   1040 <printf@plt>
mov    0xc(%rbx),%esi
mov    %r14,%rdi
call   1040 <printf@plt>
mov    0x10(%rbx),%esi
mov    %r14,%rdi
call   1040 <printf@plt>
mov    0x14(%rbx),%esi
mov    %r14,%rdi
call   1040 <printf@plt>
mov    0x18(%rbx),%esi
mov    %r14,%rdi
call   1040 <printf@plt>
mov    0x1c(%rbx),%esi
mov    %r14,%rdi
call   1040 <printf@plt>
mov    0x20(%rbx),%esi
mov    %r14,%rdi
call   1040 <printf@plt>
mov    0x24(%rbx),%esi
mov    %r14,%rdi
call   1040 <printf@plt>
test   %rbx,%rbx
je     11e1 <TestAssign+0xa1>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <free@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [15 x i8] c"TestAssign %d\0A\00"
define void @TestAssign() {
%1 = alloca i32*
%2 = alloca i32
%3 = call i64 @malloc(i32 40)
%4 = inttoptr i64 %3 to i32*
store i32* %4, i32** %1
%5 = load i32*, i32** %1
%6 = call i32 @Assign(i32* %5)
store i32 0, i32* %2
br label %7
7: ; preds = %17, %0
%8 = load i32, i32* %2
%9 = icmp slt i32 %8, 10
br i1 %9, label %10, label %20
10: ; preds = %7
%11 = load i32*, i32** %1
%12 = load i32, i32* %2
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i32, i32* %11, i64 %13
%15 = load i32, i32* %14
%16 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %15)
br label %17
17: ; preds = %10
%18 = load i32, i32* %2
%19 = add nsw i32 %18, 1
store i32 %19, i32* %2
br label %7
20: ; preds = %7
%21 = load i32*, i32** %1
%22 = icmp ne i32* %21, null
br i1 %22, label %23, label %26
23: ; preds = %20
%24 = load i32*, i32** %1
%25 = call i32 @free(i32* %24)
br label %26
26: ; preds = %23, %20
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"TestAssign %d\0A\00"
define void @TestAssign() {
%1 = tail call i64 @malloc(i32 40)
%2 = inttoptr i64 %1 to i32*
%3 = tail call i32 @Assign(i32* %2)
%4 = load i32, i32* %2
%5 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = getelementptr inbounds i32, i32* %2, i64 1
%7 = load i32, i32* %6
%8 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = getelementptr inbounds i32, i32* %2, i64 2
%10 = load i32, i32* %9
%11 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = getelementptr inbounds i32, i32* %2, i64 3
%13 = load i32, i32* %12
%14 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %13)
%15 = getelementptr inbounds i32, i32* %2, i64 4
%16 = load i32, i32* %15
%17 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %16)
%18 = getelementptr inbounds i32, i32* %2, i64 5
%19 = load i32, i32* %18
%20 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %19)
%21 = getelementptr inbounds i32, i32* %2, i64 6
%22 = load i32, i32* %21
%23 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %22)
%24 = getelementptr inbounds i32, i32* %2, i64 7
%25 = load i32, i32* %24
%26 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %25)
%27 = getelementptr inbounds i32, i32* %2, i64 8
%28 = load i32, i32* %27
%29 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %28)
%30 = getelementptr inbounds i32, i32* %2, i64 9
%31 = load i32, i32* %30
%32 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %31)
%33 = icmp eq i64 %1, 0
br i1 %33, label %36, label %34
34: ; preds = %0
%35 = tail call i32 @free(i32* %2)
br label %36
36: ; preds = %34, %0
ret void
}