xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ cmd(char *);
char *getenv(char *);
scalar_t__ strcmp(char const *, char *);
void broadcast_change(void) {
  const char *pkg = getenv("CALLING_PACKAGE");
  if (!pkg || strcmp(pkg, "com.wireguard.android"))
    cmd("am broadcast -a com.wireguard.android.action.REFRESH_TUNNEL_STATES "
        "com.wireguard.android");
}


x86 assembly (clang, -O0):
<broadcast_change>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     116d <broadcast_change+0x3d>
mov    -0x8(%rbp),%rdi
lea    0xef5(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
je     1179 <broadcast_change+0x49>
lea    0xe9c(%rip),%rdi
call   1040 <cmd@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<broadcast_change>:
push   %rax
lea    0xec8(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     1156 <broadcast_change+0x26>
lea    0xf0a(%rip),%rsi
mov    %rax,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     1163 <broadcast_change+0x33>
lea    0xeb3(%rip),%rdi
pop    %rax
jmp    1040 <cmd@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [16 x i8] c"CALLING_PACKAGE\00"
@.str.1 = [22 x i8] c"com.wireguard.android\00"
@.str.2 = [89 x i8] c"am broadcast -a com.wireguard.android.action.REFRESH_TUNNEL_STATES com.wireguard.android\00"
define void @broadcast_change() {
%1 = alloca i8*
%2 = call i8* @getenv(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
store i8* %2, i8** %1
%3 = load i8*, i8** %1
%4 = icmp ne i8* %3, null
br i1 %4, label %5, label %9
5: ; preds = %0
%6 = load i8*, i8** %1
%7 = call i64 @strcmp(i8* %6, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %5, %0
%10 = call i32 @cmd(i8* getelementptr inbounds ([89 x i8], [89 x i8]* @.str.2, i64 0, i64 0))
br label %11
11: ; preds = %9, %5
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"CALLING_PACKAGE\00"
@.str.1 = [22 x i8] c"com.wireguard.android\00"
@.str.2 = [89 x i8] c"am broadcast -a com.wireguard.android.action.REFRESH_TUNNEL_STATES com.wireguard.android\00"
define void @broadcast_change() {
%1 = tail call i8* @getenv(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i8* %1, null
br i1 %2, label %6, label %3
3: ; preds = %0
%4 = tail call i64 @strcmp(i8* %1, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%5 = icmp eq i64 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %3, %0
%7 = tail call i32 @cmd(i8* getelementptr inbounds ([89 x i8], [89 x i8]* @.str.2, i64 0, i64 0))
br label %8
8: ; preds = %6, %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
int /*<<< orphan*/ test(int, int);
int main(int argc, char **argv) {
  int x, y;
  test(x, y);
  printf("%d %d\n", x, y);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1040 <test@plt>
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
lea    0xeb2(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [7 x i8] c"%d %d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @test(i32 undef, i32 undef)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 undef, i32 undef)
ret i32 0
}
/* Variables and functions */
long long y(int);
long long get_alias_set(int t) { return y(t); }


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

x86 assembly (clang, -O2):
<get_alias_set>:
jmp    1030 <y@plt>

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

LLVM IR (-O2):
define i64 @get_alias_set(i32 %0) {
%2 = tail call i64 @y(i32 %0)
ret i64 %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(int argc, char *argv[]) {
  if (argc < 2) {
    printf("Usage: program-name argument\n");
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    1148 <main+0x38>
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    114f <main+0x3f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
xor    %eax,%eax
cmp    $0x1,%edi
jg     112d <main+0x1d>
push   %rax
lea    0xee1(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%eax
add    $0x8,%rsp
ret

LLVM IR (-O0):
@.str = [30 x i8] c"Usage: program-name argument\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = icmp slt i32 %6, 2
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %11
10: ; preds = %2
store i32 0, i32* %3
br label %11
11: ; preds = %10, %8
%12 = load i32, i32* %3
ret i32 %12
}

LLVM IR (-O2):
@str = [29 x i8] c"Usage: program-name argument\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str, i64 0, i64 0))
br label %6
6: ; preds = %2, %4
%7 = phi i32 [ 1, %4 ], [ 0, %2 ]
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, float, float);
main() {
  float x = 0, a = 20, b = 10, d = 4;
  x = (a - b);
  --b;
  x *= (b - d) * b / (b - d);
  b++;
  b++;
  printf("x = %g, b = %g\n", x, b);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xorps  %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  0xee8(%rip),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  0xed7(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  0xec6(%rip),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x8(%rbp),%xmm0
subss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  0xea6(%rip),%xmm0
addss  -0xc(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
subss  -0x10(%rbp),%xmm0
mulss  -0xc(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
subss  -0x10(%rbp),%xmm1
divss  %xmm1,%xmm0
mulss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  0xe69(%rip),%xmm0
addss  -0xc(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  0xe57(%rip),%xmm0
addss  -0xc(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
lea    0xe50(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xef0(%rip),%rdi
movss  0xee0(%rip),%xmm0
movss  0xedc(%rip),%xmm1
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [16 x i8] c"x = %g, b = %g\0A\00"
define i32 @main() {
%1 = alloca float
%2 = alloca float
%3 = alloca float
%4 = alloca float
store float 0.000000e+00, float* %1
store float 2.000000e+01, float* %2
store float 1.000000e+01, float* %3
store float 4.000000e+00, float* %4
%5 = load float, float* %2
%6 = load float, float* %3
%7 = fsub float %5, %6
store float %7, float* %1
%8 = load float, float* %3
%9 = fadd float %8, -1.000000e+00
store float %9, float* %3
%10 = load float, float* %3
%11 = load float, float* %4
%12 = fsub float %10, %11
%13 = load float, float* %3
%14 = fmul float %12, %13
%15 = load float, float* %3
%16 = load float, float* %4
%17 = fsub float %15, %16
%18 = fdiv float %14, %17
%19 = load float, float* %1
%20 = fmul float %19, %18
store float %20, float* %1
%21 = load float, float* %3
%22 = fadd float %21, 1.000000e+00
store float %22, float* %3
%23 = load float, float* %3
%24 = fadd float %23, 1.000000e+00
store float %24, float* %3
%25 = load float, float* %1
%26 = load float, float* %3
%27 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), float %25, float %26)
ret i32 0
}

LLVM IR (-O2):
@.str = [16 x i8] c"x = %g, b = %g\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), float 9.000000e+01, float 1.100000e+01)
ret i32 0
}
/* Variables and functions */
char *malloc(scalar_t__);
int /*<<< orphan*/ strcpy(char *, char const *);
scalar_t__ strlen(char const *);
char *strclone(const char *str) {
  char *ret = malloc(strlen(str) + 1);
  strcpy(ret, str);
  return ret;
}


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

x86 assembly (clang, -O2):
<strclone>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <strlen@plt>
lea    0x1(%rax),%rdi
call   1050 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @strclone(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i64 @strlen(i8* %4)
%6 = add nsw i64 %5, 1
%7 = call i8* @malloc(i64 %6)
store i8* %7, i8** %3
%8 = load i8*, i8** %3
%9 = load i8*, i8** %2
%10 = call i32 @strcpy(i8* %8, i8* %9)
%11 = load i8*, i8** %3
ret i8* %11
}

LLVM IR (-O2):
define i8* @strclone(i8* %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = add nsw i64 %2, 1
%4 = tail call i8* @malloc(i64 %3)
%5 = tail call i32 @strcpy(i8* %4, i8* %0)
ret i8* %4
}
void setsize(int n) { (void)n; }


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

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

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

LLVM IR (-O2):
define void @setsize(i32 %0) {
ret void
}
/* Variables and functions */
scalar_t__ calloc(int, int);
int /*<<< orphan*/ free(int *);
int /*<<< orphan*/ fun(int *);
int /*<<< orphan*/ print_array(int *, int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  int *a = (int *)calloc(10, sizeof(int));
  fun(a);
  print_array(a, 10);
  free(a);
  int b = "abcdefghijklmnopqrstuvwxyz"[3];
  printf("b= %d\n", b);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0xa,%edi
mov    $0x4,%esi
call   1070 <calloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <fun@plt>
mov    -0x10(%rbp),%rdi
mov    $0xa,%esi
call   1040 <print_array@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
movsbl 0xe6a(%rip),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xe75(%rip),%rdi
call   1060 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0xa,%edi
mov    $0x4,%esi
call   1070 <calloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1050 <fun@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1040 <print_array@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
lea    0xe79(%rip),%rdi
mov    $0x64,%esi
call   1060 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [27 x i8] c"abcdefghijklmnopqrstuvwxyz\00"
@.str.1 = [7 x i8] c"b= %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32
store i32 0, i32* %1
%4 = call i64 @calloc(i32 10, i32 4)
%5 = inttoptr i64 %4 to i32*
store i32* %5, i32** %2
%6 = load i32*, i32** %2
%7 = call i32 @fun(i32* %6)
%8 = load i32*, i32** %2
%9 = call i32 @print_array(i32* %8, i32 10)
%10 = load i32*, i32** %2
%11 = call i32 @free(i32* %10)
%12 = load i8, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 3)
%13 = sext i8 %12 to i32
store i32 %13, i32* %3
%14 = load i32, i32* %3
%15 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %14)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [7 x i8] c"b= %d\0A\00"
define i32 @main() {
%1 = tail call i64 @calloc(i32 10, i32 4)
%2 = inttoptr i64 %1 to i32*
%3 = tail call i32 @fun(i32* %2)
%4 = tail call i32 @print_array(i32* %2, i32 10)
%5 = tail call i32 @free(i32* %2)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 100)
ret i32 0
}
void AgbMain() {}


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

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

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

LLVM IR (-O2):
define void @AgbMain() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ arabic_to_roman(int);
int /*<<< orphan*/ strcat(char *, int /*<<< orphan*/);
int extract_roman_value(int value, int remaining, char *result) {
  while (remaining >= value) {
    strcat(result, arabic_to_roman(value));
    remaining -= value;
  }
  return remaining;
}


x86 assembly (clang, -O0):
<extract_roman_value>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jl     1169 <extract_roman_value+0x49>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <arabic_to_roman@plt>
mov    -0x18(%rbp),%rdi
mov    %eax,%esi
call   1030 <strcat@plt>
mov    -0x4(%rbp),%ecx
mov    -0x8(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x8(%rbp)
jmp    1132 <extract_roman_value+0x12>
mov    -0x8(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<extract_roman_value>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebx
cmp    %edi,%esi
jl     1147 <extract_roman_value+0x27>
mov    %rdx,%r14
mov    %edi,%ebp
nop
mov    %ebp,%edi
call   1040 <arabic_to_roman@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1030 <strcat@plt>
sub    %ebp,%ebx
cmp    %ebp,%ebx
jge    1130 <extract_roman_value+0x10>
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @extract_roman_value(i32 %0, i32 %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
store i32 %0, i32* %4
store i32 %1, i32* %5
store i8* %2, i8** %6
br label %7
7: ; preds = %11, %3
%8 = load i32, i32* %5
%9 = load i32, i32* %4
%10 = icmp sge i32 %8, %9
br i1 %10, label %11, label %19
11: ; preds = %7
%12 = load i8*, i8** %6
%13 = load i32, i32* %4
%14 = call i32 @arabic_to_roman(i32 %13)
%15 = call i32 @strcat(i8* %12, i32 %14)
%16 = load i32, i32* %4
%17 = load i32, i32* %5
%18 = sub nsw i32 %17, %16
store i32 %18, i32* %5
br label %7
19: ; preds = %7
%20 = load i32, i32* %5
ret i32 %20
}

LLVM IR (-O2):
define i32 @extract_roman_value(i32 %0, i32 %1, i8* %2) {
%4 = icmp slt i32 %1, %0
br i1 %4, label %11, label %5
5: ; preds = %3, %5
%6 = phi i32 [ %9, %5 ], [ %1, %3 ]
%7 = tail call i32 @arabic_to_roman(i32 %0)
%8 = tail call i32 @strcat(i8* %2, i32 %7)
%9 = sub nsw i32 %6, %0
%10 = icmp slt i32 %9, %0
br i1 %10, label %11, label %5
11: ; preds = %5, %3
%12 = phi i32 [ %1, %3 ], [ %9, %5 ]
ret i32 %12
}
double grater(double x, double y) { return (x > y) ? x : y; }


x86 assembly (clang, -O0):
<grater>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    112d <grater+0x2d>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    1137 <grater+0x37>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<grater>:
maxsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @grater(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
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load double, double* %3
br label %12
10: ; preds = %2
%11 = load double, double* %4
br label %12
12: ; preds = %10, %8
%13 = phi double [ %9, %8 ], [ %11, %10 ]
ret double %13
}

LLVM IR (-O2):
define double @grater(double %0, double %1) {
%3 = fcmp ogt double %0, %1
%4 = select i1 %3, double %0, double %1
ret double %4
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, char *, char *,
                           char *);
int /*<<< orphan*/ stderr;
void usage(void) {
  (void)fprintf(
      stderr, "%s\n%s\n%s\n%s\n", "usage: kill [-s signal_name] pid ...",
      "       kill -l [exit_status]", "       kill -signal_name pid ...",
      "       kill -signal_number pid ...");
  exit(2);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
lea    0xed2(%rip),%rdx
lea    0xef0(%rip),%rcx
lea    0xf06(%rip),%r8
lea    0xf20(%rip),%r9
call   1030 <fprintf@plt>
mov    $0x2,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
lea    0xed5(%rip),%rdx
lea    0xef3(%rip),%rcx
lea    0xf09(%rip),%r8
lea    0xf23(%rip),%r9
call   1030 <fprintf@plt>
mov    $0x2,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [13 x i8] c"%s\0A%s\0A%s\0A%s\0A\00"
@.str.1 = [37 x i8] c"usage: kill [-s signal_name] pid ...\00"
@.str.2 = [29 x i8] c" kill -l [exit_status]\00"
@.str.3 = [33 x i8] c" kill -signal_name pid ...\00"
@.str.4 = [35 x i8] c" kill -signal_number pid ...\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0))
%3 = call i32 @exit(i32 2)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [13 x i8] c"%s\0A%s\0A%s\0A%s\0A\00"
@.str.1 = [37 x i8] c"usage: kill [-s signal_name] pid ...\00"
@.str.2 = [29 x i8] c" kill -l [exit_status]\00"
@.str.3 = [33 x i8] c" kill -signal_name pid ...\00"
@.str.4 = [35 x i8] c" kill -signal_number pid ...\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0))
%3 = tail call i32 @exit(i32 2)
unreachable
}
void SHAREMIND_MAP_KEY_FREE_voidptr(void **const dest) { (void)dest; }


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

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

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

LLVM IR (-O2):
define void @SHAREMIND_MAP_KEY_FREE_voidptr(i8** nocapture %0) {
ret void
}
unsigned long get_intsts_reg(int port) { return port == 0 ? 0x42 : 0x44; }


x86 assembly (clang, -O0):
<get_intsts_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
mov    $0x44,%eax
mov    $0x42,%ecx
cmp    $0x0,%edx
cmove  %ecx,%eax
cltq
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_intsts_reg>:
xor    %eax,%eax
test   %edi,%edi
setne  %al
add    %rax,%rax
add    $0x42,%rax
ret

LLVM IR (-O0):
define i64 @get_intsts_reg(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 0
%5 = zext i1 %4 to i64
%6 = select i1 %4, i32 66, i32 68
%7 = sext i32 %6 to i64
ret i64 %7
}

LLVM IR (-O2):
define i64 @get_intsts_reg(i32 %0) {
%2 = icmp eq i32 %0, 0
%3 = select i1 %2, i64 66, i64 68
ret i64 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_spinlock_t;

/* Variables and functions */
int o_pthread_spin_trylock(int /*<<< orphan*/ *);
int ___pthread_spin_trylock(pthread_spinlock_t *spin) {
  ;
  return o_pthread_spin_trylock(spin);
}


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

x86 assembly (clang, -O2):
<___pthread_spin_trylock>:
jmp    1030 <o_pthread_spin_trylock@plt>

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

LLVM IR (-O2):
define i32 @___pthread_spin_trylock(i32* %0) {
%2 = tail call i32 @o_pthread_spin_trylock(i32* %0)
ret i32 %2
}
int is_printable(char c) { return c > 31 && c < 128; }


x86 assembly (clang, -O0):
<is_printable>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%ecx
xor    %eax,%eax
cmp    $0x1f,%ecx
mov    %al,-0x2(%rbp)
jle    112b <is_printable+0x2b>
movsbl -0x1(%rbp),%eax
cmp    $0x80,%eax
setl   %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_printable>:
xor    %eax,%eax
cmp    $0x20,%dil
setge  %al
ret

LLVM IR (-O0):
define i32 @is_printable(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp sgt i32 %4, 31
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp slt i32 %8, 128
br label %10
10: ; preds = %6, %1
%11 = phi i1 [ false, %1 ], [ %9, %6 ]
%12 = zext i1 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @is_printable(i8 signext %0) {
%2 = icmp sgt i8 %0, 31
%3 = zext i1 %2 to i32
ret i32 %3
}
translate(ch) char ch;
{
  switch (ch) {
  case '{':
    return '<';
  case '}':
    return '>';
  case 'i':
    return '^';
  case '!':
    return 'v';
  }
  return ch;
}


x86 assembly (clang, -O0):
<translate>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0x21,%eax
je     1176 <translate+0x76>
jmp    111f <translate+0x1f>
mov    -0xc(%rbp),%eax
sub    $0x69,%eax
je     116a <translate+0x6a>
jmp    1130 <translate+0x30>
mov    -0xc(%rbp),%eax
sub    $0x7b,%eax
je     1152 <translate+0x52>
jmp    1141 <translate+0x41>
mov    -0xc(%rbp),%eax
sub    $0x7d,%eax
je     115e <translate+0x5e>
jmp    1182 <translate+0x82>
movl   $0x3c,-0x4(%rbp)
jmp    1189 <translate+0x89>
movl   $0x3e,-0x4(%rbp)
jmp    1189 <translate+0x89>
movl   $0x5e,-0x4(%rbp)
jmp    1189 <translate+0x89>
movl   $0x76,-0x4(%rbp)
jmp    1189 <translate+0x89>
movsbl -0x5(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<translate>:
movsbl %dil,%eax
cmp    $0x7a,%eax
jg     1119 <translate+0x19>
cmp    $0x21,%eax
je     1129 <translate+0x29>
cmp    $0x69,%eax
jne    112e <translate+0x2e>
mov    $0x5e,%eax
ret
cmp    $0x7b,%eax
je     112f <translate+0x2f>
cmp    $0x7d,%eax
jne    112e <translate+0x2e>
mov    $0x3e,%eax
ret
mov    $0x76,%eax
ret
mov    $0x3c,%eax
ret

LLVM IR (-O0):
define i32 @translate(i32 %0) {
%2 = alloca i32
%3 = alloca i8
%4 = trunc i32 %0 to i8
store i8 %4, i8* %3
%5 = load i8, i8* %3
%6 = sext i8 %5 to i32
switch i32 %6, label %11 [
i32 123, label %7
i32 125, label %8
i32 105, label %9
i32 33, label %10
]
7: ; preds = %1
store i32 60, i32* %2
br label %14
8: ; preds = %1
store i32 62, i32* %2
br label %14
9: ; preds = %1
store i32 94, i32* %2
br label %14
10: ; preds = %1
store i32 118, i32* %2
br label %14
11: ; preds = %1
%12 = load i8, i8* %3
%13 = sext i8 %12 to i32
store i32 %13, i32* %2
br label %14
14: ; preds = %11, %10, %9, %8, %7
%15 = load i32, i32* %2
ret i32 %15
}

LLVM IR (-O2):
define i32 @translate(i32 %0) {
%2 = shl i32 %0, 24
%3 = ashr exact i32 %2, 24
switch i32 %3, label %7 [
i32 123, label %8
i32 125, label %4
i32 105, label %5
i32 33, label %6
]
4: ; preds = %1
br label %8
5: ; preds = %1
br label %8
6: ; preds = %1
br label %8
7: ; preds = %1
br label %8
8: ; preds = %1, %7, %6, %5, %4
%9 = phi i32 [ %3, %7 ], [ 118, %6 ], [ 94, %5 ], [ 62, %4 ], [ 60, %1 ]
ret i32 %9
}
/* Variables and functions */
int f331(int *);
int f332(int *p) { return f331(p); }


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

x86 assembly (clang, -O2):
<f332>:
jmp    1030 <f331@plt>

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

LLVM IR (-O2):
define i32 @f332(i32* %0) {
%2 = tail call i32 @f331(i32* %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ draw_char(int, int, char);
int /*<<< orphan*/ show_screen();
int /*<<< orphan*/ timer_pause(long);
void walk_waypoints_draw_avatar(int x, int y, char c) {
  draw_char(x, y, c);
  show_screen();
  timer_pause(100L);
}


x86 assembly (clang, -O0):
<walk_waypoints_draw_avatar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dl,%al
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
movsbl -0x9(%rbp),%edx
call   1040 <draw_char@plt>
mov    $0x0,%al
call   1030 <show_screen@plt>
mov    $0x64,%edi
call   1050 <timer_pause@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<walk_waypoints_draw_avatar>:
push   %rax
call   1040 <draw_char@plt>
xor    %eax,%eax
call   1030 <show_screen@plt>
mov    $0x64,%edi
pop    %rax
jmp    1050 <timer_pause@plt>

LLVM IR (-O0):
define void @walk_waypoints_draw_avatar(i32 %0, i32 %1, i8 signext %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8
store i32 %0, i32* %4
store i32 %1, i32* %5
store i8 %2, i8* %6
%7 = load i32, i32* %4
%8 = load i32, i32* %5
%9 = load i8, i8* %6
%10 = call i32 @draw_char(i32 %7, i32 %8, i8 signext %9)
%11 = call i32 (...) @show_screen()
%12 = call i32 @timer_pause(i64 100)
ret void
}

LLVM IR (-O2):
define void @walk_waypoints_draw_avatar(i32 %0, i32 %1, i8 signext %2) {
%4 = tail call i32 @draw_char(i32 %0, i32 %1, i8 signext %2)
%5 = tail call i32 (...) @show_screen()
%6 = tail call i32 @timer_pause(i64 100)
ret void
}
void zeromem(unsigned char b[], unsigned size) {
  unsigned char *i = b;
  unsigned char *end = b + size;
  while (i < end)
    *i++ = 0x0;
}


x86 assembly (clang, -O0):
<zeromem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x20(%rbp),%rax
jae    1146 <zeromem+0x46>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
movb   $0x0,(%rax)
jmp    1121 <zeromem+0x21>
pop    %rbp
ret

x86 assembly (clang, -O2):
<zeromem>:
test   %esi,%esi
je     1133 <zeromem+0x23>
push   %rax
mov    %esi,%edx
add    %rdi,%rdx
lea    0x1(%rdi),%rax
cmp    %rax,%rdx
cmovbe %rax,%rdx
sub    %rdi,%rdx
xor    %esi,%esi
call   1030 <memset@plt>
add    $0x8,%rsp
ret

LLVM IR (-O0):
define void @zeromem(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
store i8* %0, i8** %3
store i32 %1, i32* %4
%7 = load i8*, i8** %3
store i8* %7, i8** %5
%8 = load i8*, i8** %3
%9 = load i32, i32* %4
%10 = zext i32 %9 to i64
%11 = getelementptr inbounds i8, i8* %8, i64 %10
store i8* %11, i8** %6
br label %12
12: ; preds = %16, %2
%13 = load i8*, i8** %5
%14 = load i8*, i8** %6
%15 = icmp ult i8* %13, %14
br i1 %15, label %16, label %19
16: ; preds = %12
%17 = load i8*, i8** %5
%18 = getelementptr inbounds i8, i8* %17, i32 1
store i8* %18, i8** %5
store i8 0, i8* %17
br label %12
19: ; preds = %12
ret void
}

LLVM IR (-O2):
define void @zeromem(i8* writeonly %0, i32 %1) {
%3 = ptrtoint i8* %0 to i64
%4 = icmp eq i32 %1, 0
br i1 %4, label %11, label %5
5: ; preds = %2
%6 = zext i32 %1 to i64
%7 = add i64 %3, %6
%8 = add i64 %3, 1
%9 = call i64 @llvm.umax.i64(i64 %7, i64 %8)
%10 = sub i64 %9, %3
br label %11
11: ; preds = %5, %2
ret void
}
/* Type definitions */
typedef int uint8_t;
typedef int uint32_t;

/* Variables and functions */
void USBHostAddrSet(uint32_t ui32Base, uint32_t ui32Endpoint, uint32_t ui32Addr,
                    uint32_t ui32Flags) {
  ;

  ;
  if (ui32Flags & 0x00002000) {
    (*((volatile uint8_t *)(ui32Base + 0x00000080 + (ui32Endpoint >> 1)))) =
        ui32Addr;
  } else {
    (*((volatile uint8_t *)(ui32Base + 0x00000080 + 4 + (ui32Endpoint >> 1)))) =
        ui32Addr;
  }
}


x86 assembly (clang, -O0):
<USBHostAddrSet>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x10(%rbp),%eax
and    $0x2000,%eax
cmp    $0x0,%eax
je     113d <USBHostAddrSet+0x3d>
mov    -0xc(%rbp),%ecx
mov    -0x4(%rbp),%eax
add    $0x80,%eax
mov    -0x8(%rbp),%edx
sar    $0x1,%edx
add    %edx,%eax
cltq
mov    %ecx,(%rax)
jmp    1157 <USBHostAddrSet+0x57>
mov    -0xc(%rbp),%ecx
mov    -0x4(%rbp),%eax
add    $0x80,%eax
add    $0x4,%eax
mov    -0x8(%rbp),%edx
sar    $0x1,%edx
add    %edx,%eax
cltq
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<USBHostAddrSet>:
xor    %eax,%eax
test   $0x2000,%ecx
sete   %al
lea    (%rdi,%rax,4),%eax
add    $0x80,%eax
sar    %esi
cltq
movslq %esi,%rcx
mov    %edx,(%rax,%rcx,1)
ret

LLVM IR (-O0):
define void @USBHostAddrSet(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %8
%10 = and i32 %9, 8192
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %21
12: ; preds = %4
%13 = load i32, i32* %7
%14 = load i32, i32* %5
%15 = add nsw i32 %14, 128
%16 = load i32, i32* %6
%17 = ashr i32 %16, 1
%18 = add nsw i32 %15, %17
%19 = sext i32 %18 to i64
%20 = inttoptr i64 %19 to i32*
store volatile i32 %13, i32* %20
br label %31
21: ; preds = %4
%22 = load i32, i32* %7
%23 = load i32, i32* %5
%24 = add nsw i32 %23, 128
%25 = add nsw i32 %24, 4
%26 = load i32, i32* %6
%27 = ashr i32 %26, 1
%28 = add nsw i32 %25, %27
%29 = sext i32 %28 to i64
%30 = inttoptr i64 %29 to i32*
store volatile i32 %22, i32* %30
br label %31
31: ; preds = %21, %12
ret void
}

LLVM IR (-O2):
define void @USBHostAddrSet(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = and i32 %3, 8192
%6 = icmp eq i32 %5, 0
%7 = select i1 %6, i32 132, i32 128
%8 = add nsw i32 %7, %0
%9 = ashr i32 %1, 1
%10 = add nsw i32 %8, %9
%11 = sext i32 %10 to i64
%12 = inttoptr i64 %11 to i32*
store volatile i32 %2, i32* %12
ret void
}
/* Type definitions */
struct msgbuf {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ assert(int);
size_t msgbuf_headroom(struct msgbuf *);
void msgbuf_prealloc_headroom(struct msgbuf *b, size_t size) {
  assert(size <= msgbuf_headroom(b));
}


x86 assembly (clang, -O0):
<msgbuf_prealloc_headroom>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <msgbuf_headroom@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
cmp    %rcx,%rax
setbe  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<msgbuf_prealloc_headroom>:
push   %rbx
mov    %rsi,%rbx
call   1030 <msgbuf_headroom@plt>
xor    %edi,%edi
cmp    %rbx,%rax
setae  %dil
pop    %rbx
jmp    1040 <assert@plt>

LLVM IR (-O0):
%struct.msgbuf = type { i32 }
define void @msgbuf_prealloc_headroom(%struct.msgbuf* %0, i64 %1) {
%3 = alloca %struct.msgbuf*
%4 = alloca i64
store %struct.msgbuf* %0, %struct.msgbuf** %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = load %struct.msgbuf*, %struct.msgbuf** %3
%7 = call i64 @msgbuf_headroom(%struct.msgbuf* %6)
%8 = icmp ule i64 %5, %7
%9 = zext i1 %8 to i32
%10 = call i32 @assert(i32 %9)
ret void
}

LLVM IR (-O2):
%struct.msgbuf = type { i32 }
define void @msgbuf_prealloc_headroom(%struct.msgbuf* %0, i64 %1) {
%3 = tail call i64 @msgbuf_headroom(%struct.msgbuf* %0)
%4 = icmp uge i64 %3, %1
%5 = zext i1 %4 to i32
%6 = tail call i32 @assert(i32 %5)
ret void
}
int blk_cpu_to_group(int cpu) { return cpu; }


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

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

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

LLVM IR (-O2):
define i32 @blk_cpu_to_group(i32 returned %0) {
ret i32 %0
}
void RCC_IRQHandler(void) {}


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

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

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

LLVM IR (-O2):
define void @RCC_IRQHandler() {
ret void
}
/* Variables and functions */
int abs(int);
int test_abs() { return 0 == abs(0) && 10 == abs(10) && 10 == abs(-10); }


x86 assembly (clang, -O0):
<test_abs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %edi,%edi
call   1030 <abs@plt>
mov    %eax,%edx
xor    %eax,%eax
xor    %ecx,%ecx
cmp    %edx,%ecx
mov    %al,-0x1(%rbp)
jne    1167 <test_abs+0x57>
mov    $0xa,%edi
call   1030 <abs@plt>
mov    %eax,%edx
xor    %eax,%eax
mov    $0xa,%ecx
cmp    %edx,%ecx
mov    %al,-0x1(%rbp)
jne    1167 <test_abs+0x57>
mov    $0xfffffff6,%edi
call   1030 <abs@plt>
mov    %eax,%ecx
mov    $0xa,%eax
cmp    %ecx,%eax
sete   %al
mov    %al,-0x1(%rbp)
mov    -0x1(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_abs>:
mov    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @test_abs() {
%1 = call i32 @abs(i32 0)
%2 = icmp eq i32 0, %1
br i1 %2, label %3, label %9
3: ; preds = %0
%4 = call i32 @abs(i32 10)
%5 = icmp eq i32 10, %4
br i1 %5, label %6, label %9
6: ; preds = %3
%7 = call i32 @abs(i32 -10)
%8 = icmp eq i32 10, %7
br label %9
9: ; preds = %6, %3, %0
%10 = phi i1 [ false, %3 ], [ false, %0 ], [ %8, %6 ]
%11 = zext i1 %10 to i32
ret i32 %11
}

LLVM IR (-O2):
define i32 @test_abs() {
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ fatal_error(int /*<<< orphan*/, char *);
int do_dummy(void *item, int nitem, int eio, char *desc, char *srcfile,
             int line) {
  fatal_error(0, "gmx_fio_select not called!");
  return 0;
}


x86 assembly (clang, -O0):
<do_dummy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9d,-0x24(%rbp)
xor    %edi,%edi
lea    0xec9(%rip),%rsi
call   1030 <fatal_error@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_dummy>:
push   %rax
lea    0xee8(%rip),%rsi
xor    %edi,%edi
call   1030 <fatal_error@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [27 x i8] c"gmx_fio_select not called!\00"
define i32 @do_dummy(i8* %0, i32 %1, i32 %2, i8* %3, i8* %4, i32 %5) {
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i32
store i8* %0, i8** %7
store i32 %1, i32* %8
store i32 %2, i32* %9
store i8* %3, i8** %10
store i8* %4, i8** %11
store i32 %5, i32* %12
%13 = call i32 @fatal_error(i32 0, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [27 x i8] c"gmx_fio_select not called!\00"
define i32 @do_dummy(i8* nocapture readnone %0, i32 %1, i32 %2, i8* nocapture readnone %3, i8* nocapture readnone %4, i32 %5) {
%7 = tail call i32 @fatal_error(i32 0, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ Inst_Printf(char *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ Off_Reg_Bank(int);
void Move_From_Reg_X(int index) {
  Inst_Printf("movq", "%s,%%rdx", Off_Reg_Bank(index * 8));
}


x86 assembly (clang, -O0):
<Move_From_Reg_X>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
shl    $0x3,%edi
call   1040 <Off_Reg_Bank@plt>
mov    %eax,%edx
lea    0xec1(%rip),%rdi
lea    0xebf(%rip),%rsi
call   1030 <Inst_Printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Move_From_Reg_X>:
push   %rax
shl    $0x3,%edi
call   1040 <Off_Reg_Bank@plt>
lea    0xed0(%rip),%rdi
lea    0xece(%rip),%rsi
mov    %eax,%edx
pop    %rax
jmp    1030 <Inst_Printf@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"movq\00"
@.str.1 = [9 x i8] c"%s,%%rdx\00"
define void @Move_From_Reg_X(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = mul nsw i32 %3, 8
%5 = call i32 @Off_Reg_Bank(i32 %4)
%6 = call i32 @Inst_Printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %5)
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"movq\00"
@.str.1 = [9 x i8] c"%s,%%rdx\00"
define void @Move_From_Reg_X(i32 %0) {
%2 = shl nsw i32 %0, 3
%3 = tail call i32 @Off_Reg_Bank(i32 %2)
%4 = tail call i32 @Inst_Printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ConfigurePortPins();
int /*<<< orphan*/ EnablePeripheralModules();
int /*<<< orphan*/ io_set_cpg();
void HardwareSetup(void) {
  io_set_cpg();
  ConfigurePortPins();
  EnablePeripheralModules();
}


x86 assembly (clang, -O0):
<HardwareSetup>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1050 <io_set_cpg@plt>
mov    $0x0,%al
call   1030 <ConfigurePortPins@plt>
mov    $0x0,%al
call   1040 <EnablePeripheralModules@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<HardwareSetup>:
push   %rax
xor    %eax,%eax
call   1050 <io_set_cpg@plt>
xor    %eax,%eax
call   1030 <ConfigurePortPins@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <EnablePeripheralModules@plt>

LLVM IR (-O0):
define void @HardwareSetup() {
%1 = call i32 (...) @io_set_cpg()
%2 = call i32 (...) @ConfigurePortPins()
%3 = call i32 (...) @EnablePeripheralModules()
ret void
}

LLVM IR (-O2):
define void @HardwareSetup() {
%1 = tail call i32 (...) @io_set_cpg()
%2 = tail call i32 (...) @ConfigurePortPins()
%3 = tail call i32 (...) @EnablePeripheralModules()
ret void
}
int charToInt(const char c) {
  if (c > 47 && c < 58)
    return c - 48;
  else
    return 0;
}


x86 assembly (clang, -O0):
<charToInt>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x2f,%eax
jle    1133 <charToInt+0x33>
movsbl -0x5(%rbp),%eax
cmp    $0x3a,%eax
jge    1133 <charToInt+0x33>
movsbl -0x5(%rbp),%eax
sub    $0x30,%eax
mov    %eax,-0x4(%rbp)
jmp    113a <charToInt+0x3a>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<charToInt>:
lea    -0x30(%rdi),%ecx
lea    -0x30(%rdi),%edx
xor    %eax,%eax
cmp    $0xa,%cl
cmovb  %edx,%eax
ret

LLVM IR (-O0):
define i32 @charToInt(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 sgt i32 %5, 47
br i1 %6, label %7, label %15
7: ; preds = %1
%8 = load i8, i8* %3
%9 = sext i8 %8 to i32
%10 = icmp slt i32 %9, 58
br i1 %10, label %11, label %15
11: ; preds = %7
%12 = load i8, i8* %3
%13 = sext i8 %12 to i32
%14 = sub nsw i32 %13, 48
store i32 %14, i32* %2
br label %16
15: ; preds = %7, %1
store i32 0, i32* %2
br label %16
16: ; preds = %15, %11
%17 = load i32, i32* %2
ret i32 %17
}

LLVM IR (-O2):
define i32 @charToInt(i8 signext %0) {
%2 = add i8 %0, -48
%3 = icmp ult i8 %2, 10
%4 = sext i8 %0 to i32
%5 = add nsw i32 %4, -48
%6 = select i1 %3, i32 %5, i32 0
ret i32 %6
}
void REQ_FLIST_handler(int fd) {}


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

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

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

LLVM IR (-O2):
define void @REQ_FLIST_handler(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ IsSeparator(int /*<<< orphan*/);
int TokenLength(char *pc) {
  int length = 0;
  while (!IsSeparator(*pc++))
    length++;
  return length;
}


x86 assembly (clang, -O0):
<TokenLength>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%edi
call   1030 <IsSeparator@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    114f <TokenLength+0x3f>
jmp    115d <TokenLength+0x4d>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <TokenLength+0x13>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<TokenLength>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
movsbl (%rdi),%edi
call   1030 <IsSeparator@plt>
xor    %ebx,%ebx
test   %eax,%eax
jne    1143 <TokenLength+0x33>
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
movsbl 0x1(%r14,%rbx,1),%edi
call   1030 <IsSeparator@plt>
add    $0x1,%rbx
test   %eax,%eax
je     1130 <TokenLength+0x20>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @TokenLength(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
br label %4
4: ; preds = %12, %1
%5 = load i8*, i8** %2
%6 = getelementptr inbounds i8, i8* %5, i32 1
store i8* %6, i8** %2
%7 = load i8, i8* %5
%8 = sext i8 %7 to i32
%9 = call i32 @IsSeparator(i32 %8)
%10 = icmp ne i32 %9, 0
%11 = xor i1 %10, true
br i1 %11, label %12, label %15
12: ; preds = %4
%13 = load i32, i32* %3
%14 = add nsw i32 %13, 1
store i32 %14, i32* %3
br label %4
15: ; preds = %4
%16 = load i32, i32* %3
ret i32 %16
}

LLVM IR (-O2):
define i32 @TokenLength(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = sext i8 %2 to i32
%4 = tail call i32 @IsSeparator(i32 %3)
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %15
6: ; preds = %1, %6
%7 = phi i32 [ %10, %6 ], [ 0, %1 ]
%8 = phi i8* [ %9, %6 ], [ %0, %1 ]
%9 = getelementptr inbounds i8, i8* %8, i64 1
%10 = add nuw nsw i32 %7, 1
%11 = load i8, i8* %9
%12 = sext i8 %11 to i32
%13 = tail call i32 @IsSeparator(i32 %12)
%14 = icmp eq i32 %13, 0
br i1 %14, label %6, label %15
15: ; preds = %6, %1
%16 = phi i32 [ 0, %1 ], [ %10, %6 ]
ret i32 %16
}
void addx(p) struct h8_opcode *p;
{ printf("dst = srca + srcb+ (c != 0);\n"); }


x86 assembly (clang, -O0):
<addx>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xedd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.h8_opcode = type opaque
@.str = [30 x i8] c"dst = srca + srcb+ (c != 0);\0A\00"
define void @addx(%struct.h8_opcode* %0) {
%2 = alloca %struct.h8_opcode*
store %struct.h8_opcode* %0, %struct.h8_opcode** %2
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
%struct.h8_opcode = type opaque
@str = [29 x i8] c"dst = srca + srcb+ (c != 0);\00"
define void @addx(%struct.h8_opcode* nocapture readnone %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
char getStackTop(char *);
int strlen(char *);
char popStack(char *stack) {
  char retVal = getStackTop(stack);
  if (strlen(stack)) {
    stack[strlen(stack) - 1] = '\0';
  }
  return retVal;
}


x86 assembly (clang, -O0):
<popStack>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <getStackTop@plt>
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x0,%eax
je     116b <popStack+0x4b>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
movsbl -0x9(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<popStack>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1040 <getStackTop@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1030 <strlen@plt>
test   %eax,%eax
je     1148 <popStack+0x28>
mov    %rbx,%rdi
call   1030 <strlen@plt>
cltq
movb   $0x0,-0x1(%rax,%rbx,1)
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define signext i8 @popStack(i8* %0) {
%2 = alloca i8*
%3 = alloca i8
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call signext i8 @getStackTop(i8* %4)
store i8 %5, i8* %3
%6 = load i8*, i8** %2
%7 = call i32 @strlen(i8* %6)
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %16
9: ; preds = %1
%10 = load i8*, i8** %2
%11 = load i8*, i8** %2
%12 = call i32 @strlen(i8* %11)
%13 = sub nsw i32 %12, 1
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8, i8* %10, i64 %14
store i8 0, i8* %15
br label %16
16: ; preds = %9, %1
%17 = load i8, i8* %3
ret i8 %17
}

LLVM IR (-O2):
define signext i8 @popStack(i8* %0) {
%2 = tail call signext i8 @getStackTop(i8* %0)
%3 = tail call i32 @strlen(i8* %0)
%4 = icmp eq i32 %3, 0
br i1 %4, label %10, label %5
5: ; preds = %1
%6 = tail call i32 @strlen(i8* %0)
%7 = add nsw i32 %6, -1
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i8, i8* %0, i64 %8
store i8 0, i8* %9
br label %10
10: ; preds = %5, %1
ret i8 %2
}