xunge/DecIR huggingface dataset:
/* Variables and functions */
int printf(char *, long, long);
int overflow(void) {
  long a, b = 0x567895;
  a = 0x567895 << 10;
  b = b << 10;
  return printf("%ld, %ld\n", a, b);
}


x86 assembly (clang, -O0):
<overflow>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movq   $0x567895,-0x10(%rbp)
movq   $0x59e25400,-0x8(%rbp)
59
mov    -0x10(%rbp),%rax
shl    $0xa,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
lea    0xebd(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<overflow>:
lea    0xee9(%rip),%rdi
movabs $0x159e25400,%rdx
mov    $0x59e25400,%esi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"%ld, %ld\0A\00"
define i32 @overflow() {
%1 = alloca i64
%2 = alloca i64
store i64 5666965, i64* %2
store i64 1508004864, i64* %1
%3 = load i64, i64* %2
%4 = shl i64 %3, 10
store i64 %4, i64* %2
%5 = load i64, i64* %1
%6 = load i64, i64* %2
%7 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i64 %5, i64 %6)
ret i32 %7
}

LLVM IR (-O2):
@.str = [10 x i8] c"%ld, %ld\0A\00"
define i32 @overflow() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i64 1508004864, i64 5802972160)
ret i32 %1
}
int my_strcmp(char *str1, char *str2) {
  while (*str1 == *str2) {
    if (!(*str1))
      return (0);
    str1++;
    str2++;
  }
  return (*str1 - *str2);
}


x86 assembly (clang, -O0):
<my_strcmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
mov    -0x18(%rbp),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
jne    1158 <my_strcmp+0x58>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
jne    113b <my_strcmp+0x3b>
movl   $0x0,-0x4(%rbp)
jmp    116b <my_strcmp+0x6b>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    110c <my_strcmp+0xc>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
mov    -0x18(%rbp),%rcx
movsbl (%rcx),%ecx
sub    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_strcmp>:
mov    (%rdi),%al
mov    (%rsi),%dl
cmp    %dl,%al
jne    1124 <my_strcmp+0x24>
mov    $0x1,%ecx
nopl   (%rax)
test   %al,%al
je     112d <my_strcmp+0x2d>
movzbl (%rdi,%rcx,1),%eax
movzbl (%rsi,%rcx,1),%edx
add    $0x1,%rcx
cmp    %dl,%al
je     1110 <my_strcmp+0x10>
movsbl %dl,%ecx
movsbl %al,%eax
sub    %ecx,%eax
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @my_strcmp(i8* nocapture %0, i8* nocapture %1) {
%3 = load i8, i8* %0
%4 = load i8, i8* %1
%5 = icmp eq i8 %3, %4
br i1 %5, label %6, label %17
6: ; preds = %2, %11
%7 = phi i8 [ %14, %11 ], [ %3, %2 ]
%8 = phi i8* [ %13, %11 ], [ %1, %2 ]
%9 = phi i8* [ %12, %11 ], [ %0, %2 ]
%10 = icmp eq i8 %7, 0
br i1 %10, label %23, label %11
11: ; preds = %6
%12 = getelementptr inbounds i8, i8* %9, i64 1
%13 = getelementptr inbounds i8, i8* %8, i64 1
%14 = load i8, i8* %12
%15 = load i8, i8* %13
%16 = icmp eq i8 %14, %15
br i1 %16, label %6, label %17
17: ; preds = %11, %2
%18 = phi i8 [ %3, %2 ], [ %14, %11 ]
%19 = phi i8 [ %4, %2 ], [ %15, %11 ]
%20 = sext i8 %19 to i32
%21 = sext i8 %18 to i32
%22 = sub nsw i32 %21, %20
br label %23
23: ; preds = %6, %17
%24 = phi i32 [ %22, %17 ], [ 0, %6 ]
ret i32 %24
}
int approved(char c) {
  if (c == '.' || c == ',' || c == '!' || c == ';')
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<approved>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x2e,%eax
je     113e <approved+0x3e>
movsbl -0x5(%rbp),%eax
cmp    $0x2c,%eax
je     113e <approved+0x3e>
movsbl -0x5(%rbp),%eax
cmp    $0x21,%eax
je     113e <approved+0x3e>
movsbl -0x5(%rbp),%eax
cmp    $0x3b,%eax
jne    114a <approved+0x4a>
movl   $0x0,-0x4(%rbp)
jmp    1151 <approved+0x51>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<approved>:
cmp    $0x3b,%dil
ja     111d <approved+0x1d>
xor    %eax,%eax
movzbl %dil,%ecx
movabs $0x800500200000000,%rdx
bt     %rcx,%rdx
jae    111d <approved+0x1d>
ret
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @approved(i8 signext %0) {
switch i8 %0, label %2 [
i8 59, label %3
i8 46, label %3
i8 44, label %3
i8 33, label %3
]
2: ; preds = %1
br label %3
3: ; preds = %1, %1, %1, %1, %2
%4 = phi i32 [ 1, %2 ], [ 0, %1 ], [ 0, %1 ], [ 0, %1 ], [ 0, %1 ]
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
void help(void) {
  puts("Usage:\n\n"
       "    nim [option]\n\n"
       "The parameter [option] can take one of the following values:\n\n"
       "    info        - displays some information about the game.\n"
       "    help        - outputs this help command\n"
       "    play [type] - starts a game of Terminal Nim with specified "
       "opponent type.\n"
       "                  Accepted values are 'ai' and 'human'\n"
       "    rules       - displays a rulebook that teaches you the rules of "
       "Nim.");
}


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

x86 assembly (clang, -O2):
<help>:
lea    0xee9(%rip),%rdi
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [398 x i8] c"Usage:\0A\0A nim [option]\0A\0AThe parameter [option] can take one of the following values:\0A\0A info - displays some information about the game.\0A help - outputs this help command\0A play [type] - starts a game of Terminal Nim with specified opponent type.\0A Accepted values are 'ai' and 'human'\0A rules - displays a rulebook that teaches you the rules of Nim.\00"
define void @help() {
%1 = call i32 @puts(i8* getelementptr inbounds ([398 x i8], [398 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [398 x i8] c"Usage:\0A\0A nim [option]\0A\0AThe parameter [option] can take one of the following values:\0A\0A info - displays some information about the game.\0A help - outputs this help command\0A play [type] - starts a game of Terminal Nim with specified opponent type.\0A Accepted values are 'ai' and 'human'\0A rules - displays a rulebook that teaches you the rules of Nim.\00"
define void @help() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([398 x i8], [398 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
scalar_t__ malloc(size_t);
char *strcpy(char *, char const *);
size_t strlen(char const *);
char *mm_strdup(const char *s) {
  size_t len = strlen(s);
  char *s2 = (char *)malloc((len + 1) * sizeof(char));
  return strcpy(s2, s);
}


x86 assembly (clang, -O0):
<mm_strdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
add    $0x1,%rdi
shl    $0x0,%rdi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mm_strdup>:
push   %rbx
mov    %rdi,%rbx
call   1040 <strlen@plt>
lea    0x1(%rax),%rdi
call   1050 <malloc@plt>
mov    %rax,%rdi
mov    %rbx,%rsi
pop    %rbx
jmp    1030 <strcpy@plt>

LLVM IR (-O0):
define i8* @mm_strdup(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i8*
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i64 @strlen(i8* %5)
store i64 %6, i64* %3
%7 = load i64, i64* %3
%8 = add i64 %7, 1
%9 = mul i64 %8, 1
%10 = call i64 @malloc(i64 %9)
%11 = inttoptr i64 %10 to i8*
store i8* %11, i8** %4
%12 = load i8*, i8** %4
%13 = load i8*, i8** %2
%14 = call i8* @strcpy(i8* %12, i8* %13)
ret i8* %14
}

LLVM IR (-O2):
define i8* @mm_strdup(i8* nocapture %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = add i64 %2, 1
%4 = tail call i64 @malloc(i64 %3)
%5 = inttoptr i64 %4 to i8*
%6 = tail call i8* @strcpy(i8* dereferenceable(1) %5, i8* dereferenceable(1) %0)
ret i8* %5
}
/* Variables and functions */
int /*<<< orphan*/ free_string(char *);
void am_free_string(char *s) { free_string(s); }


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

x86 assembly (clang, -O2):
<am_free_string>:
jmp    1030 <free_string@plt>

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

LLVM IR (-O2):
define void @am_free_string(i8* %0) {
%2 = tail call i32 @free_string(i8* %0)
ret void
}
int mc_enable_large_pages(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @mc_enable_large_pages() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exibeMenuAnt(int);
int /*<<< orphan*/ printf(char *);
void menu6(int at) {
  exibeMenuAnt(at);
  printf("ATUAL: 6\n");
}


x86 assembly (clang, -O0):
<menu6>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <exibeMenuAnt@plt>
lea    0xec6(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<menu6>:
push   %rax
call   1040 <exibeMenuAnt@plt>
lea    0xed3(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"ATUAL: 6\0A\00"
define void @menu6(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @exibeMenuAnt(i32 %3)
%5 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [9 x i8] c"ATUAL: 6\00"
define void @menu6(i32 %0) {
%2 = tail call i32 @exibeMenuAnt(i32 %0)
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ strcmp(char *, char *);
int is_quit(char cmd[30]) {
  if (!strcmp(cmd, "quit\n"))
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<is_quit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xed9(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    1141 <is_quit+0x31>
movl   $0x1,-0x4(%rbp)
jmp    1148 <is_quit+0x38>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_quit>:
push   %rax
lea    0xee8(%rip),%rsi
call   1030 <strcmp@plt>
xor    %ecx,%ecx
test   %eax,%eax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"quit\0A\00"
define i32 @is_quit(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = call i32 @strcmp(i8* %4, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%6 = icmp ne i32 %5, 0
br i1 %6, label %8, label %7
7: ; preds = %1
store i32 1, i32* %2
br label %9
8: ; preds = %1
store i32 0, i32* %2
br label %9
9: ; preds = %8, %7
%10 = load i32, i32* %2
ret i32 %10
}

LLVM IR (-O2):
@.str = [6 x i8] c"quit\0A\00"
define i32 @is_quit(i8* nocapture %0) {
%2 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i32 %2, 0
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
float sqrtf(float);
float __glsl_sqrt(float x) { return sqrtf(x); }


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

x86 assembly (clang, -O2):
<__glsl_sqrt>:
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jb     111d <__glsl_sqrt+0xd>
sqrtss %xmm0,%xmm0
ret
jmp    1030 <sqrtf@plt>

LLVM IR (-O0):
define float @__glsl_sqrt(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = call float @sqrtf(float %3)
ret float %4
}

LLVM IR (-O2):
define float @__glsl_sqrt(float %0) {
%2 = tail call float @sqrtf(float %0)
ret float %2
}
void posix_class_neg2NP_WORD() {}


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

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

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

LLVM IR (-O2):
define void @posix_class_neg2NP_WORD() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fputsn(int, char *, int);
int print_to_base(int, char *, int);
int print_dec(int fd, int n) {
  int count;
  char buffer[20] = {0};
  count = print_to_base(n, buffer, 10);
  fputsn(fd, buffer, count);
  return count;
}


x86 assembly (clang, -O0):
<print_dec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
lea    -0x20(%rbp),%rdi
xor    %esi,%esi
mov    $0x14,%edx
call   1040 <memset@plt>
mov    -0x8(%rbp),%edi
lea    -0x20(%rbp),%rsi
mov    $0xa,%edx
call   1050 <print_to_base@plt>
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x20(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1030 <fputsn@plt>
mov    -0xc(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_dec>:
push   %rbp
push   %r14
push   %rbx
sub    $0x20,%rsp
mov    %edi,%ebx
xorps  %xmm0,%xmm0
movaps %xmm0,(%rsp)
movl   $0x0,0x10(%rsp)
mov    %rsp,%r14
mov    %esi,%edi
mov    %r14,%rsi
mov    $0xa,%edx
call   1040 <print_to_base@plt>
mov    %eax,%ebp
mov    %ebx,%edi
mov    %r14,%rsi
mov    %eax,%edx
call   1030 <fputsn@plt>
mov    %ebp,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @print_dec(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca [20 x i8]
store i32 %0, i32* %3
store i32 %1, i32* %4
%7 = bitcast [20 x i8]* %6 to i8*
%8 = load i32, i32* %4
%9 = getelementptr inbounds [20 x i8], [20 x i8]* %6, i64 0, i64 0
%10 = call i32 @print_to_base(i32 %8, i8* %9, i32 10)
store i32 %10, i32* %5
%11 = load i32, i32* %3
%12 = getelementptr inbounds [20 x i8], [20 x i8]* %6, i64 0, i64 0
%13 = load i32, i32* %5
%14 = call i32 @fputsn(i32 %11, i8* %12, i32 %13)
%15 = load i32, i32* %5
ret i32 %15
}

LLVM IR (-O2):
define i32 @print_dec(i32 %0, i32 %1) {
%3 = alloca [20 x i8]
%4 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%5 = call i32 @print_to_base(i32 %1, i8* %4, i32 10)
%6 = call i32 @fputsn(i32 %0, i8* %4, i32 %5)
ret i32 %5
}
long get_new_task_id() { return *(long *)((0x100000410)); }


x86 assembly (clang, -O0):
<get_new_task_id>:
push   %rbp
mov    %rsp,%rbp
movabs $0x100000410,%rax
mov    (%rax),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_new_task_id>:
movabs $0x100000410,%rax
mov    (%rax),%rax
ret

LLVM IR (-O0):
define i64 @get_new_task_id() {
%1 = load i64, i64* inttoptr (i64 4294968336 to i64*)
ret i64 %1
}

LLVM IR (-O2):
define i64 @get_new_task_id() {
%1 = load i64, i64* inttoptr (i64 4294968336 to i64*)
ret i64 %1
}
/* Variables and functions */
int /*<<< orphan*/ atomic_thread_fence(int /*<<< orphan*/);
int /*<<< orphan*/ memory_order_seq_cst;
void nbc_thread_fence_seqcst() { atomic_thread_fence(memory_order_seq_cst); }


x86 assembly (clang, -O0):
<nbc_thread_fence_seqcst>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ecd(%rip),%rax
mov    (%rax),%edi
call   1030 <atomic_thread_fence@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<nbc_thread_fence_seqcst>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%edi
jmp    1030 <atomic_thread_fence@plt>

LLVM IR (-O0):
@memory_order_seq_cst = global i32 0
define void @nbc_thread_fence_seqcst() {
%1 = load i32, i32* @memory_order_seq_cst
%2 = call i32 @atomic_thread_fence(i32 %1)
ret void
}

LLVM IR (-O2):
@memory_order_seq_cst = global i32 0
define void @nbc_thread_fence_seqcst() {
%1 = load i32, i32* @memory_order_seq_cst
%2 = tail call i32 @atomic_thread_fence(i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ajouterMessageZoneInformation(char *, int);
int /*<<< orphan*/ sauvegarderNiveauActuel();
void sauvegarderNiveau(void) {
  sauvegarderNiveauActuel();
  ajouterMessageZoneInformation("Sauvegarde terminee...", 32);
}


x86 assembly (clang, -O0):
<sauvegarderNiveau>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <sauvegarderNiveauActuel@plt>
lea    0xece(%rip),%rdi
mov    $0x20,%esi
call   1030 <ajouterMessageZoneInformation@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<sauvegarderNiveau>:
push   %rax
xor    %eax,%eax
call   1040 <sauvegarderNiveauActuel@plt>
lea    0xed1(%rip),%rdi
mov    $0x20,%esi
pop    %rax
jmp    1030 <ajouterMessageZoneInformation@plt>

LLVM IR (-O0):
@.str = [23 x i8] c"Sauvegarde terminee...\00"
define void @sauvegarderNiveau() {
%1 = call i32 (...) @sauvegarderNiveauActuel()
%2 = call i32 @ajouterMessageZoneInformation(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 32)
ret void
}

LLVM IR (-O2):
@.str = [23 x i8] c"Sauvegarde terminee...\00"
define void @sauvegarderNiveau() {
%1 = tail call i32 (...) @sauvegarderNiveauActuel()
%2 = tail call i32 @ajouterMessageZoneInformation(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 32)
ret void
}
/* Variables and functions */
scalar_t__ convertBCD(int, unsigned int);
unsigned int CHAR2BCD3(unsigned int input) {
  return (unsigned int)convertBCD(2, input);
}


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

x86 assembly (clang, -O2):
<CHAR2BCD3>:
mov    %edi,%esi
mov    $0x2,%edi
jmp    1030 <convertBCD@plt>

LLVM IR (-O0):
define i32 @CHAR2BCD3(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i64 @convertBCD(i32 2, i32 %3)
%5 = trunc i64 %4 to i32
ret i32 %5
}

LLVM IR (-O2):
define i32 @CHAR2BCD3(i32 %0) {
%2 = tail call i64 @convertBCD(i32 2, i32 %0)
%3 = trunc i64 %2 to i32
ret i32 %3
}
void rop3_94_1_0(unsigned char *D, unsigned char S, unsigned char T) {
  unsigned char stk1;
  unsigned char stk2;
  unsigned char stk3;
  unsigned char stk4;
  stk4 = ~*D;
  stk3 = S & stk4;
  stk2 = T | stk3;
  stk1 = *D ^ stk2;
  *D = (stk1 & (~S)) | (*D & S);
}


x86 assembly (clang, -O0):
<rop3_94_1_0>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
xor    $0xffffffff,%eax
mov    %al,-0xe(%rbp)
movzbl -0x9(%rbp),%eax
movzbl -0xe(%rbp),%ecx
and    %ecx,%eax
mov    %al,-0xd(%rbp)
movzbl -0xa(%rbp),%eax
movzbl -0xd(%rbp),%ecx
or     %ecx,%eax
mov    %al,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
movzbl -0xc(%rbp),%ecx
xor    %ecx,%eax
mov    %al,-0xb(%rbp)
movzbl -0xb(%rbp),%eax
movzbl -0x9(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl (%rcx),%ecx
movzbl -0x9(%rbp),%edx
and    %edx,%ecx
or     %ecx,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<rop3_94_1_0>:
mov    (%rdi),%al
mov    %eax,%ecx
not    %cl
and    %sil,%cl
or     %dl,%cl
xor    %al,%cl
xor    %cl,%al
and    %sil,%al
xor    %cl,%al
mov    %al,(%rdi)
ret

LLVM IR (-O0):
define void @rop3_94_1_0(i8* %0, i8 zeroext %1, i8 zeroext %2) {
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8
%8 = alloca i8
%9 = alloca i8
%10 = alloca i8
store i8* %0, i8** %4
store i8 %1, i8* %5
store i8 %2, i8* %6
%11 = load i8*, i8** %4
%12 = load i8, i8* %11
%13 = zext i8 %12 to i32
%14 = xor i32 %13, -1
%15 = trunc i32 %14 to i8
store i8 %15, i8* %10
%16 = load i8, i8* %5
%17 = zext i8 %16 to i32
%18 = load i8, i8* %10
%19 = zext i8 %18 to i32
%20 = and i32 %17, %19
%21 = trunc i32 %20 to i8
store i8 %21, i8* %9
%22 = load i8, i8* %6
%23 = zext i8 %22 to i32
%24 = load i8, i8* %9
%25 = zext i8 %24 to i32
%26 = or i32 %23, %25
%27 = trunc i32 %26 to i8
store i8 %27, i8* %8
%28 = load i8*, i8** %4
%29 = load i8, i8* %28
%30 = zext i8 %29 to i32
%31 = load i8, i8* %8
%32 = zext i8 %31 to i32
%33 = xor i32 %30, %32
%34 = trunc i32 %33 to i8
store i8 %34, i8* %7
%35 = load i8, i8* %7
%36 = zext i8 %35 to i32
%37 = load i8, i8* %5
%38 = zext i8 %37 to i32
%39 = xor i32 %38, -1
%40 = and i32 %36, %39
%41 = load i8*, i8** %4
%42 = load i8, i8* %41
%43 = zext i8 %42 to i32
%44 = load i8, i8* %5
%45 = zext i8 %44 to i32
%46 = and i32 %43, %45
%47 = or i32 %40, %46
%48 = trunc i32 %47 to i8
%49 = load i8*, i8** %4
store i8 %48, i8* %49
ret void
}

LLVM IR (-O2):
define void @rop3_94_1_0(i8* nocapture %0, i8 zeroext %1, i8 zeroext %2) {
%4 = load i8, i8* %0
%5 = xor i8 %4, -1
%6 = and i8 %5, %1
%7 = or i8 %6, %2
%8 = xor i8 %7, %4
%9 = xor i8 %1, -1
%10 = and i8 %8, %9
%11 = and i8 %4, %1
%12 = or i8 %10, %11
store i8 %12, i8* %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ return_union_hom_fp_partial();
int /*<<< orphan*/ take_union_hom_fp_partial(int /*<<< orphan*/);
void test_union_hom_fp_partial() {
  take_union_hom_fp_partial(return_union_hom_fp_partial());
}


x86 assembly (clang, -O0):
<test_union_hom_fp_partial>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <return_union_hom_fp_partial@plt>
mov    %eax,%edi
call   1040 <take_union_hom_fp_partial@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_union_hom_fp_partial>:
push   %rax
xor    %eax,%eax
call   1030 <return_union_hom_fp_partial@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <take_union_hom_fp_partial@plt>

LLVM IR (-O0):
define void @test_union_hom_fp_partial() {
%1 = call i32 (...) @return_union_hom_fp_partial()
%2 = call i32 @take_union_hom_fp_partial(i32 %1)
ret void
}

LLVM IR (-O2):
define void @test_union_hom_fp_partial() {
%1 = tail call i32 (...) @return_union_hom_fp_partial()
%2 = tail call i32 @take_union_hom_fp_partial(i32 %1)
ret void
}
/* Variables and functions */
char busy_check();
int /*<<< orphan*/ printf(char *);
char complete(void) {
  printf("Wait Complete\n");
  while (busy_check() == 0xff)
    ;
  return busy_check();
}


x86 assembly (clang, -O0):
<complete>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <busy_check@plt>
movsbl %al,%eax
cmp    $0xff,%eax
jne    114a <complete+0x2a>
jmp    1130 <complete+0x10>
mov    $0x0,%al
call   1040 <busy_check@plt>
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<complete>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1040 <busy_check@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <busy_check@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"Wait Complete\0A\00"
define signext i8 @complete() {
%1 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
br label %2
2: ; preds = %6, %0
%3 = call signext i8 (...) @busy_check()
%4 = sext i8 %3 to i32
%5 = icmp eq i32 %4, 255
br i1 %5, label %6, label %7
6: ; preds = %2
br label %2
7: ; preds = %2
%8 = call signext i8 (...) @busy_check()
ret i8 %8
}

LLVM IR (-O2):
@str = [14 x i8] c"Wait Complete\00"
define signext i8 @complete() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
%2 = tail call signext i8 (...) @busy_check()
%3 = tail call signext i8 (...) @busy_check()
ret i8 %3
}
void lidt(void *ptr) { __asm__ __volatile__("lidt (%0)" : : "r"(ptr)); }


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

x86 assembly (clang, -O2):
<lidt>:
lidt   (%rdi)
ret

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

LLVM IR (-O2):
define void @lidt(i8* %0) {
tail call void asm sideeffect "lidt ($0)", "r,~{dirflag},~{fpsr},~{flags}"(i8* %0)
ret void
}
/* Variables and functions */
size_t am_matrix_idx(size_t row, size_t col, size_t col_c) {
  return row * col_c + col;
}


x86 assembly (clang, -O0):
<am_matrix_idx>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
imul   -0x18(%rbp),%rax
add    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<am_matrix_idx>:
imul   %rdx,%rdi
lea    (%rdi,%rsi,1),%rax
ret

LLVM IR (-O0):
define i64 @am_matrix_idx(i64 %0, i64 %1, i64 %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
store i64 %0, i64* %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%7 = load i64, i64* %4
%8 = load i64, i64* %6
%9 = mul i64 %7, %8
%10 = load i64, i64* %5
%11 = add i64 %9, %10
ret i64 %11
}

LLVM IR (-O2):
define i64 @am_matrix_idx(i64 %0, i64 %1, i64 %2) {
%4 = mul i64 %2, %0
%5 = add i64 %4, %1
ret i64 %5
}
double fgrt(double a, double b) { return a > b; }


x86 assembly (clang, -O0):
<fgrt>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
ucomisd -0x10(%rbp),%xmm0
seta   %al
and    $0x1,%al
movzbl %al,%eax
cvtsi2sd %eax,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<fgrt>:
cmpltsd %xmm0,%xmm1
movsd  0xef3(%rip),%xmm0
andpd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @fgrt(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %4
%7 = fcmp ogt double %5, %6
%8 = zext i1 %7 to i32
%9 = sitofp i32 %8 to double
ret double %9
}

LLVM IR (-O2):
define double @fgrt(double %0, double %1) {
%3 = fcmp ogt double %0, %1
%4 = uitofp i1 %3 to double
ret double %4
}
/* Variables and functions */
char *getenv(char *);
int /*<<< orphan*/ printf(char *, char *);
int main(void) {
  char *myenv = getenv("EDITOR");
  printf("The editor environement is set to %s\n", myenv);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xebd(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <getenv@plt>
lea    0xed3(%rip),%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [7 x i8] c"EDITOR\00"
@.str.1 = [38 x i8] c"The editor environement is set to %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
store i32 0, i32* %1
%3 = call i8* @getenv(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
store i8* %3, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i8* %4)
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c"EDITOR\00"
@.str.1 = [38 x i8] c"The editor environement is set to %s\0A\00"
define i32 @main() {
%1 = tail call i8* @getenv(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i8* %1)
ret i32 0
}
int Min(int i, int j) {
  if (i < j)
    return i;
  return j;
}


x86 assembly (clang, -O0):
<Min>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1121 <Min+0x21>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1127 <Min+0x27>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Min>:
mov    %esi,%eax
cmp    %esi,%edi
cmovl  %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @Min(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, %1
%4 = select i1 %3, i32 %0, i32 %1
ret i32 %4
}
unsigned int f51(unsigned int x, int y __attribute__((unused))) {
  return (x << ((-1) & (8 * 4 - 1))) ^ (x >> 1);
}


x86 assembly (clang, -O0):
<f51>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x1f,%eax
mov    -0x4(%rbp),%ecx
shr    $0x1,%ecx
xor    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f51>:
mov    %edi,%eax
ror    %eax
ret

LLVM IR (-O0):
define i32 @f51(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = shl i32 %5, 31
%7 = load i32, i32* %3
%8 = lshr i32 %7, 1
%9 = xor i32 %6, %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @f51(i32 %0, i32 %1) {
%3 = tail call i32 @llvm.fshl.i32(i32 %0, i32 %0, i32 31)
ret i32 %3
}
int test_imm_AFint16_reg(short val) {
  return ((val) & (0xAF << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_AFint16_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%edx
and    $0xaf,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @test_imm_AFint16_reg(i16 signext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = sext i16 %3 to i32
%5 = and i32 %4, 175
%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_AFint16_reg(i16 signext %0) {
%2 = and i16 %0, 175
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
int NOT(int a) {
  int output = ~a;
  return output;
}


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

x86 assembly (clang, -O2):
<NOT>:
mov    %edi,%eax
not    %eax
ret

LLVM IR (-O0):
define i32 @NOT(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = xor i32 %4, -1
store i32 %5, i32* %3
%6 = load i32, i32* %3
ret i32 %6
}

LLVM IR (-O2):
define i32 @NOT(i32 %0) {
%2 = xor i32 %0, -1
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void print_help(int argc, char **argv) {
  fprintf(stderr, "USAGE: %s <hostname> <port>\n", argv[0]);
}


x86 assembly (clang, -O0):
<print_help>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2eba(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xeca(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_help>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
mov    (%rsi),%rdx
lea    0xedd(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [29 x i8] c"USAGE: %s <hostname> <port>\0A\00"
define void @print_help(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = load i32, i32* @stderr
%6 = load i8**, i8*** %4
%7 = getelementptr inbounds i8*, i8** %6, i64 0
%8 = load i8*, i8** %7
%9 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %8)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [29 x i8] c"USAGE: %s <hostname> <port>\0A\00"
define void @print_help(i32 %0, i8** nocapture %1) {
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %1
%5 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %4)
ret void
}
/* Type definitions */
typedef scalar_t__ pid_t;

/* Variables and functions */
scalar_t__ getsid(scalar_t__);
scalar_t__ pidfile_getpid(char const *);
pid_t pidfile_getsid(const char *path) {
  pid_t pid = pidfile_getpid(path);
  if (pid > 0) {
    return getsid(pid);
  }
  return 0;
}


x86 assembly (clang, -O0):
<pidfile_getsid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <pidfile_getpid@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jle    1156 <pidfile_getsid+0x36>
mov    -0x18(%rbp),%rdi
call   1030 <getsid@plt>
mov    %rax,-0x8(%rbp)
jmp    115e <pidfile_getsid+0x3e>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pidfile_getsid>:
push   %rax
call   1040 <pidfile_getpid@plt>
test   %rax,%rax
jle    1134 <pidfile_getsid+0x14>
mov    %rax,%rdi
pop    %rax
jmp    1030 <getsid@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i64 @pidfile_getsid(i8* %0) {
%2 = alloca i64
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i64 @pidfile_getpid(i8* %5)
store i64 %6, i64* %4
%7 = load i64, i64* %4
%8 = icmp sgt i64 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %1
%10 = load i64, i64* %4
%11 = call i64 @getsid(i64 %10)
store i64 %11, i64* %2
br label %13
12: ; preds = %1
store i64 0, i64* %2
br label %13
13: ; preds = %12, %9
%14 = load i64, i64* %2
ret i64 %14
}

LLVM IR (-O2):
define i64 @pidfile_getsid(i8* %0) {
%2 = tail call i64 @pidfile_getpid(i8* %0)
%3 = icmp sgt i64 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i64 @getsid(i64 %2)
br label %6
6: ; preds = %1, %4
%7 = phi i64 [ %5, %4 ], [ 0, %1 ]
ret i64 %7
}
void serial_putc(char c) {
  __asm__("mov $0x01, %%eax" ::"b"(c));
  __asm__("int $0x86");
}


x86 assembly (clang, -O0):
<serial_putc>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
mov    %dil,%al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%bl
mov    $0x1,%eax
int    $0x86
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<serial_putc>:
push   %rbx
mov    %edi,%ebx
mov    $0x1,%eax
int    $0x86
pop    %rbx
ret

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

LLVM IR (-O2):
define void @serial_putc(i8 signext %0) {
tail call void asm sideeffect "mov $$0x01, %eax", "{bx},~{dirflag},~{fpsr},~{flags}"(i8 %0)
tail call void asm sideeffect "int $$0x86", "~{dirflag},~{fpsr},~{flags}"()
ret void
}
void PWM_SET_GATE(void *pwm_address, unsigned int gate) {
  *((volatile int *)pwm_address + 3) = gate;
}


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

x86 assembly (clang, -O2):
<PWM_SET_GATE>:
mov    %esi,0xc(%rdi)
ret

LLVM IR (-O0):
define void @PWM_SET_GATE(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 = load i8*, i8** %3
%7 = bitcast i8* %6 to i32*
%8 = getelementptr inbounds i32, i32* %7, i64 3
store volatile i32 %5, i32* %8
ret void
}

LLVM IR (-O2):
define void @PWM_SET_GATE(i8* %0, i32 %1) {
%3 = getelementptr inbounds i8, i8* %0, i64 12
%4 = bitcast i8* %3 to i32*
store volatile i32 %1, i32* %4
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int in_range(int /*<<< orphan*/ const, int /*<<< orphan*/, char);
bool is_digit(const uint8_t c) { return in_range(c, '0', '9'); }


x86 assembly (clang, -O0):
<is_digit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x30,%esi
mov    $0x39,%edx
call   1030 <in_range@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_digit>:
mov    $0x30,%esi
mov    $0x39,%edx
jmp    1030 <in_range@plt>

LLVM IR (-O0):
define i32 @is_digit(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @in_range(i32 %3, i32 48, i8 signext 57)
ret i32 %4
}

LLVM IR (-O2):
define i32 @is_digit(i32 %0) {
%2 = tail call i32 @in_range(i32 %0, i32 48, i8 signext 57)
ret i32 %2
}
int do_nothing(int x) { return x; }


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

x86 assembly (clang, -O2):
<do_nothing>:
mov    %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @do_nothing(i32 returned %0) {
ret i32 %0
}
float floatAdd(float a, float b) { return a + b; }


x86 assembly (clang, -O0):
<floatAdd>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
addss  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<floatAdd>:
addss  %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @floatAdd(float %0, float %1) {
%3 = alloca float
%4 = alloca float
store float %0, float* %3
store float %1, float* %4
%5 = load float, float* %3
%6 = load float, float* %4
%7 = fadd float %5, %6
ret float %7
}

LLVM IR (-O2):
define float @floatAdd(float %0, float %1) {
%3 = fadd float %0, %1
ret float %3
}
/* Type definitions */
typedef int /*<<< orphan*/ EVP_CIPHER;

/* Variables and functions */
int /*<<< orphan*/ const *EVP_cast5_cfb64();
const EVP_CIPHER *EVP_cast5_cfb(void) { return EVP_cast5_cfb64(); }


x86 assembly (clang, -O0):
<EVP_cast5_cfb>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <EVP_cast5_cfb64@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<EVP_cast5_cfb>:
xor    %eax,%eax
jmp    1030 <EVP_cast5_cfb64@plt>

LLVM IR (-O0):
define i32* @EVP_cast5_cfb() {
%1 = call i32* (...) @EVP_cast5_cfb64()
ret i32* %1
}

LLVM IR (-O2):
define i32* @EVP_cast5_cfb() {
%1 = tail call i32* (...) @EVP_cast5_cfb64()
ret i32* %1
}
void caller_2_2_2_1_1_2_2() {}


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

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

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

LLVM IR (-O2):
define void @caller_2_2_2_1_1_2_2() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ LEDOutput(int);
int /*<<< orphan*/ delay(int);
int /*<<< orphan*/ set_rclk(int);
void MatrixLedDspAll() {
  LEDOutput(0x00 | ~(0x346B));
  set_rclk(0);
  delay((0x01));
  set_rclk(1);
  delay((0x01));
}


x86 assembly (clang, -O0):
<MatrixLedDspAll>:
push   %rbp
mov    %rsp,%rbp
mov    $0xffffcb94,%edi
call   1050 <LEDOutput@plt>
xor    %edi,%edi
call   1040 <set_rclk@plt>
mov    $0x1,%edi
call   1030 <delay@plt>
mov    $0x1,%edi
call   1040 <set_rclk@plt>
mov    $0x1,%edi
call   1030 <delay@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<MatrixLedDspAll>:
push   %rax
mov    $0xffffcb94,%edi
call   1050 <LEDOutput@plt>
xor    %edi,%edi
call   1040 <set_rclk@plt>
mov    $0x1,%edi
call   1030 <delay@plt>
mov    $0x1,%edi
call   1040 <set_rclk@plt>
mov    $0x1,%edi
pop    %rax
jmp    1030 <delay@plt>

LLVM IR (-O0):
define void @MatrixLedDspAll() {
%1 = call i32 @LEDOutput(i32 -13420)
%2 = call i32 @set_rclk(i32 0)
%3 = call i32 @delay(i32 1)
%4 = call i32 @set_rclk(i32 1)
%5 = call i32 @delay(i32 1)
ret void
}

LLVM IR (-O2):
define void @MatrixLedDspAll() {
%1 = tail call i32 @LEDOutput(i32 -13420)
%2 = tail call i32 @set_rclk(i32 0)
%3 = tail call i32 @delay(i32 1)
%4 = tail call i32 @set_rclk(i32 1)
%5 = tail call i32 @delay(i32 1)
ret void
}
/* Variables and functions */
int make_sum(int, int);
int /*<<< orphan*/ printf(char *, int);
int main(void) { printf("Summe von 9 und 21 ist %d\n", make_sum(9, 21)); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x9,%edi
mov    $0x15,%esi
call   1040 <make_sum@plt>
mov    %eax,%esi
lea    0xec4(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x9,%edi
mov    $0x15,%esi
call   1040 <make_sum@plt>
lea    0xec9(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [27 x i8] c"Summe von 9 und 21 ist %d\0A\00"
define i32 @main() {
%1 = call i32 @make_sum(i32 9, i32 21)
%2 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}

LLVM IR (-O2):
@.str = [27 x i8] c"Summe von 9 und 21 ist %d\0A\00"
define i32 @main() {
%1 = tail call i32 @make_sum(i32 9, i32 21)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
/* Type definitions */
struct buddy_list {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ buddy_list_del(struct buddy_list *);
int /*<<< orphan*/ buddy_list_init(struct buddy_list *);
void buddy_list_del_init(struct buddy_list *head) {
  buddy_list_del(head);
  buddy_list_init(head);
}


x86 assembly (clang, -O0):
<buddy_list_del_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <buddy_list_del@plt>
mov    -0x8(%rbp),%rdi
call   1030 <buddy_list_init@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<buddy_list_del_init>:
push   %rbx
mov    %rdi,%rbx
call   1040 <buddy_list_del@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <buddy_list_init@plt>

LLVM IR (-O0):
%struct.buddy_list = type { i32 }
define void @buddy_list_del_init(%struct.buddy_list* %0) {
%2 = alloca %struct.buddy_list*
store %struct.buddy_list* %0, %struct.buddy_list** %2
%3 = load %struct.buddy_list*, %struct.buddy_list** %2
%4 = call i32 @buddy_list_del(%struct.buddy_list* %3)
%5 = load %struct.buddy_list*, %struct.buddy_list** %2
%6 = call i32 @buddy_list_init(%struct.buddy_list* %5)
ret void
}

LLVM IR (-O2):
%struct.buddy_list = type { i32 }
define void @buddy_list_del_init(%struct.buddy_list* %0) {
%2 = tail call i32 @buddy_list_del(%struct.buddy_list* %0)
%3 = tail call i32 @buddy_list_init(%struct.buddy_list* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int fork();
int /*<<< orphan*/ perror(char *);
void stub1();
void fork_prog(void (*prog)(void)) {
  switch (fork()) {
  case 0:
    (prog)();
    exit(0);
  case -1:
    perror("fork()");
    exit(1);
  default:
    break;
  }
}


x86 assembly (clang, -O0):
<fork_prog>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
xor    %eax,%eax
call   1050 <fork@plt>
mov    %eax,%ecx
mov    %ecx,-0xc(%rbp)
sub    $0xffffffff,%eax
je     1170 <fork_prog+0x40>
jmp    1156 <fork_prog+0x26>
mov    -0xc(%rbp),%eax
test   %eax,%eax
jne    1186 <fork_prog+0x56>
jmp    1166 <fork_prog+0x36>
call   *-0x8(%rbp)
xor    %edi,%edi
call   1040 <exit@plt>
lea    0xe89(%rip),%rdi
call   1030 <perror@plt>
mov    $0x1,%edi
call   1040 <exit@plt>
jmp    118b <fork_prog+0x5b>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fork_prog>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1050 <fork@plt>
cmp    $0xffffffff,%eax
je     1146 <fork_prog+0x16>
test   %eax,%eax
je     115c <fork_prog+0x2c>
pop    %rbx
ret
lea    0xeb3(%rip),%rdi
call   1030 <perror@plt>
mov    $0x1,%edi
call   1040 <exit@plt>
call   *%rbx
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"fork()\00"
define void @fork_prog(void ()* %0) {
%2 = alloca void ()*
store void ()* %0, void ()** %2
%3 = call i32 (...) @fork()
switch i32 %3, label %10 [
i32 0, label %4
i32 -1, label %7
]
4: ; preds = %1
%5 = load void ()*, void ()** %2
%6 = call i32 @exit(i32 0)
unreachable
7: ; preds = %1
%8 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @exit(i32 1)
unreachable
10: ; preds = %1
br label %11
11: ; preds = %10
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"fork()\00"
define void @fork_prog(void ()* nocapture %0) {
%2 = tail call i32 (...) @fork()
switch i32 %2, label %8 [
i32 0, label %3
i32 -1, label %5
]
3: ; preds = %1
tail call void %0()
%4 = tail call i32 @exit(i32 0)
unreachable
5: ; preds = %1
%6 = tail call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @exit(i32 1)
unreachable
8: ; preds = %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ UI_DrawSides(float, float, float, float);
int /*<<< orphan*/ UI_DrawTopBottom(float, float, float, float);
int /*<<< orphan*/ trap_R_SetColor(void *);
void UI_DrawRect(float x, float y, float width, float height,
                 const float *color) {
  trap_R_SetColor(color);
  UI_DrawTopBottom(x, y, width, height);
  UI_DrawSides(x, y, width, height);
  trap_R_SetColor(((void *)0));
}


x86 assembly (clang, -O0):
<UI_DrawRect>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  %xmm3,-0x10(%rbp)
mov    %rdi,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <trap_R_SetColor@plt>
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
movss  -0xc(%rbp),%xmm2
movss  -0x10(%rbp),%xmm3
call   1030 <UI_DrawTopBottom@plt>
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
movss  -0xc(%rbp),%xmm2
movss  -0x10(%rbp),%xmm3
call   1040 <UI_DrawSides@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1050 <trap_R_SetColor@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<UI_DrawRect>:
sub    $0x18,%rsp
movss  %xmm3,0x14(%rsp)
movss  %xmm2,0x10(%rsp)
movss  %xmm1,0xc(%rsp)
movss  %xmm0,0x8(%rsp)
call   1050 <trap_R_SetColor@plt>
movss  0x8(%rsp),%xmm0
movss  0xc(%rsp),%xmm1
movss  0x10(%rsp),%xmm2
movss  0x14(%rsp),%xmm3
call   1030 <UI_DrawTopBottom@plt>
movss  0x8(%rsp),%xmm0
movss  0xc(%rsp),%xmm1
movss  0x10(%rsp),%xmm2
movss  0x14(%rsp),%xmm3
call   1040 <UI_DrawSides@plt>
xor    %edi,%edi
add    $0x18,%rsp
jmp    1050 <trap_R_SetColor@plt>

LLVM IR (-O0):
define void @UI_DrawRect(float %0, float %1, float %2, float %3, float* %4) {
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float*
store float %0, float* %6
store float %1, float* %7
store float %2, float* %8
store float %3, float* %9
store float* %4, float** %10
%11 = load float*, float** %10
%12 = bitcast float* %11 to i8*
%13 = call i32 @trap_R_SetColor(i8* %12)
%14 = load float, float* %6
%15 = load float, float* %7
%16 = load float, float* %8
%17 = load float, float* %9
%18 = call i32 @UI_DrawTopBottom(float %14, float %15, float %16, float %17)
%19 = load float, float* %6
%20 = load float, float* %7
%21 = load float, float* %8
%22 = load float, float* %9
%23 = call i32 @UI_DrawSides(float %19, float %20, float %21, float %22)
%24 = call i32 @trap_R_SetColor(i8* null)
ret void
}

LLVM IR (-O2):
define void @UI_DrawRect(float %0, float %1, float %2, float %3, float* %4) {
%6 = bitcast float* %4 to i8*
%7 = tail call i32 @trap_R_SetColor(i8* %6)
%8 = tail call i32 @UI_DrawTopBottom(float %0, float %1, float %2, float %3)
%9 = tail call i32 @UI_DrawSides(float %0, float %1, float %2, float %3)
%10 = tail call i32 @trap_R_SetColor(i8* null)
ret void
}