xunge/DecIR huggingface dataset:
int changePieceOrien(int pieceOrien, int modifier) {
  if (modifier == 1) {
    pieceOrien++;
    if (pieceOrien > 4) {
      pieceOrien -= 4;
    }
  } else {
    pieceOrien--;
    if (pieceOrien < 1) {
      pieceOrien += 4;
    }
  }
  return pieceOrien;
}


x86 assembly (clang, -O0):
<changePieceOrien>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    1135 <changePieceOrien+0x35>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
cmpl   $0x4,-0x4(%rbp)
jle    1130 <changePieceOrien+0x30>
mov    -0x4(%rbp),%eax
sub    $0x4,%eax
mov    %eax,-0x4(%rbp)
jmp    1156 <changePieceOrien+0x56>
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x4(%rbp)
cmpl   $0x1,-0x4(%rbp)
jge    1151 <changePieceOrien+0x51>
mov    -0x4(%rbp),%eax
add    $0x4,%eax
mov    %eax,-0x4(%rbp)
jmp    1156 <changePieceOrien+0x56>
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<changePieceOrien>:
xor    %eax,%eax
cmp    $0x4,%edi
setl   %al
xor    %ecx,%ecx
cmp    $0x2,%edi
setl   %cl
cmp    $0x1,%esi
lea    -0x3(,%rax,4),%edx
lea    -0x1(,%rcx,4),%eax
cmove  %edx,%eax
add    %edi,%eax
ret

LLVM IR (-O0):
define i32 @changePieceOrien(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = icmp eq i32 %5, 1
br i1 %6, label %7, label %16
7: ; preds = %2
%8 = load i32, i32* %3
%9 = add nsw i32 %8, 1
store i32 %9, i32* %3
%10 = load i32, i32* %3
%11 = icmp sgt i32 %10, 4
br i1 %11, label %12, label %15
12: ; preds = %7
%13 = load i32, i32* %3
%14 = sub nsw i32 %13, 4
store i32 %14, i32* %3
br label %15
15: ; preds = %12, %7
br label %25
16: ; preds = %2
%17 = load i32, i32* %3
%18 = add nsw i32 %17, -1
store i32 %18, i32* %3
%19 = load i32, i32* %3
%20 = icmp slt i32 %19, 1
br i1 %20, label %21, label %24
21: ; preds = %16
%22 = load i32, i32* %3
%23 = add nsw i32 %22, 4
store i32 %23, i32* %3
br label %24
24: ; preds = %21, %16
br label %25
25: ; preds = %24, %15
%26 = load i32, i32* %3
ret i32 %26
}

LLVM IR (-O2):
define i32 @changePieceOrien(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 1
%4 = icmp sgt i32 %0, 3
%5 = select i1 %4, i32 -3, i32 1
%6 = icmp slt i32 %0, 2
%7 = select i1 %6, i32 3, i32 -1
%8 = select i1 %3, i32 %5, i32 %7
%9 = add nsw i32 %8, %0
ret i32 %9
}
/* Variables and functions */
void *malloc(unsigned int);
void *heapAlloc(void *userData, unsigned int size) { return malloc(size); }


x86 assembly (clang, -O0):
<heapAlloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1030 <malloc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<heapAlloc>:
mov    %esi,%edi
jmp    1030 <malloc@plt>

LLVM IR (-O0):
define i8* @heapAlloc(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = call i8* @malloc(i32 %5)
ret i8* %6
}

LLVM IR (-O2):
define noalias i8* @heapAlloc(i8* nocapture readnone %0, i32 %1) {
%3 = tail call i8* @malloc(i32 %1)
ret i8* %3
}
int f4(int i) {
  if (i == 0)
    return 0;
  return i << 10;
}


x86 assembly (clang, -O0):
<f4>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    111d <f4+0x1d>
movl   $0x0,-0x4(%rbp)
jmp    1126 <f4+0x26>
mov    -0x8(%rbp),%eax
shl    $0xa,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f4>:
mov    %edi,%eax
shl    $0xa,%eax
ret

LLVM IR (-O0):
define i32 @f4(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %1
store i32 0, i32* %2
br label %10
7: ; preds = %1
%8 = load i32, i32* %3
%9 = shl i32 %8, 10
store i32 %9, i32* %2
br label %10
10: ; preds = %7, %6
%11 = load i32, i32* %2
ret i32 %11
}

LLVM IR (-O2):
define i32 @f4(i32 %0) {
%2 = shl i32 %0, 10
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void print_usage() {
  printf("%s\n", "usage: <program> <arguments>");
  return;
}


x86 assembly (clang, -O0):
<print_usage>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
lea    0xee2(%rip),%rsi
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_usage>:
lea    0xee9(%rip),%rdi
lea    0xee6(%rip),%rsi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [29 x i8] c"usage: <program> <arguments>\00"
define void @print_usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [29 x i8] c"usage: <program> <arguments>\00"
define void @print_usage() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int tlib8func() {
  printf("This is T8\n");
  return 8;
}


x86 assembly (clang, -O0):
<tlib8func>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <printf@plt>
mov    $0x8,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<tlib8func>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
mov    $0x8,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [12 x i8] c"This is T8\0A\00"
define i32 @tlib8func() {
%1 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
ret i32 8
}

LLVM IR (-O2):
@str = [11 x i8] c"This is T8\00"
define i32 @tlib8func() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
ret i32 8
}
void upcase(char *str) {
  while (*str != '\0') {
    if (*str >= 'a' && *str <= 'z') {
      *str -= 0x20;
    }
    str++;
  }
}


x86 assembly (clang, -O0):
<upcase>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1155 <upcase+0x55>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x61,%eax
jl     1144 <upcase+0x44>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x7a,%eax
jg     1144 <upcase+0x44>
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
sub    $0x20,%ecx
mov    %cl,(%rax)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1108 <upcase+0x8>
pop    %rbp
ret

x86 assembly (clang, -O2):
<upcase>:
mov    (%rdi),%al
test   %al,%al
je     112a <upcase+0x2a>
add    $0x1,%rdi
jmp    111b <upcase+0x1b>
nopl   0x0(%rax)
movzbl (%rdi),%eax
add    $0x1,%rdi
test   %al,%al
je     112a <upcase+0x2a>
lea    -0x61(%rax),%ecx
cmp    $0x19,%cl
ja     1110 <upcase+0x10>
add    $0xe0,%al
mov    %al,-0x1(%rdi)
jmp    1110 <upcase+0x10>
ret

LLVM IR (-O0):
define void @upcase(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %24, %1
%4 = load i8*, i8** %2
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %27
8: ; preds = %3
%9 = load i8*, i8** %2
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = icmp sge i32 %11, 97
br i1 %12, label %13, label %24
13: ; preds = %8
%14 = load i8*, i8** %2
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = icmp sle i32 %16, 122
br i1 %17, label %18, label %24
18: ; preds = %13
%19 = load i8*, i8** %2
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = sub nsw i32 %21, 32
%23 = trunc i32 %22 to i8
store i8 %23, i8* %19
br label %24
24: ; preds = %18, %13, %8
%25 = load i8*, i8** %2
%26 = getelementptr inbounds i8, i8* %25, i32 1
store i8* %26, i8** %2
br label %3
27: ; preds = %3
ret void
}

LLVM IR (-O2):
define void @upcase(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %15, label %4
4: ; preds = %1, %11
%5 = phi i8 [ %13, %11 ], [ %2, %1 ]
%6 = phi i8* [ %12, %11 ], [ %0, %1 ]
%7 = add i8 %5, -97
%8 = icmp ult i8 %7, 26
br i1 %8, label %9, label %11
9: ; preds = %4
%10 = add nsw i8 %5, -32
store i8 %10, i8* %6
br label %11
11: ; preds = %9, %4
%12 = getelementptr inbounds i8, i8* %6, i64 1
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 0
br i1 %14, label %15, label %4
15: ; preds = %11, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(unsigned char *, unsigned char *, size_t);
unsigned char *optput(unsigned char *p, int opt, unsigned char *data,
                      size_t len) {
  *p++ = opt;
  *p++ = (unsigned char)len;
  memcpy(p, data, len);
  return p + len;
}


x86 assembly (clang, -O0):
<optput>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0xc(%rbp),%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %cl,(%rax)
mov    -0x20(%rbp),%rax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %cl,(%rax)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1030 <memcpy@plt>
mov    -0x8(%rbp),%rax
add    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<optput>:
push   %r14
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %rdi,%rbx
mov    %sil,(%rdi)
add    $0x2,%rdi
mov    %r14b,0x1(%rbx)
mov    %rdx,%rsi
mov    %rcx,%rdx
call   1030 <memcpy@plt>
lea    (%rbx,%r14,1),%rax
add    $0x2,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @optput(i8* %0, i32 %1, i8* %2, i64 %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i64
store i8* %0, i8** %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store i64 %3, i64* %8
%9 = load i32, i32* %6
%10 = trunc i32 %9 to i8
%11 = load i8*, i8** %5
%12 = getelementptr inbounds i8, i8* %11, i32 1
store i8* %12, i8** %5
store i8 %10, i8* %11
%13 = load i64, i64* %8
%14 = trunc i64 %13 to i8
%15 = load i8*, i8** %5
%16 = getelementptr inbounds i8, i8* %15, i32 1
store i8* %16, i8** %5
store i8 %14, i8* %15
%17 = load i8*, i8** %5
%18 = load i8*, i8** %7
%19 = load i64, i64* %8
%20 = call i32 @memcpy(i8* %17, i8* %18, i64 %19)
%21 = load i8*, i8** %5
%22 = load i64, i64* %8
%23 = getelementptr inbounds i8, i8* %21, i64 %22
ret i8* %23
}

LLVM IR (-O2):
define i8* @optput(i8* %0, i32 %1, i8* %2, i64 %3) {
%5 = trunc i32 %1 to i8
%6 = getelementptr inbounds i8, i8* %0, i64 1
store i8 %5, i8* %0
%7 = trunc i64 %3 to i8
%8 = getelementptr inbounds i8, i8* %0, i64 2
store i8 %7, i8* %6
%9 = tail call i32 @memcpy(i8* %8, i8* %2, i64 %3)
%10 = getelementptr inbounds i8, i8* %8, i64 %3
ret i8* %10
}
void DumpArgs(int argc, char *argv[]) {}


x86 assembly (clang, -O0):
<DumpArgs>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<DumpArgs>:
ret

LLVM IR (-O0):
define void @DumpArgs(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
ret void
}

LLVM IR (-O2):
define void @DumpArgs(i32 %0, i8** nocapture %1) {
ret void
}
void addElf(char buf[]) {
  int e;
  const char elfMagic[] = {'\177', 'E', 'L', 'F'};
  const char *mptr = elfMagic;
  for (e = 0; e < 4; e++, mptr++)
    buf[e] = *mptr;
}


x86 assembly (clang, -O0):
<addElf>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    0xef2(%rip),%eax
mov    %eax,-0x10(%rbp)
lea    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x4,-0xc(%rbp)
jge    1155 <addElf+0x55>
mov    -0x18(%rbp),%rax
mov    (%rax),%dl
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1120 <addElf+0x20>
pop    %rbp
ret

x86 assembly (clang, -O2):
<addElf>:
movl   $0x464c457f,(%rdi)
ret

LLVM IR (-O0):
@__const.addElf.elfMagic = [4 x i8] c"\7FELF"
define void @addElf(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca [4 x i8]
%5 = alloca i8*
store i8* %0, i8** %2
%6 = bitcast [4 x i8]* %4 to i8*
%7 = getelementptr inbounds [4 x i8], [4 x i8]* %4, i64 0, i64 0
store i8* %7, i8** %5
store i32 0, i32* %3
br label %8
8: ; preds = %18, %1
%9 = load i32, i32* %3
%10 = icmp slt i32 %9, 4
br i1 %10, label %11, label %23
11: ; preds = %8
%12 = load i8*, i8** %5
%13 = load i8, i8* %12
%14 = load i8*, i8** %2
%15 = load i32, i32* %3
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8, i8* %14, i64 %16
store i8 %13, i8* %17
br label %18
18: ; preds = %11
%19 = load i32, i32* %3
%20 = add nsw i32 %19, 1
store i32 %20, i32* %3
%21 = load i8*, i8** %5
%22 = getelementptr inbounds i8, i8* %21, i32 1
store i8* %22, i8** %5
br label %8
23: ; preds = %8
ret void
}

LLVM IR (-O2):
define void @addElf(i8* nocapture writeonly %0) {
%2 = bitcast i8* %0 to i32*
store i32 1179403647, i32* %2
ret void
}
/* Variables and functions */
int atoi(char *);
int /*<<< orphan*/ sprintf(char *, char *, char);
int ctoi(char c) {
  static char s[1];
  sprintf(s, "%c", c);
  return atoi(s);
}


x86 assembly (clang, -O0):
<ctoi>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
lea    0x2efc(%rip),%rdi
lea    0xec4(%rip),%rsi
movsbl -0x1(%rbp),%edx
call   1040 <sprintf@plt>
lea    0x2ee5(%rip),%rdi
call   1030 <atoi@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ctoi>:
movb   $0x0,0x2f13(%rip)
lea    0x2f0b(%rip),%rdi
jmp    1030 <atoi@plt>

LLVM IR (-O0):
@ctoi.s = internal global [1 x i8] zeroinitializer
@.str = [3 x i8] c"%c\00"
define i32 @ctoi(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = call i32 @sprintf(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @ctoi.s, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 signext %3)
%5 = call i32 @atoi(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @ctoi.s, i64 0, i64 0))
ret i32 %5
}

LLVM IR (-O2):
@ctoi.s = internal global [1 x i8] zeroinitializer
define i32 @ctoi(i8 signext %0) {
store i8 0, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @ctoi.s, i64 1, i64 0)
%2 = tail call i32 @atoi(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @ctoi.s, i64 0, i64 0))
ret i32 %2
}
unsigned int inl_p(unsigned short port) {
  unsigned int _v;
  __asm__ __volatile__("in"
                       "l"
                       " %"
                       "w"
                       "1,%"
                       ""
                       "0"
                       : "=a"(_v)
                       : "Nd"(port));
  slow_down_io();
  return _v;
}


x86 assembly (clang, -O0):
<inl_p>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    -0x2(%rbp),%dx
in     (%dx),%eax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1030 <slow_down_io@plt>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inl_p>:
push   %rbx
mov    %edi,%edx
in     (%dx),%eax
mov    %eax,%ebx
xor    %eax,%eax
call   1030 <slow_down_io@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @inl_p(i16 zeroext %0) {
%2 = alloca i16
%3 = alloca i32
store i16 %0, i16* %2
%4 = load i16, i16* %2
%5 = call i32 asm sideeffect "inl ${1:w},$0", "={ax},N{dx},~{dirflag},~{fpsr},~{flags}"(i16 %4)
store i32 %5, i32* %3
%6 = call i32 (...) @slow_down_io()
%7 = load i32, i32* %3
ret i32 %7
}

LLVM IR (-O2):
define i32 @inl_p(i16 zeroext %0) {
%2 = tail call i32 asm sideeffect "inl ${1:w},$0", "={ax},N{dx},~{dirflag},~{fpsr},~{flags}"(i16 %0)
%3 = tail call i32 (...) @slow_down_io()
ret i32 %2
}
void capturing2capturingAtomic_rv_endCapturing() {}


x86 assembly (clang, -O0):
<capturing2capturingAtomic_rv_endCapturing>:
push   %rbp
mov    %rsp,%rbp
pop    %rbp
ret

x86 assembly (clang, -O2):
<capturing2capturingAtomic_rv_endCapturing>:
ret

LLVM IR (-O0):
define void @capturing2capturingAtomic_rv_endCapturing() {
ret void
}

LLVM IR (-O2):
define void @capturing2capturingAtomic_rv_endCapturing() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ GP_break20();
int /*<<< orphan*/ MP_motor(int, int /*<<< orphan*/);
int /*<<< orphan*/ MP_p2wait1();
int /*<<< orphan*/ MP_p2wait2();
int /*<<< orphan*/ MP_p2wait3();
void MP_prozess2(void) {
  while (1) {
    GP_break20();
    MP_p2wait1();
    MP_motor(1, 0);
    MP_p2wait2();
    MP_p2wait3();
  };
}


x86 assembly (clang, -O0):
<MP_prozess2>:
push   %rbp
mov    %rsp,%rbp
jmp    1159 <MP_prozess2+0x9>
mov    $0x0,%al
call   1030 <GP_break20@plt>
mov    $0x0,%al
call   1050 <MP_p2wait1@plt>
mov    $0x1,%edi
xor    %esi,%esi
call   1070 <MP_motor@plt>
mov    $0x0,%al
call   1060 <MP_p2wait2@plt>
mov    $0x0,%al
call   1040 <MP_p2wait3@plt>
jmp    1159 <MP_prozess2+0x9>

x86 assembly (clang, -O2):
<MP_prozess2>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <GP_break20@plt>
xor    %eax,%eax
call   1050 <MP_p2wait1@plt>
mov    $0x1,%edi
xor    %esi,%esi
call   1070 <MP_motor@plt>
xor    %eax,%eax
call   1060 <MP_p2wait2@plt>
xor    %eax,%eax
call   1040 <MP_p2wait3@plt>
jmp    1160 <MP_prozess2+0x10>

LLVM IR (-O0):
define void @MP_prozess2() {
br label %1
1: ; preds = %0, %1
%2 = call i32 (...) @GP_break20()
%3 = call i32 (...) @MP_p2wait1()
%4 = call i32 @MP_motor(i32 1, i32 0)
%5 = call i32 (...) @MP_p2wait2()
%6 = call i32 (...) @MP_p2wait3()
br label %1
}

LLVM IR (-O2):
define void @MP_prozess2() {
br label %1
1: ; preds = %0, %1
%2 = tail call i32 (...) @GP_break20()
%3 = tail call i32 (...) @MP_p2wait1()
%4 = tail call i32 @MP_motor(i32 1, i32 0)
%5 = tail call i32 (...) @MP_p2wait2()
%6 = tail call i32 (...) @MP_p2wait3()
br label %1
}
int unregister_module_notifier(struct notifier_block *nb) { return 0; }


x86 assembly (clang, -O0):
<unregister_module_notifier>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<unregister_module_notifier>:
xor    %eax,%eax
ret

LLVM IR (-O0):
%struct.notifier_block = type opaque
define i32 @unregister_module_notifier(%struct.notifier_block* %0) {
%2 = alloca %struct.notifier_block*
store %struct.notifier_block* %0, %struct.notifier_block** %2
ret i32 0
}

LLVM IR (-O2):
%struct.notifier_block = type opaque
define i32 @unregister_module_notifier(%struct.notifier_block* nocapture readnone %0) {
ret i32 0
}
int tg_ord(char *s) { return s[0]; }


x86 assembly (clang, -O0):
<tg_ord>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<tg_ord>:
movsbl (%rdi),%eax
ret

LLVM IR (-O0):
define i32 @tg_ord(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 0
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @tg_ord(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = sext i8 %2 to i32
ret i32 %3
}
char *gettext(const char *msgid) { return (char *)msgid; }


x86 assembly (clang, -O0):
<gettext>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<gettext>:
mov    %rdi,%rax
ret

LLVM IR (-O0):
define i8* @gettext(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
ret i8* %3
}

LLVM IR (-O2):
define i8* @gettext(i8* readnone returned %0) {
ret i8* %0
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ ASSERT(int);
uint32_t QEIPositionGet(uint32_t ui32Base) {
  ASSERT((ui32Base == 0x4002C000) || (ui32Base == 0x4002D000));
  return ((*((volatile uint32_t *)(ui32Base + 0x00000008))));
}


x86 assembly (clang, -O0):
<QEIPositionGet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x1,%al
cmpl   $0x4002c000,-0x4(%rbp)
mov    %al,-0x5(%rbp)
je     113a <QEIPositionGet+0x2a>
cmpl   $0x4002d000,-0x4(%rbp)
sete   %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <ASSERT@plt>
mov    -0x4(%rbp),%eax
add    $0x8,%eax
cltq
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<QEIPositionGet>:
push   %rbx
mov    %edi,%ebx
mov    %edi,%eax
and    $0xffffefff,%eax
xor    %edi,%edi
cmp    $0x4002c000,%eax
sete   %dil
call   1030 <ASSERT@plt>
movslq %ebx,%rax
mov    0x8(%rax),%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @QEIPositionGet(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 1073922048
br i1 %4, label %8, label %5
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp eq i32 %6, 1073926144
br label %8
8: ; preds = %5, %1
%9 = phi i1 [ true, %1 ], [ %7, %5 ]
%10 = zext i1 %9 to i32
%11 = call i32 @ASSERT(i32 %10)
%12 = load i32, i32* %2
%13 = add nsw i32 %12, 8
%14 = sext i32 %13 to i64
%15 = inttoptr i64 %14 to i32*
%16 = load volatile i32, i32* %15
ret i32 %16
}

LLVM IR (-O2):
define i32 @QEIPositionGet(i32 %0) {
%2 = and i32 %0, -4097
%3 = icmp eq i32 %2, 1073922048
%4 = zext i1 %3 to i32
%5 = tail call i32 @ASSERT(i32 %4)
%6 = add nsw i32 %0, 8
%7 = sext i32 %6 to i64
%8 = inttoptr i64 %7 to i32*
%9 = load volatile i32, i32* %8
ret i32 %9
}
void foo10(p, p2) void *p;
{}


x86 assembly (clang, -O0):
<foo10>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo10>:
ret

LLVM IR (-O0):
define void @foo10(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
ret void
}

LLVM IR (-O2):
define void @foo10(i8* nocapture %0, i32 %1) {
ret void
}
int scope_init(void) { return 0; }


x86 assembly (clang, -O0):
<scope_init>:
push   %rbp
mov    %rsp,%rbp
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<scope_init>:
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @scope_init() {
ret i32 0
}

LLVM IR (-O2):
define i32 @scope_init() {
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
int32_t funge_nop(int32_t funge_char) { return 0; }


x86 assembly (clang, -O0):
<funge_nop>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<funge_nop>:
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @funge_nop(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
ret i32 0
}

LLVM IR (-O2):
define i32 @funge_nop(i32 %0) {
ret i32 0
}
int ft_isascii(int c) {
  if (c >= 0 && c <= 0177)
    return (1);
  else
    return (0);
}


x86 assembly (clang, -O0):
<ft_isascii>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     1127 <ft_isascii+0x27>
cmpl   $0x7f,-0x8(%rbp)
jg     1127 <ft_isascii+0x27>
movl   $0x1,-0x4(%rbp)
jmp    112e <ft_isascii+0x2e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_isascii>:
xor    %eax,%eax
cmp    $0x80,%edi
setb   %al
ret

LLVM IR (-O0):
define i32 @ft_isascii(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp sge i32 %4, 0
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i32, i32* %3
%8 = icmp sle i32 %7, 127
br i1 %8, label %9, label %10
9: ; preds = %6
store i32 1, i32* %2
br label %11
10: ; preds = %6, %1
store i32 0, i32* %2
br label %11
11: ; preds = %10, %9
%12 = load i32, i32* %2
ret i32 %12
}

LLVM IR (-O2):
define i32 @ft_isascii(i32 %0) {
%2 = icmp ult i32 %0, 128
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ bottom(int);
void right(int i) { bottom(i); }


x86 assembly (clang, -O0):
<right>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <bottom@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<right>:
jmp    1030 <bottom@plt>

LLVM IR (-O0):
define void @right(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @bottom(i32 %3)
ret void
}

LLVM IR (-O2):
define void @right(i32 %0) {
%2 = tail call i32 @bottom(i32 %0)
ret void
}
/* Type definitions */
struct hostent {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ __softboundmpx_store_return_metadata(struct hostent *,
                                                        void *);
struct hostent *gethostbyname(char const *);
__attribute__((__weak__, __always___)) struct hostent *
softboundmpx_gethostbyname(const char *name) {
  struct hostent *ret_ptr = gethostbyname(name);
  void *ret_bound = ret_ptr + sizeof(struct hostent);
  __softboundmpx_store_return_metadata(ret_ptr, ret_bound);
  return ret_ptr;
}


x86 assembly (clang, -O0):
<softboundmpx_gethostbyname>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <gethostbyname@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x10,%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <__softboundmpx_store_return_metadata@plt>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<softboundmpx_gethostbyname>:
push   %rbx
call   1030 <gethostbyname@plt>
mov    %rax,%rbx
lea    0x10(%rax),%rsi
mov    %rax,%rdi
call   1040 <__softboundmpx_store_return_metadata@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
%struct.hostent = type { i32 }
define weak %struct.hostent* @softboundmpx_gethostbyname(i8* %0) {
%2 = alloca i8*
%3 = alloca %struct.hostent*
%4 = alloca i8*
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call %struct.hostent* @gethostbyname(i8* %5)
store %struct.hostent* %6, %struct.hostent** %3
%7 = load %struct.hostent*, %struct.hostent** %3
%8 = getelementptr inbounds %struct.hostent, %struct.hostent* %7, i64 4
%9 = bitcast %struct.hostent* %8 to i8*
store i8* %9, i8** %4
%10 = load %struct.hostent*, %struct.hostent** %3
%11 = load i8*, i8** %4
%12 = call i32 @__softboundmpx_store_return_metadata(%struct.hostent* %10, i8* %11)
%13 = load %struct.hostent*, %struct.hostent** %3
ret %struct.hostent* %13
}

LLVM IR (-O2):
%struct.hostent = type { i32 }
define weak %struct.hostent* @softboundmpx_gethostbyname(i8* %0) {
%2 = tail call %struct.hostent* @gethostbyname(i8* %0)
%3 = getelementptr inbounds %struct.hostent, %struct.hostent* %2, i64 4
%4 = bitcast %struct.hostent* %3 to i8*
%5 = tail call i32 @__softboundmpx_store_return_metadata(%struct.hostent* %2, i8* %4)
ret %struct.hostent* %2
}
/* Variables and functions */
int /*<<< orphan*/ get_word_lengths(int *, int);
int /*<<< orphan*/ make_histogram(int *, int);
int /*<<< orphan*/ putchar(char);
int main() {
  int word_lengths[10] = {0};
  get_word_lengths(word_lengths, 10);
  putchar('\n');
  make_histogram(word_lengths, 10);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1050 <memset@plt>
lea    -0x30(%rbp),%rdi
mov    $0xa,%esi
call   1060 <get_word_lengths@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    -0x30(%rbp),%rdi
mov    $0xa,%esi
call   1040 <make_histogram@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
movq   $0x0,0x20(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0xa,%esi
call   1050 <get_word_lengths@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1040 <make_histogram@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i32]
store i32 0, i32* %1
%3 = bitcast [10 x i32]* %2 to i8*
%4 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%5 = call i32 @get_word_lengths(i32* %4, i32 10)
%6 = call i32 @putchar(i8 signext 10)
%7 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%8 = call i32 @make_histogram(i32* %7, i32 10)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [10 x i32]
%2 = bitcast [10 x i32]* %1 to i8*
%3 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%4 = call i32 @get_word_lengths(i32* %3, i32 10)
%5 = call i32 @putchar(i8 signext 10)
%6 = call i32 @make_histogram(i32* %3, i32 10)
ret i32 0
}
int main() {
  int cancel = 0;
  while (!cancel)
    ;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1128 <main+0x28>
jmp    112d <main+0x2d>
jmp    1112 <main+0x12>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
jmp    1100 <main>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
br label %3
3: ; preds = %7, %0
%4 = load i32, i32* %2
%5 = icmp ne i32 %4, 0
%6 = xor i1 %5, true
br i1 %6, label %7, label %8
7: ; preds = %3
br label %3
8: ; preds = %3
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
br label %1
1: ; preds = %1, %0
br label %1
}
int gcd(long long int a, long long int b) {
  long long int t, x;
  if (a == 0)
    return a;
  else if (b == 0)
    return b;
  else
    while (b != 0) {
      t = b;
      b = a % b;
      a = t;
    }
  return a;
}


x86 assembly (clang, -O0):
<gcd>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1123 <gcd+0x23>
mov    -0x10(%rbp),%rax
mov    %eax,-0x4(%rbp)
jmp    117e <gcd+0x7e>
cmpq   $0x0,-0x18(%rbp)
jne    113a <gcd+0x3a>
mov    -0x18(%rbp),%rax
mov    %eax,-0x4(%rbp)
jmp    117e <gcd+0x7e>
jmp    113f <gcd+0x3f>
cmpq   $0x0,-0x18(%rbp)
je     116d <gcd+0x6d>
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
cqto
idivq  -0x18(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x10(%rbp)
jmp    113f <gcd+0x3f>
jmp    1172 <gcd+0x72>
jmp    1177 <gcd+0x77>
mov    -0x10(%rbp),%rax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<gcd>:
xor    %ecx,%ecx
test   %rdi,%rdi
je     1142 <gcd+0x42>
mov    %rsi,%rdx
test   %rsi,%rsi
je     1142 <gcd+0x42>
mov    %rdi,%rax
jmp    112d <gcd+0x2d>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
cqto
idiv   %rcx
mov    %rcx,%rax
test   %rdx,%rdx
je     1142 <gcd+0x42>
mov    %rdx,%rcx
mov    %rax,%rdx
or     %rcx,%rdx
shr    $0x20,%rdx
jne    1120 <gcd+0x20>
xor    %edx,%edx
div    %ecx
jmp    1125 <gcd+0x25>
mov    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @gcd(i64 %0, i64 %1) {
%3 = alloca i32
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
store i64 %0, i64* %4
store i64 %1, i64* %5
%8 = load i64, i64* %4
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %2
%11 = load i64, i64* %4
%12 = trunc i64 %11 to i32
store i32 %12, i32* %3
br label %34
13: ; preds = %2
%14 = load i64, i64* %5
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %19
16: ; preds = %13
%17 = load i64, i64* %5
%18 = trunc i64 %17 to i32
store i32 %18, i32* %3
br label %34
19: ; preds = %13
br label %20
20: ; preds = %23, %19
%21 = load i64, i64* %5
%22 = icmp ne i64 %21, 0
br i1 %22, label %23, label %29
23: ; preds = %20
%24 = load i64, i64* %5
store i64 %24, i64* %6
%25 = load i64, i64* %4
%26 = load i64, i64* %5
%27 = srem i64 %25, %26
store i64 %27, i64* %5
%28 = load i64, i64* %6
store i64 %28, i64* %4
br label %20
29: ; preds = %20
br label %30
30: ; preds = %29
br label %31
31: ; preds = %30
%32 = load i64, i64* %4
%33 = trunc i64 %32 to i32
store i32 %33, i32* %3
br label %34
34: ; preds = %31, %16, %10
%35 = load i32, i32* %3
ret i32 %35
}

LLVM IR (-O2):
define i32 @gcd(i64 %0, i64 %1) {
%3 = icmp eq i64 %0, 0
%4 = icmp eq i64 %1, 0
%5 = or i1 %3, %4
br i1 %5, label %13, label %6
6: ; preds = %2, %6
%7 = phi i64 [ %8, %6 ], [ %0, %2 ]
%8 = phi i64 [ %9, %6 ], [ %1, %2 ]
%9 = srem i64 %7, %8
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %6
11: ; preds = %6
%12 = trunc i64 %8 to i32
br label %13
13: ; preds = %2, %11
%14 = phi i32 [ %12, %11 ], [ 0, %2 ]
ret i32 %14
}
/* Variables and functions */
int SIGUSR1;
int SIGUSR2;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
void signalHandler(int signo) {
  if (signo == SIGUSR1) {
    printf("\nReceived SIGUSR1 -> stop\n");
    exit(0);
  } else {
    if (signo == SIGUSR2) {
      printf("\nReceived SIGUSR1 -> stop\n");
    }
  }
  return;
}


x86 assembly (clang, -O0):
<signalHandler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    0x2eb3(%rip),%rcx
cmp    (%rcx),%eax
jne    1150 <signalHandler+0x30>
lea    0xebc(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>
mov    -0x4(%rbp),%eax
mov    0x2e7e(%rip),%rcx
cmp    (%rcx),%eax
jne    116e <signalHandler+0x4e>
lea    0xe97(%rip),%rdi
call   1030 <printf@plt>
jmp    1173 <signalHandler+0x53>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<signalHandler>:
push   %rax
mov    0x2ec0(%rip),%rax
cmp    %edi,(%rax)
je     1146 <signalHandler+0x26>
mov    0x2ea5(%rip),%rax
cmp    %edi,(%rax)
jne    1144 <signalHandler+0x24>
lea    0xec2(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>
pop    %rax
ret
lea    0xeb3(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@SIGUSR1 = global i32 0
@.str = [27 x i8] c"\0AReceived SIGUSR1 -> stop\0A\00"
@SIGUSR2 = global i32 0
define void @signalHandler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* @SIGUSR1
%5 = icmp eq i32 %3, %4
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @exit(i32 0)
unreachable
9: ; preds = %1
%10 = load i32, i32* %2
%11 = load i32, i32* @SIGUSR2
%12 = icmp eq i32 %10, %11
br i1 %12, label %13, label %15
13: ; preds = %9
%14 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
br label %15
15: ; preds = %13, %9
br label %16
16: ; preds = %15
ret void
}

LLVM IR (-O2):
@SIGUSR1 = global i32 0
@SIGUSR2 = global i32 0
@str.1 = [26 x i8] c"\0AReceived SIGUSR1 -> stop\00"
define void @signalHandler(i32 %0) {
%2 = load i32, i32* @SIGUSR1
%3 = icmp eq i32 %2, %0
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.1, i64 0, i64 0))
%6 = tail call i32 @exit(i32 0)
unreachable
7: ; preds = %1
%8 = load i32, i32* @SIGUSR2
%9 = icmp eq i32 %8, %0
br i1 %9, label %10, label %12
10: ; preds = %7
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.1, i64 0, i64 0))
br label %12
12: ; preds = %7, %10
ret void
}
/* Variables and functions */
int execve(char const *, char *const *, char **);
int /*<<< orphan*/ free_array(char **);
int /*<<< orphan*/ restore_dyld_insert_buffer(char *const *, char ***);
int p_execve(const char *path, char *const *argv, char *const *envp) {
  char **nenvp = NULL;
  restore_dyld_insert_buffer(envp, &nenvp);
  int result = execve(path, argv, nenvp);
  free_array(nenvp);
  return result;
}


x86 assembly (clang, -O0):
<p_execve>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1030 <restore_dyld_insert_buffer@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1050 <execve@plt>
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%rdi
call   1040 <free_array@plt>
mov    -0x24(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<p_execve>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
movq   $0x0,(%rsp)
mov    %rsp,%rsi
mov    %rdx,%rdi
call   1030 <restore_dyld_insert_buffer@plt>
mov    (%rsp),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <execve@plt>
mov    %eax,%ebx
mov    (%rsp),%rdi
call   1040 <free_array@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @p_execve(i8* %0, i8** %1, i8** %2) {
%4 = alloca i8*
%5 = alloca i8**
%6 = alloca i8**
%7 = alloca i8**
%8 = alloca i32
store i8* %0, i8** %4
store i8** %1, i8*** %5
store i8** %2, i8*** %6
store i8** null, i8*** %7
%9 = load i8**, i8*** %6
%10 = call i32 @restore_dyld_insert_buffer(i8** %9, i8*** %7)
%11 = load i8*, i8** %4
%12 = load i8**, i8*** %5
%13 = load i8**, i8*** %7
%14 = call i32 @execve(i8* %11, i8** %12, i8** %13)
store i32 %14, i32* %8
%15 = load i8**, i8*** %7
%16 = call i32 @free_array(i8** %15)
%17 = load i32, i32* %8
ret i32 %17
}

LLVM IR (-O2):
define i32 @p_execve(i8* %0, i8** %1, i8** %2) {
%4 = alloca i8**
%5 = bitcast i8*** %4 to i8*
store i8** null, i8*** %4
%6 = call i32 @restore_dyld_insert_buffer(i8** %2, i8*** %4)
%7 = load i8**, i8*** %4
%8 = call i32 @execve(i8* %0, i8** %1, i8** %7)
%9 = load i8**, i8*** %4
%10 = call i32 @free_array(i8** %9)
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ atasm_error(char *, int /*<<< orphan*/);
unsigned short get_expression(char *, int);
short get_immediate(char *str) {
  unsigned short v, i;
  v = get_expression(str, 1);
  i = v;
  if (i >> 8) {
    atasm_error("Immediate overflow", 0);
  }
  v = v & 0xff;
  return v;
}


x86 assembly (clang, -O0):
<get_immediate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x1,%esi
call   1040 <get_expression@plt>
mov    %ax,-0xa(%rbp)
mov    -0xa(%rbp),%ax
mov    %ax,-0xc(%rbp)
movzwl -0xc(%rbp),%eax
sar    $0x8,%eax
cmp    $0x0,%eax
je     1164 <get_immediate+0x44>
lea    0xea3(%rip),%rdi
xor    %esi,%esi
call   1030 <atasm_error@plt>
movzwl -0xa(%rbp),%eax
and    $0xff,%eax
mov    %ax,-0xa(%rbp)
movswl -0xa(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_immediate>:
push   %rbx
mov    $0x1,%esi
call   1040 <get_expression@plt>
mov    %eax,%ebx
movzwl %ax,%eax
cmp    $0x100,%eax
jb     1145 <get_immediate+0x25>
lea    0xec2(%rip),%rdi
xor    %esi,%esi
call   1030 <atasm_error@plt>
movzbl %bl,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [19 x i8] c"Immediate overflow\00"
define signext i16 @get_immediate(i8* %0) {
%2 = alloca i8*
%3 = alloca i16
%4 = alloca i16
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call zeroext i16 @get_expression(i8* %5, i32 1)
store i16 %6, i16* %3
%7 = load i16, i16* %3
store i16 %7, i16* %4
%8 = load i16, i16* %4
%9 = zext i16 %8 to i32
%10 = ashr i32 %9, 8
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %1
%13 = call i32 @atasm_error(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 0)
br label %14
14: ; preds = %12, %1
%15 = load i16, i16* %3
%16 = zext i16 %15 to i32
%17 = and i32 %16, 255
%18 = trunc i32 %17 to i16
store i16 %18, i16* %3
%19 = load i16, i16* %3
ret i16 %19
}

LLVM IR (-O2):
@.str = [19 x i8] c"Immediate overflow\00"
define signext i16 @get_immediate(i8* %0) {
%2 = tail call zeroext i16 @get_expression(i8* %0, i32 1)
%3 = icmp ult i16 %2, 256
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @atasm_error(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 0)
br label %6
6: ; preds = %4, %1
%7 = and i16 %2, 255
ret i16 %7
}
/* Variables and functions */
int /*<<< orphan*/ Cyc_Unify_unify(void *, void *);
int Cyc_Tcdecl_check_type(void *t0, void *t1) {
  return ({ Cyc_Unify_unify(t0, t1); });
}


x86 assembly (clang, -O0):
<Cyc_Tcdecl_check_type>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <Cyc_Unify_unify@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Cyc_Tcdecl_check_type>:
jmp    1030 <Cyc_Unify_unify@plt>

LLVM IR (-O0):
define i32 @Cyc_Tcdecl_check_type(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = load i8*, i8** %4
%8 = call i32 @Cyc_Unify_unify(i8* %6, i8* %7)
store i32 %8, i32* %5
%9 = load i32, i32* %5
ret i32 %9
}

LLVM IR (-O2):
define i32 @Cyc_Tcdecl_check_type(i8* %0, i8* %1) {
%3 = tail call i32 @Cyc_Unify_unify(i8* %0, i8* %1)
ret i32 %3
}
char *space2underscore(char *s) {
  char *p;
  for (p = s; '\0' != *p; p++)
    if (' ' == *p)
      *p = '_';
  return s;
}


x86 assembly (clang, -O0):
<space2underscore>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    %ecx,%eax
je     1152 <space2underscore+0x52>
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x20,%eax
cmp    %ecx,%eax
jne    113c <space2underscore+0x3c>
mov    -0x10(%rbp),%rax
movb   $0x5f,(%rax)
jmp    1141 <space2underscore+0x41>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1110 <space2underscore+0x10>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<space2underscore>:
mov    %rdi,%rax
mov    %rdi,%rcx
jmp    1117 <space2underscore+0x17>
nopl   0x0(%rax,%rax,1)
movb   $0x5f,(%rcx)
add    $0x1,%rcx
movzbl (%rcx),%edx
cmp    $0x20,%dl
je     1110 <space2underscore+0x10>
test   %dl,%dl
jne    1113 <space2underscore+0x13>
ret

LLVM IR (-O0):
define i8* @space2underscore(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
store i8* %4, i8** %3
br label %5
5: ; preds = %18, %1
%6 = load i8*, i8** %3
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = icmp ne i32 0, %8
br i1 %9, label %10, label %21
10: ; preds = %5
%11 = load i8*, i8** %3
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = icmp eq i32 32, %13
br i1 %14, label %15, label %17
15: ; preds = %10
%16 = load i8*, i8** %3
store i8 95, i8* %16
br label %17
17: ; preds = %15, %10
br label %18
18: ; preds = %17
%19 = load i8*, i8** %3
%20 = getelementptr inbounds i8, i8* %19, i32 1
store i8* %20, i8** %3
br label %5
21: ; preds = %5
%22 = load i8*, i8** %2
ret i8* %22
}

LLVM IR (-O2):
define i8* @space2underscore(i8* returned %0) {
br label %2
2: ; preds = %6, %1
%3 = phi i8* [ %0, %1 ], [ %7, %6 ]
%4 = load i8, i8* %3
switch i8 %4, label %6 [
i8 0, label %8
i8 32, label %5
]
5: ; preds = %2
store i8 95, i8* %3
br label %6
6: ; preds = %2, %5
%7 = getelementptr inbounds i8, i8* %3, i64 1
br label %2
8: ; preds = %2
ret i8* %0
}
int flt_move(a, b)
double *a;
double *b;
{
  ((unsigned int *)a)[0] = ((unsigned int *)b)[0];
  ((unsigned int *)a)[1] = ((unsigned int *)b)[1];
  return 1;
}


x86 assembly (clang, -O0):
<flt_move>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<flt_move>:
mov    (%rsi),%eax
mov    %eax,(%rdi)
mov    0x4(%rsi),%eax
mov    %eax,0x4(%rdi)
mov    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @flt_move(double* %0, double* %1) {
%3 = alloca double*
%4 = alloca double*
store double* %0, double** %3
store double* %1, double** %4
%5 = load double*, double** %4
%6 = bitcast double* %5 to i32*
%7 = getelementptr inbounds i32, i32* %6, i64 0
%8 = load i32, i32* %7
%9 = load double*, double** %3
%10 = bitcast double* %9 to i32*
%11 = getelementptr inbounds i32, i32* %10, i64 0
store i32 %8, i32* %11
%12 = load double*, double** %4
%13 = bitcast double* %12 to i32*
%14 = getelementptr inbounds i32, i32* %13, i64 1
%15 = load i32, i32* %14
%16 = load double*, double** %3
%17 = bitcast double* %16 to i32*
%18 = getelementptr inbounds i32, i32* %17, i64 1
store i32 %15, i32* %18
ret i32 1
}

LLVM IR (-O2):
define i32 @flt_move(double* nocapture writeonly %0, double* nocapture %1) {
%3 = bitcast double* %1 to i32*
%4 = load i32, i32* %3
%5 = bitcast double* %0 to i32*
store i32 %4, i32* %5
%6 = getelementptr inbounds i32, i32* %3, i64 1
%7 = load i32, i32* %6
%8 = getelementptr inbounds i32, i32* %5, i64 1
store i32 %7, i32* %8
ret i32 1
}
void setup_kdump_trampoline(void) { ; }


x86 assembly (clang, -O0):
<setup_kdump_trampoline>:
push   %rbp
mov    %rsp,%rbp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setup_kdump_trampoline>:
ret

LLVM IR (-O0):
define void @setup_kdump_trampoline() {
ret void
}

LLVM IR (-O2):
define void @setup_kdump_trampoline() {
ret void
}
int test_imm_A9uint8_reg(unsigned char val) {
  return ((val) & (-0xA9 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_A9uint8_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%edx
and    $0xffffff57,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_A9uint8_reg>:
test   $0x57,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_A9uint8_reg(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = and i32 %4, -169
%6 = icmp ne i32 %5, 0
%7 = zext i1 %6 to i64
%8 = select i1 %6, i32 -20, i32 -40
ret i32 %8
}

LLVM IR (-O2):
define i32 @test_imm_A9uint8_reg(i8 zeroext %0) {
%2 = and i8 %0, 87
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
void *malloc() { return 0; }


x86 assembly (clang, -O0):
<malloc>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<malloc>:
xor    %eax,%eax
ret

LLVM IR (-O0):
define i8* @malloc(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
ret i8* null
}

LLVM IR (-O2):
define noalias i8* @malloc(i64 %0) {
ret i8* null
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
void SMPHRelease(uint32_t ui32Semaphore) {

  ;
  (*((volatile unsigned long *)(0x40084000 + 0x00000000 + 4 * ui32Semaphore))) =
      0x00000001;
}


x86 assembly (clang, -O0):
<SMPHRelease>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x2,%eax
add    $0x40084000,%eax
cltq
movq   $0x1,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<SMPHRelease>:
movslq %edi,%rax
movq   $0x1,0x40084000(,%rax,4)
ret

LLVM IR (-O0):
define void @SMPHRelease(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = mul nsw i32 4, %3
%5 = add nsw i32 1074282496, %4
%6 = sext i32 %5 to i64
%7 = inttoptr i64 %6 to i64*
store volatile i64 1, i64* %7
ret void
}

LLVM IR (-O2):
define void @SMPHRelease(i32 %0) {
%2 = shl nsw i32 %0, 2
%3 = add nsw i32 %2, 1074282496
%4 = sext i32 %3 to i64
%5 = inttoptr i64 %4 to i64*
store volatile i64 1, i64* %5
ret void
}
/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, char *);
int main(int argc, char *argv[]) {
  char buf[64];
  sprintf(buf, "%s", argv[1]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x50(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xec7(%rip),%rsi
call   1030 <sprintf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
xor    %eax,%eax
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [64 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = getelementptr inbounds [64 x i8], [64 x i8]* %6, i64 0, i64 0
%8 = load i8**, i8*** %5
%9 = getelementptr inbounds i8*, i8** %8, i64 1
%10 = load i8*, i8** %9
%11 = call i32 @sprintf(i8* %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %10)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
ret i32 0
}
void CreateDumpFile() {}


x86 assembly (clang, -O0):
<CreateDumpFile>:
push   %rbp
mov    %rsp,%rbp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CreateDumpFile>:
ret

LLVM IR (-O0):
define void @CreateDumpFile() {
ret void
}

LLVM IR (-O2):
define void @CreateDumpFile() {
ret void
}