#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*/ Factor();
int /*<<< orphan*/ Match(char);
void Divide() {
  Match('/');
  Factor();
  EmitLn("movl (%esp), %edx");
  EmitLn("addl $4, %esp");
  EmitLn("pushl %eax");
  EmitLn("movl %edx, %eax");
  EmitLn("sarl $31, %edx");
  EmitLn("idivl (%esp)");
  EmitLn("addl $4, %esp");
}


x86 assembly (clang, -O0):
<Divide>:
push   %rbp
mov    %rsp,%rbp
mov    $0x2f,%edi
call   1040 <Match@plt>
mov    $0x0,%al
call   1030 <Factor@plt>
lea    0xeb4(%rip),%rdi
call   1050 <EmitLn@plt>
lea    0xeba(%rip),%rdi
call   1050 <EmitLn@plt>
lea    0xebc(%rip),%rdi
call   1050 <EmitLn@plt>
lea    0xebb(%rip),%rdi
call   1050 <EmitLn@plt>
lea    0xebf(%rip),%rdi
call   1050 <EmitLn@plt>
lea    0xec2(%rip),%rdi
call   1050 <EmitLn@plt>
lea    0xe7e(%rip),%rdi
call   1050 <EmitLn@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<Divide>:
push   %rbx
mov    $0x2f,%edi
call   1040 <Match@plt>
xor    %eax,%eax
call   1030 <Factor@plt>
lea    0xeb7(%rip),%rdi
call   1050 <EmitLn@plt>
lea    0xebd(%rip),%rbx
mov    %rbx,%rdi
call   1050 <EmitLn@plt>
lea    0xebc(%rip),%rdi
call   1050 <EmitLn@plt>
lea    0xebb(%rip),%rdi
call   1050 <EmitLn@plt>
lea    0xebf(%rip),%rdi
call   1050 <EmitLn@plt>
lea    0xec2(%rip),%rdi
call   1050 <EmitLn@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1050 <EmitLn@plt>

LLVM IR (-O0):
@.str = [18 x i8] c"movl (%esp), %edx\00"
@.str.1 = [14 x i8] c"addl $4, %esp\00"
@.str.2 = [11 x i8] c"pushl %eax\00"
@.str.3 = [16 x i8] c"movl %edx, %eax\00"
@.str.4 = [15 x i8] c"sarl $31, %edx\00"
@.str.5 = [13 x i8] c"idivl (%esp)\00"
define void @Divide() {
%1 = call i32 @Match(i8 signext 47)
%2 = call i32 (...) @Factor()
%3 = call i32 @EmitLn(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @EmitLn(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @EmitLn(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%6 = call i32 @EmitLn(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
%7 = call i32 @EmitLn(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0))
%8 = call i32 @EmitLn(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0))
%9 = call i32 @EmitLn(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [18 x i8] c"movl (%esp), %edx\00"
@.str.1 = [14 x i8] c"addl $4, %esp\00"
@.str.2 = [11 x i8] c"pushl %eax\00"
@.str.3 = [16 x i8] c"movl %edx, %eax\00"
@.str.4 = [15 x i8] c"sarl $31, %edx\00"
@.str.5 = [13 x i8] c"idivl (%esp)\00"
define void @Divide() {
%1 = tail call i32 @Match(i8 signext 47)
%2 = tail call i32 (...) @Factor()
%3 = tail call i32 @EmitLn(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @EmitLn(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32 @EmitLn(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%6 = tail call i32 @EmitLn(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
%7 = tail call i32 @EmitLn(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0))
%8 = tail call i32 @EmitLn(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0))
%9 = tail call i32 @EmitLn(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
ret void
}