#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*/ emitln(char *);
int /*<<< orphan*/ expression();
int /*<<< orphan*/ getName();
int /*<<< orphan*/ match(char);
int /*<<< orphan*/ snprintf(char *, int, char *, char *);
int /*<<< orphan*/ strlcpy(char *, int /*<<< orphan*/, int);
void assignment() {
  char strbuf[1024];
  char assignName[32 + 1];
  strlcpy(assignName, getName(), 32 + 1);
  match('=');
  expression();
  snprintf(strbuf, 1024, "movl\t$%s,%%edx", assignName);
  emitln(strbuf);
  emitln("mov\t%eax,(%edx)");
}


x86 assembly (clang, -O0):
<assignment>:
push   %rbp
mov    %rsp,%rbp
sub    $0x440,%rsp
lea    -0x430(%rbp),%rax
mov    %rax,-0x438(%rbp)
mov    $0x0,%al
call   1080 <getName@plt>
mov    -0x438(%rbp),%rdi
mov    %eax,%esi
mov    $0x21,%edx
call   1060 <strlcpy@plt>
mov    $0x3d,%edi
call   1070 <match@plt>
mov    $0x0,%al
call   1050 <expression@plt>
lea    -0x400(%rbp),%rdi
lea    -0x430(%rbp),%rcx
mov    $0x400,%esi
lea    0xe42(%rip),%rdx
call   1040 <snprintf@plt>
lea    -0x400(%rbp),%rdi
call   1030 <emitln@plt>
lea    0xe39(%rip),%rdi
call   1030 <emitln@plt>
add    $0x440,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<assignment>:
push   %r14
push   %rbx
sub    $0x438,%rsp
xor    %eax,%eax
call   1080 <getName@plt>
mov    %rsp,%r14
mov    %r14,%rdi
mov    %eax,%esi
mov    $0x21,%edx
call   1060 <strlcpy@plt>
mov    $0x3d,%edi
call   1070 <match@plt>
xor    %eax,%eax
call   1050 <expression@plt>
lea    0xe65(%rip),%rdx
lea    0x30(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x400,%esi
mov    %r14,%rcx
call   1040 <snprintf@plt>
mov    %rbx,%rdi
call   1030 <emitln@plt>
lea    0xe50(%rip),%rdi
call   1030 <emitln@plt>
add    $0x438,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [15 x i8] c"movl\09$%s,%%edx\00"
@.str.1 = [16 x i8] c"mov\09%eax,(%edx)\00"
define void @assignment() {
%1 = alloca [1024 x i8]
%2 = alloca [33 x i8]
%3 = getelementptr inbounds [33 x i8], [33 x i8]* %2, i64 0, i64 0
%4 = call i32 (...) @getName()
%5 = call i32 @strlcpy(i8* %3, i32 %4, i32 33)
%6 = call i32 @match(i8 signext 61)
%7 = call i32 (...) @expression()
%8 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%9 = getelementptr inbounds [33 x i8], [33 x i8]* %2, i64 0, i64 0
%10 = call i32 @snprintf(i8* %8, i32 1024, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %9)
%11 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%12 = call i32 @emitln(i8* %11)
%13 = call i32 @emitln(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"movl\09$%s,%%edx\00"
@.str.1 = [16 x i8] c"mov\09%eax,(%edx)\00"
define void @assignment() {
%1 = alloca [1024 x i8]
%2 = alloca [33 x i8]
%3 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [33 x i8], [33 x i8]* %2, i64 0, i64 0
%5 = tail call i32 (...) @getName()
%6 = call i32 @strlcpy(i8* %4, i32 %5, i32 33)
%7 = call i32 @match(i8 signext 61)
%8 = call i32 (...) @expression()
%9 = call i32 @snprintf(i8* %3, i32 1024, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %4)
%10 = call i32 @emitln(i8* %3)
%11 = call i32 @emitln(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
ret void
}