xunge/DecIR huggingface dataset:
short gabs(short val) { return val > 0 ? val : -val; }


x86 assembly (clang, -O0):
<gabs>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%eax
cmp    $0x0,%eax
jle    1124 <gabs+0x24>
movswl -0x2(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    112f <gabs+0x2f>
movswl -0x2(%rbp),%ecx
xor    %eax,%eax
sub    %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cwtl
pop    %rbp
ret

x86 assembly (clang, -O2):
<gabs>:
mov    %edi,%eax
neg    %ax
cmovs  %di,%ax
ret

LLVM IR (-O0):
define signext i16 @gabs(i16 signext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = sext i16 %3 to i32
%5 = icmp sgt i32 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load i16, i16* %2
%8 = sext i16 %7 to i32
br label %13
9: ; preds = %1
%10 = load i16, i16* %2
%11 = sext i16 %10 to i32
%12 = sub nsw i32 0, %11
br label %13
13: ; preds = %9, %6
%14 = phi i32 [ %8, %6 ], [ %12, %9 ]
%15 = trunc i32 %14 to i16
ret i16 %15
}

LLVM IR (-O2):
define signext i16 @gabs(i16 signext %0) {
%2 = tail call i16 @llvm.abs.i16(i16 %0, i1 false)
ret i16 %2
}
/* Type definitions */
typedef scalar_t__ uint64_t;

/* Variables and functions */
scalar_t__ range_get_last(scalar_t__, scalar_t__);
int range_covers_byte(uint64_t offset, uint64_t len, uint64_t byte) {
  return offset <= byte && byte <= range_get_last(offset, len);
}


x86 assembly (clang, -O0):
<range_covers_byte>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rcx
xor    %eax,%eax
cmp    -0x18(%rbp),%rcx
mov    %al,-0x19(%rbp)
jg     115c <range_covers_byte+0x4c>
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <range_get_last@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
cmp    %rcx,%rax
setle  %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<range_covers_byte>:
xor    %eax,%eax
cmp    %rdx,%rdi
jg     112c <range_covers_byte+0x1c>
push   %rbx
mov    %rdx,%rbx
call   1030 <range_get_last@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rbx,%rcx
setge  %al
pop    %rbx
ret

LLVM IR (-O0):
define i32 @range_covers_byte(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 = icmp sle i64 %7, %8
br i1 %9, label %10, label %16
10: ; preds = %3
%11 = load i64, i64* %6
%12 = load i64, i64* %4
%13 = load i64, i64* %5
%14 = call i64 @range_get_last(i64 %12, i64 %13)
%15 = icmp sle i64 %11, %14
br label %16
16: ; preds = %10, %3
%17 = phi i1 [ false, %3 ], [ %15, %10 ]
%18 = zext i1 %17 to i32
ret i32 %18
}

LLVM IR (-O2):
define i32 @range_covers_byte(i64 %0, i64 %1, i64 %2) {
%4 = icmp sgt i64 %0, %2
br i1 %4, label %9, label %5
5: ; preds = %3
%6 = tail call i64 @range_get_last(i64 %0, i64 %1)
%7 = icmp sge i64 %6, %2
%8 = zext i1 %7 to i32
br label %9
9: ; preds = %5, %3
%10 = phi i32 [ 0, %3 ], [ %8, %5 ]
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void sviet(char *arg) { printf("%s\n", arg); }


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

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define void @sviet(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Type definitions */
typedef scalar_t__ wchar_t;
struct _Locale_collate {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ wcsncpy(scalar_t__ *, scalar_t__ const *, size_t);
size_t _WLocale_strxfrm(struct _Locale_collate *lcol
                        __attribute__((__unused__)),
                        wchar_t *dest, size_t dest_n, const wchar_t *src,
                        size_t src_n) {
  if (dest != 0) {
    wcsncpy(dest, src, dest_n - 1);
    dest[dest_n - 1] = 0;
  }
  return src_n;
}


x86 assembly (clang, -O0):
<_WLocale_strxfrm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1160 <_WLocale_strxfrm+0x50>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x18(%rbp),%rdx
sub    $0x1,%rdx
call   1030 <wcsncpy@plt>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
sub    $0x1,%rcx
movq   $0x0,(%rax,%rcx,8)
mov    -0x28(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_WLocale_strxfrm>:
push   %r15
push   %r14
push   %rbx
mov    %r8,%r14
test   %rsi,%rsi
je     113b <_WLocale_strxfrm+0x2b>
mov    %rdx,%r15
mov    %rsi,%rbx
add    $0xffffffffffffffff,%rdx
mov    %rsi,%rdi
mov    %rcx,%rsi
call   1030 <wcsncpy@plt>
movq   $0x0,-0x8(%rbx,%r15,8)
mov    %r14,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct._Locale_collate = type { i32 }
define i64 @_WLocale_strxfrm(%struct._Locale_collate* %0, i64* %1, i64 %2, i64* %3, i64 %4) {
%6 = alloca %struct._Locale_collate*
%7 = alloca i64*
%8 = alloca i64
%9 = alloca i64*
%10 = alloca i64
store %struct._Locale_collate* %0, %struct._Locale_collate** %6
store i64* %1, i64** %7
store i64 %2, i64* %8
store i64* %3, i64** %9
store i64 %4, i64* %10
%11 = load i64*, i64** %7
%12 = icmp ne i64* %11, null
br i1 %12, label %13, label %23
13: ; preds = %5
%14 = load i64*, i64** %7
%15 = load i64*, i64** %9
%16 = load i64, i64* %8
%17 = sub i64 %16, 1
%18 = call i32 @wcsncpy(i64* %14, i64* %15, i64 %17)
%19 = load i64*, i64** %7
%20 = load i64, i64* %8
%21 = sub i64 %20, 1
%22 = getelementptr inbounds i64, i64* %19, i64 %21
store i64 0, i64* %22
br label %23
23: ; preds = %13, %5
%24 = load i64, i64* %10
ret i64 %24
}

LLVM IR (-O2):
%struct._Locale_collate = type { i32 }
define i64 @_WLocale_strxfrm(%struct._Locale_collate* nocapture readnone %0, i64* %1, i64 %2, i64* %3, i64 returned %4) {
%6 = icmp eq i64* %1, null
br i1 %6, label %11, label %7
7: ; preds = %5
%8 = add i64 %2, -1
%9 = tail call i32 @wcsncpy(i64* %1, i64* %3, i64 %8)
%10 = getelementptr inbounds i64, i64* %1, i64 %8
store i64 0, i64* %10
br label %11
11: ; preds = %7, %5
ret i64 %4
}
/* Variables and functions */
int /*<<< orphan*/ entab(char *, char *);
int getlineuser(char *, int);
int main() {
  int len;
  char line[1000];
  char eline[1000];
  while ((len = getlineuser(line, 1000)) > 0)
    entab(eline, line);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x7e0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x3f0(%rbp),%rdi
mov    $0x3e8,%esi
call   1030 <getlineuser@plt>
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
jle    1167 <main+0x47>
lea    -0x7e0(%rbp),%rdi
lea    -0x3f0(%rbp),%rsi
call   1040 <entab@plt>
jmp    1132 <main+0x12>
xor    %eax,%eax
add    $0x7e0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x7d8,%rsp
mov    %rsp,%rdi
mov    $0x3e8,%esi
call   1030 <getlineuser@plt>
test   %eax,%eax
jle    116c <main+0x4c>
lea    0x3f0(%rsp),%r14
mov    %rsp,%rbx
cs nopw 0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <entab@plt>
mov    %rbx,%rdi
mov    $0x3e8,%esi
call   1030 <getlineuser@plt>
test   %eax,%eax
jg     1150 <main+0x30>
xor    %eax,%eax
add    $0x7d8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [1000 x i8]
%4 = alloca [1000 x i8]
store i32 0, i32* %1
br label %5
5: ; preds = %9, %0
%6 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 0
%7 = call i32 @getlineuser(i8* %6, i32 1000)
store i32 %7, i32* %2
%8 = icmp sgt i32 %7, 0
br i1 %8, label %9, label %13
9: ; preds = %5
%10 = getelementptr inbounds [1000 x i8], [1000 x i8]* %4, i64 0, i64 0
%11 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 0
%12 = call i32 @entab(i8* %10, i8* %11)
br label %5
13: ; preds = %5
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [1000 x i8]
%2 = alloca [1000 x i8]
%3 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 0
%5 = call i32 @getlineuser(i8* %3, i32 1000)
%6 = icmp sgt i32 %5, 0
br i1 %6, label %7, label %11
7: ; preds = %0, %7
%8 = call i32 @entab(i8* %4, i8* %3)
%9 = call i32 @getlineuser(i8* %3, i32 1000)
%10 = icmp sgt i32 %9, 0
br i1 %10, label %7, label %11
11: ; preds = %7, %0
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int rtfm(char *exe) {
  printf("Usage: %s file.dat output-directory\n", exe);
  return 1;
}


x86 assembly (clang, -O0):
<rtfm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xed9(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rtfm>:
push   %rax
mov    %rdi,%rsi
lea    0xee5(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [37 x i8] c"Usage: %s file.dat output-directory\0A\00"
define i32 @rtfm(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i8* %3)
ret i32 1
}

LLVM IR (-O2):
@.str = [37 x i8] c"Usage: %s file.dat output-directory\0A\00"
define i32 @rtfm(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i8* %0)
ret i32 1
}
void Precache() {}


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

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

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

LLVM IR (-O2):
define void @Precache() {
ret void
}
/* Type definitions */
struct opt_flag {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct opt_flag *);
void opt_flag_free(struct opt_flag *flag) { free(flag); }


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

x86 assembly (clang, -O2):
<opt_flag_free>:
jmp    1030 <free@plt>

LLVM IR (-O0):
%struct.opt_flag = type { i32 }
define void @opt_flag_free(%struct.opt_flag* %0) {
%2 = alloca %struct.opt_flag*
store %struct.opt_flag* %0, %struct.opt_flag** %2
%3 = load %struct.opt_flag*, %struct.opt_flag** %2
%4 = call i32 @free(%struct.opt_flag* %3)
ret void
}

LLVM IR (-O2):
%struct.opt_flag = type { i32 }
define void @opt_flag_free(%struct.opt_flag* nocapture %0) {
%2 = tail call i32 @free(%struct.opt_flag* %0)
ret void
}
void vGpsHold(void) {}


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

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

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

LLVM IR (-O2):
define void @vGpsHold() {
ret void
}
void free_2d(double **array) {
  free(array[0]);
  free(array);
}


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

x86 assembly (clang, -O2):
<free_2d>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @free_2d(double** %0) {
%2 = alloca double**
store double** %0, double*** %2
%3 = load double**, double*** %2
%4 = getelementptr inbounds double*, double** %3, i64 0
%5 = load double*, double** %4
%6 = bitcast double* %5 to i8*
%7 = load double**, double*** %2
%8 = bitcast double** %7 to i8*
ret void
}

LLVM IR (-O2):
define void @free_2d(double** nocapture %0) {
%2 = bitcast double** %0 to i8**
%3 = load i8*, i8** %2
tail call void @free(i8* %3)
%4 = bitcast double** %0 to i8*
tail call void @free(i8* %4)
ret void
}
/* Variables and functions */
unsigned int __blcfill_u32(unsigned int);
unsigned int __attribute__((__target__("tbm")))
blcfill_u32_wrap(unsigned int a) {
  return __blcfill_u32(a);
}


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

x86 assembly (clang, -O2):
<blcfill_u32_wrap>:
jmp    1030 <__blcfill_u32@plt>

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

LLVM IR (-O2):
define i32 @blcfill_u32_wrap(i32 %0) {
%2 = tail call i32 @__blcfill_u32(i32 %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ islower(int);
void t_islower_0x49() {
  Assert_real((islower(73) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_islower.c",
              370, ("islower should be 0 for I"));
}


x86 assembly (clang, -O0):
<t_islower_0x49>:
push   %rbp
mov    %rsp,%rbp
mov    $0x49,%edi
call   1030 <islower@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xebf(%rip),%rsi
mov    $0x172,%edx
lea    0xf5b(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_islower_0x49>:
push   %rax
mov    $0x49,%edi
call   1030 <islower@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x172,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_islower.c\00"
@.str.1 = [26 x i8] c"islower should be 0 for I\00"
define void @t_islower_0x49() {
%1 = call i64 @islower(i32 73)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 370, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_islower.c\00"
@.str.1 = [26 x i8] c"islower should be 0 for I\00"
define void @t_islower_0x49() {
%1 = tail call i64 @islower(i32 73)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 370, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void handler(__attribute__((unused)) int sig) { printf("\tSIGINT received\n"); }


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

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

LLVM IR (-O0):
@.str = [18 x i8] c"\09SIGINT received\0A\00"
define void @handler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [17 x i8] c"\09SIGINT received\00"
define void @handler(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
ret void
}
/* Type definitions */
struct timespec {
  int tv_sec;
  int tv_nsec;
};

/* Variables and functions */
int /*<<< orphan*/ nanosleep(struct timespec *, int /*<<< orphan*/ *);
void nmseffect_sleep(int t) {
  struct timespec ts;
  ts.tv_sec = t / 1000;
  ts.tv_nsec = (t % 1000) * 1000000;
  nanosleep(&ts, NULL);
}


x86 assembly (clang, -O0):
<nmseffect_sleep>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
imul   $0xf4240,%edx,%eax
mov    %eax,-0xc(%rbp)
lea    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <nanosleep@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nmseffect_sleep>:
push   %rax
movslq %edi,%rax
imul   $0x10624dd3,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x26,%rcx
add    %edx,%ecx
mov    %ecx,(%rsp)
imul   $0x3e8,%ecx,%ecx
sub    %ecx,%eax
imul   $0xf4240,%eax,%eax
mov    %eax,0x4(%rsp)
mov    %rsp,%rdi
xor    %esi,%esi
call   1030 <nanosleep@plt>
pop    %rax
ret

LLVM IR (-O0):
%struct.timespec = type { i32, i32 }
define void @nmseffect_sleep(i32 %0) {
%2 = alloca i32
%3 = alloca %struct.timespec
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = sdiv i32 %4, 1000
%6 = getelementptr inbounds %struct.timespec, %struct.timespec* %3, i32 0, i32 0
store i32 %5, i32* %6
%7 = load i32, i32* %2
%8 = srem i32 %7, 1000
%9 = mul nsw i32 %8, 1000000
%10 = getelementptr inbounds %struct.timespec, %struct.timespec* %3, i32 0, i32 1
store i32 %9, i32* %10
%11 = call i32 @nanosleep(%struct.timespec* %3, i32* null)
ret void
}

LLVM IR (-O2):
%struct.timespec = type { i32, i32 }
define void @nmseffect_sleep(i32 %0) {
%2 = alloca %struct.timespec
%3 = bitcast %struct.timespec* %2 to i8*
%4 = sdiv i32 %0, 1000
%5 = getelementptr inbounds %struct.timespec, %struct.timespec* %2, i64 0, i32 0
store i32 %4, i32* %5
%6 = srem i32 %0, 1000
%7 = mul nsw i32 %6, 1000000
%8 = getelementptr inbounds %struct.timespec, %struct.timespec* %2, i64 0, i32 1
store i32 %7, i32* %8
%9 = call i32 @nanosleep(%struct.timespec* %2, i32* null)
ret void
}
void WatchdogReloadSet(unsigned long ulBase, unsigned long ulLoadVal) {
  ;
  (*((volatile unsigned long *)(ulBase + 0x00000000))) = ulLoadVal;
}


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

x86 assembly (clang, -O2):
<WatchdogReloadSet>:
mov    %rsi,(%rdi)
ret

LLVM IR (-O0):
define void @WatchdogReloadSet(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = load i64, i64* %3
%7 = add i64 %6, 0
%8 = inttoptr i64 %7 to i64*
store volatile i64 %5, i64* %8
ret void
}

LLVM IR (-O2):
define void @WatchdogReloadSet(i64 %0, i64 %1) {
%3 = inttoptr i64 %0 to i64*
store volatile i64 %1, i64* %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ coloration(char *, char *);
void defaiteMastermindMulti(void) {
  coloration("Le joueur 2 a gagne !\n", "32");
}


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

x86 assembly (clang, -O2):
<defaiteMastermindMulti>:
lea    0xee9(%rip),%rdi
lea    0xef9(%rip),%rsi
jmp    1030 <coloration@plt>

LLVM IR (-O0):
@.str = [23 x i8] c"Le joueur 2 a gagne !\0A\00"
@.str.1 = [3 x i8] c"32\00"
define void @defaiteMastermindMulti() {
%1 = call i32 @coloration(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [23 x i8] c"Le joueur 2 a gagne !\0A\00"
@.str.1 = [3 x i8] c"32\00"
define void @defaiteMastermindMulti() {
%1 = tail call i32 @coloration(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ _exit(int /*<<< orphan*/);
void sighandler_critical_child(int sig __attribute__((unused))) {
  _exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<sighandler_critical_child>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2ebe(%rip),%rax
mov    (%rax),%edi
call   1030 <_exit@plt>

x86 assembly (clang, -O2):
<sighandler_critical_child>:
push   %rax
mov    0x2ec8(%rip),%rax
mov    (%rax),%edi
call   1030 <_exit@plt>

LLVM IR (-O0):
@EXIT_FAILURE = global i32 0
define void @sighandler_critical_child(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* @EXIT_FAILURE
%4 = call i32 @_exit(i32 %3)
unreachable
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
define void @sighandler_critical_child(i32 %0) {
%2 = load i32, i32* @EXIT_FAILURE
%3 = tail call i32 @_exit(i32 %2)
unreachable
}
void _infix_operator_minus_u16_u16(unsigned short lhs, unsigned short rhs,
                                   unsigned short *__rval_1) {
  *__rval_1 = lhs - rhs;
}


x86 assembly (clang, -O0):
<_infix_operator_minus_u16_u16>:
push   %rbp
mov    %rsp,%rbp
mov    %si,%ax
mov    %di,%cx
mov    %cx,-0x2(%rbp)
mov    %ax,-0x4(%rbp)
mov    %rdx,-0x10(%rbp)
movzwl -0x2(%rbp),%eax
movzwl -0x4(%rbp),%ecx
sub    %ecx,%eax
mov    %ax,%cx
mov    -0x10(%rbp),%rax
mov    %cx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<_infix_operator_minus_u16_u16>:
sub    %esi,%edi
mov    %di,(%rdx)
ret

LLVM IR (-O0):
define void @_infix_operator_minus_u16_u16(i16 zeroext %0, i16 zeroext %1, i16* %2) {
%4 = alloca i16
%5 = alloca i16
%6 = alloca i16*
store i16 %0, i16* %4
store i16 %1, i16* %5
store i16* %2, i16** %6
%7 = load i16, i16* %4
%8 = zext i16 %7 to i32
%9 = load i16, i16* %5
%10 = zext i16 %9 to i32
%11 = sub nsw i32 %8, %10
%12 = trunc i32 %11 to i16
%13 = load i16*, i16** %6
store i16 %12, i16* %13
ret void
}

LLVM IR (-O2):
define void @_infix_operator_minus_u16_u16(i16 zeroext %0, i16 zeroext %1, i16* nocapture writeonly %2) {
%4 = sub i16 %0, %1
store i16 %4, i16* %2
ret void
}
/* Variables and functions */
int has_sse();
int /*<<< orphan*/ printf(char *, int);
int main(void) { printf("has_sse=%d\n", has_sse()); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <has_sse@plt>
mov    %eax,%esi
lea    0xecc(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [12 x i8] c"has_sse=%d\0A\00"
define i32 @main() {
%1 = tail call i32 (...) @has_sse()
%2 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ value;
typedef int /*<<< orphan*/ key;

/* Variables and functions */
int /*<<< orphan*/ BPF_MAP_TYPE_HASH;
int bpf_create_map(int /*<<< orphan*/, int, int, int);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ printf(char *, char *);
char *strerror(int /*<<< orphan*/);
int create_map(void) {
  long long key, value = 0;
  int map_fd;
  map_fd = bpf_create_map(BPF_MAP_TYPE_HASH, sizeof(key), sizeof(value), 1024);
  if (map_fd < 0) {
    printf("failed to create map '%s'\n", strerror(errno));
  }
  return map_fd;
}


x86 assembly (clang, -O0):
<create_map>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movq   $0x0,-0x10(%rbp)
mov    0x2ea9(%rip),%rax
mov    (%rax),%edi
mov    $0x8,%edx
mov    $0x400,%ecx
mov    %edx,%esi
call   1040 <bpf_create_map@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    1184 <create_map+0x54>
mov    0x2e6a(%rip),%rax
mov    (%rax),%edi
call   1050 <strerror@plt>
mov    %rax,%rsi
lea    0xe81(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_map>:
push   %rbx
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
mov    $0x8,%esi
mov    $0x8,%edx
mov    $0x400,%ecx
call   1040 <bpf_create_map@plt>
mov    %eax,%ebx
test   %eax,%eax
jns    1171 <create_map+0x41>
mov    0x2e7d(%rip),%rax
mov    (%rax),%edi
call   1050 <strerror@plt>
lea    0xe97(%rip),%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@BPF_MAP_TYPE_HASH = global i32 0
@.str = [27 x i8] c"failed to create map '%s'\0A\00"
@errno = global i32 0
define i32 @create_map() {
%1 = alloca i64
%2 = alloca i64
%3 = alloca i32
store i64 0, i64* %2
%4 = load i32, i32* @BPF_MAP_TYPE_HASH
%5 = call i32 @bpf_create_map(i32 %4, i32 8, i32 8, i32 1024)
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 0
br i1 %7, label %8, label %12
8: ; preds = %0
%9 = load i32, i32* @errno
%10 = call i8* @strerror(i32 %9)
%11 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %10)
br label %12
12: ; preds = %8, %0
%13 = load i32, i32* %3
ret i32 %13
}

LLVM IR (-O2):
@BPF_MAP_TYPE_HASH = global i32 0
@.str = [27 x i8] c"failed to create map '%s'\0A\00"
@errno = global i32 0
define i32 @create_map() {
%1 = load i32, i32* @BPF_MAP_TYPE_HASH
%2 = tail call i32 @bpf_create_map(i32 %1, i32 8, i32 8, i32 1024)
%3 = icmp slt i32 %2, 0
br i1 %3, label %4, label %8
4: ; preds = %0
%5 = load i32, i32* @errno
%6 = tail call i8* @strerror(i32 %5)
%7 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %6)
br label %8
8: ; preds = %4, %0
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ perror(char *);
void PANIC(char *msg) {
  perror(msg);
  exit(-1);
}


x86 assembly (clang, -O0):
<PANIC>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <perror@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<PANIC>:
push   %rax
call   1030 <perror@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
define void @PANIC(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @perror(i8* %3)
%5 = call i32 @exit(i32 -1)
unreachable
}

LLVM IR (-O2):
define void @PANIC(i8* nocapture %0) {
%2 = tail call i32 @perror(i8* %0)
%3 = tail call i32 @exit(i32 -1)
unreachable
}
/* Type definitions */
struct rtbst_table {
  int dummy;
};

/* Variables and functions */
void **rtbst_probe(struct rtbst_table *, void *);
void *rtbst_insert(struct rtbst_table *table, void *item) {
  void **p = rtbst_probe(table, item);
  return p == NULL || *p == item ? NULL : *p;
}


x86 assembly (clang, -O0):
<rtbst_insert>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <rtbst_probe@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     114d <rtbst_insert+0x3d>
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
cmp    -0x10(%rbp),%rax
jne    1158 <rtbst_insert+0x48>
xor    %eax,%eax
mov    %rax,-0x20(%rbp)
jmp    1163 <rtbst_insert+0x53>
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rtbst_insert>:
push   %rbx
mov    %rsi,%rbx
call   1030 <rtbst_probe@plt>
test   %rax,%rax
je     112c <rtbst_insert+0x1c>
mov    (%rax),%rcx
xor    %eax,%eax
cmp    %rbx,%rcx
cmovne %rcx,%rax
pop    %rbx
ret
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.rtbst_table = type { i32 }
define i8* @rtbst_insert(%struct.rtbst_table* %0, i8* %1) {
%3 = alloca %struct.rtbst_table*
%4 = alloca i8*
%5 = alloca i8**
store %struct.rtbst_table* %0, %struct.rtbst_table** %3
store i8* %1, i8** %4
%6 = load %struct.rtbst_table*, %struct.rtbst_table** %3
%7 = load i8*, i8** %4
%8 = call i8** @rtbst_probe(%struct.rtbst_table* %6, i8* %7)
store i8** %8, i8*** %5
%9 = load i8**, i8*** %5
%10 = icmp eq i8** %9, null
br i1 %10, label %16, label %11
11: ; preds = %2
%12 = load i8**, i8*** %5
%13 = load i8*, i8** %12
%14 = load i8*, i8** %4
%15 = icmp eq i8* %13, %14
br i1 %15, label %16, label %17
16: ; preds = %11, %2
br label %20
17: ; preds = %11
%18 = load i8**, i8*** %5
%19 = load i8*, i8** %18
br label %20
20: ; preds = %17, %16
%21 = phi i8* [ null, %16 ], [ %19, %17 ]
ret i8* %21
}

LLVM IR (-O2):
%struct.rtbst_table = type { i32 }
define i8* @rtbst_insert(%struct.rtbst_table* %0, i8* %1) {
%3 = tail call i8** @rtbst_probe(%struct.rtbst_table* %0, i8* %1)
%4 = icmp eq i8** %3, null
br i1 %4, label %9, label %5
5: ; preds = %2
%6 = load i8*, i8** %3
%7 = icmp eq i8* %6, %1
%8 = select i1 %7, i8* null, i8* %6
br label %9
9: ; preds = %5, %2
%10 = phi i8* [ null, %2 ], [ %8, %5 ]
ret i8* %10
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void client_cleanup(void *arg) {
  printf("cleaning up ressources allocated by client thread: %s\n",
         (char *)arg);
}


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

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

LLVM IR (-O0):
@.str = [55 x i8] c"cleaning up ressources allocated by client thread: %s\0A\00"
define void @client_cleanup(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [55 x i8] c"cleaning up ressources allocated by client thread: %s\0A\00"
define void @client_cleanup(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
char *A7_command_read_string();
int /*<<< orphan*/ printf(char *);
void A7HTTP_ShowSerialData() {
  printf(A7_command_read_string());
  printf(A7_command_read_string());
  printf(A7_command_read_string());
}


x86 assembly (clang, -O0):
<A7HTTP_ShowSerialData>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <A7_command_read_string@plt>
mov    %rax,%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <A7_command_read_string@plt>
mov    %rax,%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <A7_command_read_string@plt>
mov    %rax,%rdi
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<A7HTTP_ShowSerialData>:
push   %rax
xor    %eax,%eax
call   1040 <A7_command_read_string@plt>
mov    %rax,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
call   1040 <A7_command_read_string@plt>
mov    %rax,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
call   1040 <A7_command_read_string@plt>
mov    %rax,%rdi
pop    %rax
jmp    1030 <printf@plt>

LLVM IR (-O0):
define void @A7HTTP_ShowSerialData() {
%1 = call i8* (...) @A7_command_read_string()
%2 = call i32 @printf(i8* %1)
%3 = call i8* (...) @A7_command_read_string()
%4 = call i32 @printf(i8* %3)
%5 = call i8* (...) @A7_command_read_string()
%6 = call i32 @printf(i8* %5)
ret void
}

LLVM IR (-O2):
define void @A7HTTP_ShowSerialData() {
%1 = tail call i8* (...) @A7_command_read_string()
%2 = tail call i32 @printf(i8* dereferenceable(1) %1)
%3 = tail call i8* (...) @A7_command_read_string()
%4 = tail call i32 @printf(i8* dereferenceable(1) %3)
%5 = tail call i8* (...) @A7_command_read_string()
%6 = tail call i32 @printf(i8* dereferenceable(1) %5)
ret void
}
/* Type definitions */
typedef long uint64_t;

/* Variables and functions */
int /*<<< orphan*/ _SC_PAGESIZE;
long sysconf(int /*<<< orphan*/);
uint64_t align_up(uint64_t size) {
  long pagesize = sysconf(_SC_PAGESIZE);
  uint64_t ret = size;
  if (ret % pagesize != 0) {
    ret += pagesize - ret % pagesize;
  }
  return ret;
}


x86 assembly (clang, -O0):
<align_up>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
call   1030 <sysconf@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cqto
idivq  -0x10(%rbp)
cmp    $0x0,%rdx
je     116b <align_up+0x5b>
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
cqto
idivq  -0x10(%rbp)
mov    -0x20(%rbp),%rax
sub    %rdx,%rax
add    -0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<align_up>:
push   %rbx
mov    %rdi,%rbx
mov    0x2ecd(%rip),%rax
mov    (%rax),%edi
call   1030 <sysconf@plt>
mov    %rax,%rcx
mov    %rbx,%rax
or     %rcx,%rax
shr    $0x20,%rax
je     113b <align_up+0x2b>
mov    %rbx,%rax
cqto
idiv   %rcx
jmp    1141 <align_up+0x31>
mov    %ebx,%eax
xor    %edx,%edx
div    %ecx
sub    %rdx,%rcx
test   %rdx,%rdx
cmove  %rdx,%rcx
add    %rbx,%rcx
mov    %rcx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@_SC_PAGESIZE = global i32 0
define i64 @align_up(i64 %0) {
%2 = alloca i64
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %2
%5 = load i32, i32* @_SC_PAGESIZE
%6 = call i64 @sysconf(i32 %5)
store i64 %6, i64* %3
%7 = load i64, i64* %2
store i64 %7, i64* %4
%8 = load i64, i64* %4
%9 = load i64, i64* %3
%10 = srem i64 %8, %9
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %20
12: ; preds = %1
%13 = load i64, i64* %3
%14 = load i64, i64* %4
%15 = load i64, i64* %3
%16 = srem i64 %14, %15
%17 = sub nsw i64 %13, %16
%18 = load i64, i64* %4
%19 = add nsw i64 %18, %17
store i64 %19, i64* %4
br label %20
20: ; preds = %12, %1
%21 = load i64, i64* %4
ret i64 %21
}

LLVM IR (-O2):
@_SC_PAGESIZE = global i32 0
define i64 @align_up(i64 %0) {
%2 = load i32, i32* @_SC_PAGESIZE
%3 = tail call i64 @sysconf(i32 %2)
%4 = srem i64 %0, %3
%5 = icmp eq i64 %4, 0
%6 = sub nsw i64 %3, %4
%7 = select i1 %5, i64 0, i64 %6
%8 = add nsw i64 %7, %0
ret i64 %8
}
void g_option_context_add_group() {}


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

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

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

LLVM IR (-O2):
define void @g_option_context_add_group() {
ret void
}
int Sys_GetHighQualityCPU() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @Sys_GetHighQualityCPU() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ foo(unsigned long long *);
void __attribute__((no)) do_test(unsigned long long *r) {
  int i;
  for (i = 0; i < 2; ++i)
    foo(r);
}


x86 assembly (clang, -O0):
<do_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x2,-0xc(%rbp)
jge    1144 <do_test+0x34>
mov    -0x8(%rbp),%rdi
call   1030 <foo@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <do_test+0x13>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_test>:
push   %rbx
mov    %rdi,%rbx
call   1030 <foo@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <foo@plt>

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

LLVM IR (-O2):
define void @do_test(i64* %0) {
%2 = tail call i32 @foo(i64* %0)
%3 = tail call i32 @foo(i64* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ int_test();
int /*<<< orphan*/ object_test();
int /*<<< orphan*/ string_test();
int main() {
  int_test();
  string_test();
  object_test();
  getchar();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <int_test@plt>
mov    $0x0,%al
call   1050 <string_test@plt>
mov    $0x0,%al
call   1060 <object_test@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <int_test@plt>
xor    %eax,%eax
call   1050 <string_test@plt>
xor    %eax,%eax
call   1060 <object_test@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @int_test()
%3 = call i32 (...) @string_test()
%4 = call i32 (...) @object_test()
%5 = call i32 (...) @getchar()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @int_test()
%2 = tail call i32 (...) @string_test()
%3 = tail call i32 (...) @object_test()
%4 = tail call i32 (...) @getchar()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
char *malloc(int);
char *realloc(char *, int);
int main(void) {
  char *ptr = malloc(100);
  if (ptr == NULL)
    return -1;
  ptr = realloc(ptr, 200);
  if (ptr == NULL)
    return -1;
  free(ptr);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x64,%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1164 <main+0x34>
movl   $0xffffffff,-0x4(%rbp)
jmp    119d <main+0x6d>
mov    -0x10(%rbp),%rdi
mov    $0xc8,%esi
call   1050 <realloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    118d <main+0x5d>
movl   $0xffffffff,-0x4(%rbp)
jmp    119d <main+0x6d>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x64,%edi
call   1040 <malloc@plt>
mov    $0xffffffff,%ebx
test   %rax,%rax
je     1161 <main+0x31>
mov    %rax,%rdi
mov    $0xc8,%esi
call   1050 <realloc@plt>
test   %rax,%rax
je     1161 <main+0x31>
mov    %rax,%rdi
call   1030 <free@plt>
xor    %ebx,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
store i32 0, i32* %1
%3 = call i8* @malloc(i32 100)
store i8* %3, i8** %2
%4 = load i8*, i8** %2
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %7
6: ; preds = %0
store i32 -1, i32* %1
br label %16
7: ; preds = %0
%8 = load i8*, i8** %2
%9 = call i8* @realloc(i8* %8, i32 200)
store i8* %9, i8** %2
%10 = load i8*, i8** %2
%11 = icmp eq i8* %10, null
br i1 %11, label %12, label %13
12: ; preds = %7
store i32 -1, i32* %1
br label %16
13: ; preds = %7
%14 = load i8*, i8** %2
%15 = call i32 @free(i8* %14)
store i32 0, i32* %1
br label %16
16: ; preds = %13, %12, %6
%17 = load i32, i32* %1
ret i32 %17
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call dereferenceable_or_null(100) i8* @malloc(i32 100)
%2 = icmp eq i8* %1, null
br i1 %2, label %8, label %3
3: ; preds = %0
%4 = tail call i8* @realloc(i8* %1, i32 200)
%5 = icmp eq i8* %4, null
br i1 %5, label %8, label %6
6: ; preds = %3
%7 = tail call i32 @free(i8* %4)
br label %8
8: ; preds = %3, %0, %6
%9 = phi i32 [ 0, %6 ], [ -1, %0 ], [ -1, %3 ]
ret i32 %9
}
double FcnCsubL(long lxSubject, long lH, long lI, long lJ, long lK, long lL) {
  return ((double)lI);
}


x86 assembly (clang, -O0):
<FcnCsubL>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
cvtsi2sdq -0x18(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<FcnCsubL>:
cvtsi2sd %rdx,%xmm0
ret

LLVM IR (-O0):
define double @FcnCsubL(i64 %0, i64 %1, i64 %2, i64 %3, i64 %4, i64 %5) {
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
%10 = alloca i64
%11 = alloca i64
%12 = alloca i64
store i64 %0, i64* %7
store i64 %1, i64* %8
store i64 %2, i64* %9
store i64 %3, i64* %10
store i64 %4, i64* %11
store i64 %5, i64* %12
%13 = load i64, i64* %9
%14 = sitofp i64 %13 to double
ret double %14
}

LLVM IR (-O2):
define double @FcnCsubL(i64 %0, i64 %1, i64 %2, i64 %3, i64 %4, i64 %5) {
%7 = sitofp i64 %2 to double
ret double %7
}
/* Type definitions */
typedef unsigned long volatile uint32_t;

/* Variables and functions */
uint32_t I2CMasterDataGet(uint32_t ui32Base) {
  ;
  return ((*((volatile unsigned long *)(0x40002000 + 0x00000808))));
}


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

x86 assembly (clang, -O2):
<I2CMasterDataGet>:
mov    %rdi,-0x8(%rsp)
mov    0x40002808,%rax
40
ret

LLVM IR (-O0):
define i64 @I2CMasterDataGet(i64 %0) {
%2 = alloca i64
store volatile i64 %0, i64* %2
%3 = load volatile i64, i64* inttoptr (i64 1073752072 to i64*)
ret i64 %3
}

LLVM IR (-O2):
define i64 @I2CMasterDataGet(i64 %0) {
%2 = alloca i64
store volatile i64 %0, i64* %2
%3 = load volatile i64, i64* inttoptr (i64 1073752072 to i64*)
ret i64 %3
}
int get_least_significant_byte(int x) {
  return (0xFF000000 & (x << (sizeof(int) * 6)));
}


x86 assembly (clang, -O0):
<get_least_significant_byte>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x18,%eax
and    $0xff000000,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @get_least_significant_byte(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = shl i32 %3, 24
%5 = and i32 -16777216, %4
ret i32 %5
}

LLVM IR (-O2):
define i32 @get_least_significant_byte(i32 %0) {
%2 = shl i32 %0, 24
ret i32 %2
}
/* Variables and functions */
scalar_t__ read_int_dec_or_hex(char *);
int /*<<< orphan*/ send_req(int, int, int, int);
int u_enable_tx(int fd, char **argv) {
  argv = argv;
  send_req(fd, 0x00, read_int_dec_or_hex(argv[0]) ? 0x04 : 0, 1);
  return 0;
}


x86 assembly (clang, -O0):
<u_enable_tx>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1040 <read_int_dec_or_hex@plt>
mov    -0x14(%rbp),%edi
mov    %rax,%rcx
xor    %edx,%edx
mov    $0x4,%eax
cmp    $0x0,%rcx
cmovne %eax,%edx
xor    %esi,%esi
mov    $0x1,%ecx
call   1030 <send_req@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<u_enable_tx>:
push   %rbx
mov    %edi,%ebx
mov    (%rsi),%rdi
call   1040 <read_int_dec_or_hex@plt>
xor    %edx,%edx
test   %rax,%rax
setne  %dl
shl    $0x2,%edx
mov    %ebx,%edi
xor    %esi,%esi
mov    $0x1,%ecx
call   1030 <send_req@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @u_enable_tx(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = load i8**, i8*** %4
store i8** %5, i8*** %4
%6 = load i32, i32* %3
%7 = load i8**, i8*** %4
%8 = getelementptr inbounds i8*, i8** %7, i64 0
%9 = load i8*, i8** %8
%10 = call i64 @read_int_dec_or_hex(i8* %9)
%11 = icmp ne i64 %10, 0
%12 = zext i1 %11 to i64
%13 = select i1 %11, i32 4, i32 0
%14 = call i32 @send_req(i32 %6, i32 0, i32 %13, i32 1)
ret i32 0
}

LLVM IR (-O2):
define i32 @u_enable_tx(i32 %0, i8** nocapture %1) {
%3 = load i8*, i8** %1
%4 = tail call i64 @read_int_dec_or_hex(i8* %3)
%5 = icmp eq i64 %4, 0
%6 = select i1 %5, i32 0, i32 4
%7 = tail call i32 @send_req(i32 %0, i32 0, i32 %6, i32 1)
ret i32 0
}
int drm_device_find_capability(struct drm_device *dev, int cap) {}


x86 assembly (clang, -O0):
<drm_device_find_capability>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.drm_device = type opaque
define i32 @drm_device_find_capability(%struct.drm_device* %0, i32 %1) {
%3 = alloca i32
%4 = alloca %struct.drm_device*
%5 = alloca i32
store %struct.drm_device* %0, %struct.drm_device** %4
store i32 %1, i32* %5
%6 = load i32, i32* %3
ret i32 %6
}

LLVM IR (-O2):
%struct.drm_device = type opaque
define i32 @drm_device_find_capability(%struct.drm_device* nocapture readnone %0, i32 %1) {
ret i32 undef
}
int __attribute__((no)) ustrsize(const char *s) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @ustrsize(i8* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ perror(char *);
void waitpid_error() { perror("waitpid error"); }


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

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

LLVM IR (-O0):
@.str = [14 x i8] c"waitpid error\00"
define void @waitpid_error() {
%1 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"waitpid error\00"
define void @waitpid_error() {
%1 = tail call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret void
}
int smallestPowerOfTwoAfter(int x) {
  if (x < 0)
    return 0;
  x |= x >> 1;
  x |= x >> 2;
  x |= x >> 4;
  x |= x >> 8;
  x |= x >> 16;
  return x + 1;
}


x86 assembly (clang, -O0):
<smallestPowerOfTwoAfter>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    111d <smallestPowerOfTwoAfter+0x1d>
movl   $0x0,-0x4(%rbp)
jmp    1162 <smallestPowerOfTwoAfter+0x62>
mov    -0x8(%rbp),%eax
sar    $0x1,%eax
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
sar    $0x2,%eax
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
sar    $0x4,%eax
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
sar    $0x8,%eax
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
sar    $0x10,%eax
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<smallestPowerOfTwoAfter>:
test   %edi,%edi
js     112a <smallestPowerOfTwoAfter+0x2a>
mov    %edi,%eax
shr    %eax
or     %edi,%eax
mov    %eax,%ecx
sar    $0x2,%ecx
or     %eax,%ecx
mov    %ecx,%eax
sar    $0x4,%eax
or     %ecx,%eax
mov    %eax,%ecx
sar    $0x8,%ecx
or     %eax,%ecx
mov    %ecx,%eax
sar    $0x10,%eax
or     %ecx,%eax
add    $0x1,%eax
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @smallestPowerOfTwoAfter(i32 %0) {
%2 = icmp slt i32 %0, 0
br i1 %2, label %15, label %3
3: ; preds = %1
%4 = lshr i32 %0, 1
%5 = or i32 %4, %0
%6 = ashr i32 %5, 2
%7 = or i32 %6, %5
%8 = ashr i32 %7, 4
%9 = or i32 %8, %7
%10 = ashr i32 %9, 8
%11 = or i32 %10, %9
%12 = ashr i32 %11, 16
%13 = or i32 %12, %11
%14 = add nsw i32 %13, 1
br label %15
15: ; preds = %1, %3
%16 = phi i32 [ %14, %3 ], [ 0, %1 ]
ret i32 %16
}