#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*/ assert(int /*<<< orphan*/);
int evaluateIntExpression(char *);
int /*<<< orphan*/ printf(char *);
scalar_t__ strlen(char *);
char *strtok(int /*<<< orphan*/ *, char *);
int *variableReturnVariable(char *);
void parseAssignmentInstruction(char *token) {
  assert(token != NULL);
  int *var = NULL;
  char *varName = strtok(NULL, " ");
  char *assignmentOp = strtok(NULL, " ");
  char *operand = strtok(NULL, "");
  int endChar = (int)strlen(operand) - 1;
  if (operand[endChar] == '\n') {
    operand[endChar] = '\0';
  }
  if (varName == NULL) {
    printf("ERR: Cannot assign a value to nothing.\n");
    return;
  } else if (assignmentOp == NULL || assignmentOp[0] != '=') {
    printf("ERR: Incorrect assignment syntax. Assignment operator '=' "
           "required.\n");
    return;
  } else if (operand == NULL) {
    printf("ERR: No value to assign to the variable.\n");
    return;
  }
  var = variableReturnVariable(varName);
  *var = evaluateIntExpression(operand);
}


x86 assembly (clang, -O0):
<parseAssignmentInstruction>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
movq   $0x0,-0x10(%rbp)
xor    %eax,%eax
mov    %eax,%edi
lea    0xe6f(%rip),%rsi
call   1080 <strtok@plt>
mov    %rax,-0x18(%rbp)
xor    %eax,%eax
mov    %eax,%edi
lea    0xe5b(%rip),%rsi
call   1080 <strtok@plt>
mov    %rax,-0x20(%rbp)
xor    %eax,%eax
mov    %eax,%edi
lea    0xeb5(%rip),%rsi
call   1080 <strtok@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
call   1040 <strlen@plt>
sub    $0x1,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x28(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0xa,%eax
jne    11f2 <parseAssignmentInstruction+0x92>
mov    -0x28(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
cmpq   $0x0,-0x18(%rbp)
jne    120e <parseAssignmentInstruction+0xae>
lea    0xdfe(%rip),%rdi
call   1050 <printf@plt>
jmp    127e <parseAssignmentInstruction+0x11e>
cmpq   $0x0,-0x20(%rbp)
je     1229 <parseAssignmentInstruction+0xc9>
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3d,%eax
je     123a <parseAssignmentInstruction+0xda>
lea    0xdfa(%rip),%rdi
call   1050 <printf@plt>
jmp    127e <parseAssignmentInstruction+0x11e>
cmpq   $0x0,-0x28(%rbp)
jne    1256 <parseAssignmentInstruction+0xf6>
lea    0xe23(%rip),%rdi
call   1050 <printf@plt>
jmp    127e <parseAssignmentInstruction+0x11e>
jmp    125b <parseAssignmentInstruction+0xfb>
jmp    1260 <parseAssignmentInstruction+0x100>
mov    -0x18(%rbp),%rdi
call   1030 <variableReturnVariable@plt>
mov    %rax,-0x10(%rbp)
mov    -0x28(%rbp),%rdi
call   1070 <evaluateIntExpression@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parseAssignmentInstruction>:
push   %r15
push   %r14
push   %rbx
xor    %eax,%eax
test   %rdi,%rdi
setne  %al
mov    %eax,%edi
call   1060 <assert@plt>
lea    0xe85(%rip),%rbx
xor    %edi,%edi
mov    %rbx,%rsi
call   1080 <strtok@plt>
mov    %rax,%r14
xor    %edi,%edi
mov    %rbx,%rsi
call   1080 <strtok@plt>
mov    %rax,%r15
lea    0xe65(%rip),%rsi
xor    %edi,%edi
call   1080 <strtok@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1050 <strlen@plt>
add    $0xffffffff,%eax
cltq
cmpb   $0xa,(%rbx,%rax,1)
jne    11bd <parseAssignmentInstruction+0x5d>
movb   $0x0,(%rbx,%rax,1)
test   %r14,%r14
je     11f2 <parseAssignmentInstruction+0x92>
test   %r15,%r15
je     11e9 <parseAssignmentInstruction+0x89>
cmpb   $0x3d,(%r15)
jne    11e9 <parseAssignmentInstruction+0x89>
mov    %r14,%rdi
call   1040 <variableReturnVariable@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1070 <evaluateIntExpression@plt>
mov    %eax,(%r14)
pop    %rbx
pop    %r14
pop    %r15
ret
lea    0xe12(%rip),%rdi
jmp    11f9 <parseAssignmentInstruction+0x99>
lea    0xe4d(%rip),%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [2 x i8] c" \00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [40 x i8] c"ERR: Cannot assign a value to nothing.\0A\00"
@.str.3 = [69 x i8] c"ERR: Incorrect assignment syntax. Assignment operator '=' required.\0A\00"
@.str.4 = [42 x i8] c"ERR: No value to assign to the variable.\0A\00"
define void @parseAssignmentInstruction(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
store i8* %0, i8** %2
%8 = load i8*, i8** %2
%9 = icmp ne i8* %8, null
%10 = zext i1 %9 to i32
%11 = call i32 @assert(i32 %10)
store i32* null, i32** %3
%12 = call i8* @strtok(i32* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* %12, i8** %4
%13 = call i8* @strtok(i32* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* %13, i8** %5
%14 = call i8* @strtok(i32* null, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
store i8* %14, i8** %6
%15 = load i8*, i8** %6
%16 = call i64 @strlen(i8* %15)
%17 = trunc i64 %16 to i32
%18 = sub nsw i32 %17, 1
store i32 %18, i32* %7
%19 = load i8*, i8** %6
%20 = load i32, i32* %7
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8, i8* %19, i64 %21
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = icmp eq i32 %24, 10
br i1 %25, label %26, label %31
26: ; preds = %1
%27 = load i8*, i8** %6
%28 = load i32, i32* %7
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i8, i8* %27, i64 %29
store i8 0, i8* %30
br label %31
31: ; preds = %26, %1
%32 = load i8*, i8** %4
%33 = icmp eq i8* %32, null
br i1 %33, label %34, label %36
34: ; preds = %31
%35 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0))
br label %60
36: ; preds = %31
%37 = load i8*, i8** %5
%38 = icmp eq i8* %37, null
br i1 %38, label %45, label %39
39: ; preds = %36
%40 = load i8*, i8** %5
%41 = getelementptr inbounds i8, i8* %40, i64 0
%42 = load i8, i8* %41
%43 = sext i8 %42 to i32
%44 = icmp ne i32 %43, 61
br i1 %44, label %45, label %47
45: ; preds = %39, %36
%46 = call i32 @printf(i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str.3, i64 0, i64 0))
br label %60
47: ; preds = %39
%48 = load i8*, i8** %6
%49 = icmp eq i8* %48, null
br i1 %49, label %50, label %52
50: ; preds = %47
%51 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.4, i64 0, i64 0))
br label %60
52: ; preds = %47
br label %53
53: ; preds = %52
br label %54
54: ; preds = %53
%55 = load i8*, i8** %4
%56 = call i32* @variableReturnVariable(i8* %55)
store i32* %56, i32** %3
%57 = load i8*, i8** %6
%58 = call i32 @evaluateIntExpression(i8* %57)
%59 = load i32*, i32** %3
store i32 %58, i32* %59
br label %60
60: ; preds = %54, %50, %45, %34
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c" \00"
@.str.1 = [1 x i8] zeroinitializer
@str.5 = [68 x i8] c"ERR: Incorrect assignment syntax. Assignment operator '=' required.\00"
@str.6 = [39 x i8] c"ERR: Cannot assign a value to nothing.\00"
define void @parseAssignmentInstruction(i8* readnone %0) {
%2 = icmp ne i8* %0, null
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
%5 = tail call i8* @strtok(i32* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%6 = tail call i8* @strtok(i32* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%7 = tail call i8* @strtok(i32* null, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%8 = tail call i64 @strlen(i8* dereferenceable(1) %7)
%9 = shl i64 %8, 32
%10 = add i64 %9, -4294967296
%11 = ashr exact i64 %10, 32
%12 = getelementptr inbounds i8, i8* %7, i64 %11
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 10
br i1 %14, label %15, label %16
15: ; preds = %1
store i8 0, i8* %12
br label %16
16: ; preds = %15, %1
%17 = icmp eq i8* %5, null
br i1 %17, label %18, label %20
18: ; preds = %16
%19 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.6, i64 0, i64 0))
br label %30
20: ; preds = %16
%21 = icmp eq i8* %6, null
br i1 %21, label %25, label %22
22: ; preds = %20
%23 = load i8, i8* %6
%24 = icmp eq i8 %23, 61
br i1 %24, label %27, label %25
25: ; preds = %22, %20
%26 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([68 x i8], [68 x i8]* @str.5, i64 0, i64 0))
br label %30
27: ; preds = %22
%28 = tail call i32* @variableReturnVariable(i8* %5)
%29 = tail call i32 @evaluateIntExpression(i8* %7)
store i32 %29, i32* %28
br label %30
30: ; preds = %27, %25, %18
ret void
}