/* begin assembly stub */
.globl classify
.type classify,@function
classify:
/* prolog */
pushl %ebp /**/
pushl %ebx
movl %esp, %ebp
movl a, %eax /* eax = a */
testl %eax, %eax /* if (a == 0) */
je not_a_triangle /* return 0 */
movl b, %eax /* eax = b */
testl %eax, %eax /* if (b == 0) */
je not_a_triangle /* return 0 */
movl c, %eax /* eax = c */
testl %eax, %eax  /* if (c == 0) */
je not_a_triangle   /* return 0 */
xorl %ebx, %ebx     /* ebx = 0 */
movl a, %eax       /* eax = a */
cmpl b, %eax      /* if (a == b) */
je increment_by_one /* ebx = 1 */
movl a, %eax        /* eax = a */
cmpl c, %eax      /* if (a == c) */
je increment_by_one /* ebx = 1 */ /* Modified this line */
movl b, %eax      /* eax = b */
cmpl c, %eax    /* if (b == c) */
je increment_by_one /* ebx = 1 */ /* Modified this line */
movl a, %eax     /* eax = a */
addl b, %eax    /* eax = a + b */
cmpl c, %eax  /* if (a + b <= c) */
jle not_a_triangle /* return 0 */
movl b, %eax /* eax = b */
addl c, %eax /* eax = b + c */
cmpl a, %eax /* if (b + c <= a) */
jle not_a_triangle /* return 0 */
movl a, %eax /* eax = a */
addl c, %eax /* eax = a + c */
cmpl b, %eax /* if (a + c <= b) */
jle not_a_triangle /* return 0 */
movl $3, tri_type   /* tri_type = 3 */
jmp return        /* return 3 */
increment_by_one: /* ebx = 1 */ 
addl $1, %ebx
jmp match_done
increment_by_two: /* ebx = 2 */
addl $2, %ebx
jmp match_done
increment_by_three: /* ebx = 3 */
addl $3, %ebx
match_done: /* ebx = 1, 2, or 3 */
testl %ebx, %ebx
je return
cmpl $1, %ebx
jne check_match_six
movl a, %eax
addl b, %eax
cmpl c, %eax
jle not_a_triangle
movl $2, tri_type
jmp return
check_match_six: /* ebx = 2 or 3 */
cmpl $6, %ebx
je equilateral
cmpl $2, %ebx
jne return
movl a, %eax
addl c, %eax
cmpl b, %eax
jle not_a_triangle
movl $2, tri_type
jmp return
equilateral: /* ebx = 3 */
movl $1, tri_type
jmp return
not_a_triangle: /* ebx = 0 */
movl $0, tri_type
return:
/* epilog */
movl %ebp, %esp
popl %ebx
popl %ebp
ret
/* declare variables here */
/* end assembly stub */
.comm a, 4
.comm b, 4
.comm c, 4
.comm tri_type, 4
