int main(void) {
  char *junk = malloc(48);
  assert(junk);
  printf("\nComplain int32\n");
  __asm__ __volatile__("movl   0(%0), %%eax\n\t"
                       "movl   8(%0), %%edi\n\t"
                       "xorl   %%edi, %%eax\n\t"
                       ".byte 0x74,0x00"
                       :
                       : "r"(junk)
                       : "edi", "eax", "cc");
  printf("\nNo complain int32\n");
  __asm__ __volatile__("movl   0(%0), %%eax\n\t"
                       "movl   8(%0), %%edi\n\t"
                       "xorl   %%eax, %%eax\n\t"
                       ".byte 0x74,0x00"
                       :
                       : "r"(junk)
                       : "edi", "eax", "cc");
  printf("\nComplain mmx\n");
  __asm__ __volatile__("emms\n\t"
                       "movq   0(%0), %%mm0\n\t"
                       "movq   8(%0), %%mm7\n\t"
                       "pxor   %%mm7, %%mm0\n\t"
                       "movq   %%mm0, 16(%0)\n\t"
                       "movl   16(%0), %%esi\n\t"
                       "addl   20(%0), %%esi\n\t"
                       ".byte 0x74,0x00"
                       :
                       : "r"(junk)
                       : "esi", "mm7", "mm0", "cc", "memory");
  printf("\nNo complain mmx\n");
  __asm__ __volatile__("emms\n\t"
                       "movq   0(%0), %%mm0\n\t"
                       "movq   8(%0), %%mm7\n\t"
                       "pxor   %%mm0, %%mm0\n\t"
                       "movq   %%mm0, 16(%0)\n\t"
                       "movl   16(%0), %%esi\n\t"
                       "addl   20(%0), %%esi\n\t"
                       ".byte 0x74,0x00"
                       :
                       : "r"(junk)
                       : "esi", "mm7", "mm0", "cc", "memory");
  printf("\nComplain sse xorps\n");
  __asm__ __volatile__("movups   0(%0),  %%xmm0\n\t"
                       "movups   16(%0), %%xmm7\n\t"
                       "xorps    %%xmm7, %%xmm0\n\t"
                       "movups   %%xmm0, 32(%0)\n\t"
                       "movl 32(%0), %%esi\n\t"
                       "addl 36(%0), %%esi\n\t"
                       "addl 40(%0), %%esi\n\t"
                       "addl 44(%0), %%esi\n\t"
                       ".byte 0x74,0x00"
                       :
                       : "r"(junk)
                       : "esi", "xmm7", "xmm0", "cc", "memory");
  printf("\nNo complain sse xorps\n");
  __asm__ __volatile__("movups   0(%0),  %%xmm0\n\t"
                       "movups   16(%0), %%xmm7\n\t"
                       "xorps    %%xmm0, %%xmm0\n\t"
                       "movups   %%xmm0, 32(%0)\n\t"
                       "movl 32(%0), %%esi\n\t"
                       "addl 36(%0), %%esi\n\t"
                       "addl 40(%0), %%esi\n\t"
                       "addl 44(%0), %%esi\n\t"
                       ".byte 0x74,0x00"
                       :
                       : "r"(junk)
                       : "esi", "xmm7", "xmm0", "cc", "memory");
  free(junk);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x30,%edi
call   1060 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x0,%al
call   1050 <assert@plt>
lea    0xe91(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rcx
mov    (%rcx),%eax
mov    0x8(%rcx),%edi
xor    %edi,%eax
je     1183 <main+0x43>
lea    0xe87(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rcx
mov    (%rcx),%eax
mov    0x8(%rcx),%edi
xor    %eax,%eax
je     119e <main+0x5e>
lea    0xe80(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
emms
movq   (%rax),%mm0
movq   0x8(%rax),%mm7
pxor   %mm7,%mm0
movq   %mm0,0x10(%rax)
mov    0x10(%rax),%esi
add    0x14(%rax),%esi
je     11c8 <main+0x88>
lea    0xe65(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
emms
movq   (%rax),%mm0
movq   0x8(%rax),%mm7
pxor   %mm0,%mm0
movq   %mm0,0x10(%rax)
mov    0x10(%rax),%esi
add    0x14(%rax),%esi
je     11f2 <main+0xb2>
lea    0xe4d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
movups (%rax),%xmm0
movups 0x10(%rax),%xmm7
xorps  %xmm7,%xmm0
movups %xmm0,0x20(%rax)
mov    0x20(%rax),%esi
add    0x24(%rax),%esi
add    0x28(%rax),%esi
add    0x2c(%rax),%esi
je     1220 <main+0xe0>
lea    0xe34(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
movups (%rax),%xmm0
movups 0x10(%rax),%xmm7
xorps  %xmm0,%xmm0
movups %xmm0,0x20(%rax)
mov    0x20(%rax),%esi
add    0x24(%rax),%esi
add    0x28(%rax),%esi
add    0x2c(%rax),%esi
je     124e <main+0x10e>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x30,%edi
call   1060 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
xor    %eax,%eax
call   1050 <assert@plt>
lea    0xea1(%rip),%rdi
call   1040 <puts@plt>
mov    (%rbx),%eax
mov    0x8(%rbx),%edi
xor    %edi,%eax
je     116d <main+0x2d>
lea    0xe9c(%rip),%rdi
call   1040 <puts@plt>
mov    (%rbx),%eax
mov    0x8(%rbx),%edi
xor    %eax,%eax
je     1182 <main+0x42>
lea    0xe9a(%rip),%rdi
call   1040 <puts@plt>
emms
movq   (%rbx),%mm0
movq   0x8(%rbx),%mm7
pxor   %mm7,%mm0
movq   %mm0,0x10(%rbx)
mov    0x10(%rbx),%esi
add    0x14(%rbx),%esi
je     11a6 <main+0x66>
lea    0xe84(%rip),%rdi
call   1040 <puts@plt>
emms
movq   (%rbx),%mm0
movq   0x8(%rbx),%mm7
pxor   %mm0,%mm0
movq   %mm0,0x10(%rbx)
mov    0x10(%rbx),%esi
add    0x14(%rbx),%esi
je     11ca <main+0x8a>
lea    0xe71(%rip),%rdi
call   1040 <puts@plt>
movups (%rbx),%xmm0
movups 0x10(%rbx),%xmm7
xorps  %xmm7,%xmm0
movups %xmm0,0x20(%rbx)
mov    0x20(%rbx),%esi
add    0x24(%rbx),%esi
add    0x28(%rbx),%esi
add    0x2c(%rbx),%esi
je     11f2 <main+0xb2>
lea    0xe5d(%rip),%rdi
call   1040 <puts@plt>
movups (%rbx),%xmm0
movups 0x10(%rbx),%xmm7
xorps  %xmm0,%xmm0
movups %xmm0,0x20(%rbx)
mov    0x20(%rbx),%esi
add    0x24(%rbx),%esi
add    0x28(%rbx),%esi
add    0x2c(%rbx),%esi
je     121a <main+0xda>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [17 x i8] c"\0AComplain int32\0A\00"
@.str.1 = [20 x i8] c"\0ANo complain int32\0A\00"
@.str.2 = [15 x i8] c"\0AComplain mmx\0A\00"
@.str.3 = [18 x i8] c"\0ANo complain mmx\0A\00"
@.str.4 = [21 x i8] c"\0AComplain sse xorps\0A\00"
@.str.5 = [24 x i8] c"\0ANo complain sse xorps\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
store i32 0, i32* %1
%3 = call i8* @malloc(i64 48)
store i8* %3, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 (i8*, ...) bitcast (i32 (...)* @assert to i32 (i8*, ...)*)(i8* %4)
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%7 = load i8*, i8** %2
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
%9 = load i8*, i8** %2
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
%11 = load i8*, i8** %2
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
%13 = load i8*, i8** %2
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
%15 = load i8*, i8** %2
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0))
%17 = load i8*, i8** %2
%18 = load i8*, i8** %2
ret i32 0
}

LLVM IR (-O2):
@str = [16 x i8] c"\0AComplain int32\00"
@str.6 = [19 x i8] c"\0ANo complain int32\00"
@str.7 = [14 x i8] c"\0AComplain mmx\00"
@str.8 = [17 x i8] c"\0ANo complain mmx\00"
@str.9 = [20 x i8] c"\0AComplain sse xorps\00"
@str.10 = [23 x i8] c"\0ANo complain sse xorps\00"
define i32 @main() {
%1 = tail call dereferenceable_or_null(48) i8* @malloc(i64 48)
%2 = tail call i32 (i8*, ...) bitcast (i32 (...)* @assert to i32 (i8*, ...)*)(i8* %1)
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
tail call void asm sideeffect "movl 0($0), %eax\0A\09movl 8($0), %edi\0A\09xorl %edi, %eax\0A\09.byte 0x74,0x00", "r,~{edi},~{eax},~{cc},~{dirflag},~{fpsr},~{flags}"(i8* %1)
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.6, i64 0, i64 0))
tail call void asm sideeffect "movl 0($0), %eax\0A\09movl 8($0), %edi\0A\09xorl %eax, %eax\0A\09.byte 0x74,0x00", "r,~{edi},~{eax},~{cc},~{dirflag},~{fpsr},~{flags}"(i8* %1)
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.7, i64 0, i64 0))
tail call void asm sideeffect "emms\0A\09movq 0($0), %mm0\0A\09movq 8($0), %mm7\0A\09pxor %mm7, %mm0\0A\09movq %mm0, 16($0)\0A\09movl 16($0), %esi\0A\09addl 20($0), %esi\0A\09.byte 0x74,0x00", "r,~{esi},~{mm7},~{mm0},~{cc},~{memory},~{dirflag},~{fpsr},~{flags}"(i8* %1)
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.8, i64 0, i64 0))
tail call void asm sideeffect "emms\0A\09movq 0($0), %mm0\0A\09movq 8($0), %mm7\0A\09pxor %mm0, %mm0\0A\09movq %mm0, 16($0)\0A\09movl 16($0), %esi\0A\09addl 20($0), %esi\0A\09.byte 0x74,0x00", "r,~{esi},~{mm7},~{mm0},~{cc},~{memory},~{dirflag},~{fpsr},~{flags}"(i8* %1)
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.9, i64 0, i64 0))
tail call void asm sideeffect "movups 0($0), %xmm0\0A\09movups 16($0), %xmm7\0A\09xorps %xmm7, %xmm0\0A\09movups %xmm0, 32($0)\0A\09movl 32($0), %esi\0A\09addl 36($0), %esi\0A\09addl 40($0), %esi\0A\09addl 44($0), %esi\0A\09.byte 0x74,0x00", "r,~{esi},~{xmm7},~{xmm0},~{cc},~{memory},~{dirflag},~{fpsr},~{flags}"(i8* %1)
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.10, i64 0, i64 0))
tail call void asm sideeffect "movups 0($0), %xmm0\0A\09movups 16($0), %xmm7\0A\09xorps %xmm0, %xmm0\0A\09movups %xmm0, 32($0)\0A\09movl 32($0), %esi\0A\09addl 36($0), %esi\0A\09addl 40($0), %esi\0A\09addl 44($0), %esi\0A\09.byte 0x74,0x00", "r,~{esi},~{xmm7},~{xmm0},~{cc},~{memory},~{dirflag},~{fpsr},~{flags}"(i8* %1)
tail call void @free(i8* %1)
ret i32 0
}