xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ gpio_unexport(int);
int gpio_deinit_port(void) {
  if (!gpio_unexport(27) && !gpio_unexport(17))
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<gpio_deinit_port>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x1b,%edi
call   1030 <gpio_unexport@plt>
cmp    $0x0,%eax
jne    114a <gpio_deinit_port+0x3a>
mov    $0x11,%edi
call   1030 <gpio_unexport@plt>
cmp    $0x0,%eax
jne    114a <gpio_deinit_port+0x3a>
movl   $0x0,-0x4(%rbp)
jmp    1151 <gpio_deinit_port+0x41>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gpio_deinit_port>:
push   %rax
mov    $0x1b,%edi
call   1030 <gpio_unexport@plt>
test   %eax,%eax
jne    112d <gpio_deinit_port+0x1d>
mov    $0x11,%edi
call   1030 <gpio_unexport@plt>
test   %eax,%eax
je     1134 <gpio_deinit_port+0x24>
mov    $0x1,%eax
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @gpio_deinit_port() {
%1 = alloca i32
%2 = call i32 @gpio_unexport(i32 27)
%3 = icmp ne i32 %2, 0
br i1 %3, label %8, label %4
4: ; preds = %0
%5 = call i32 @gpio_unexport(i32 17)
%6 = icmp ne i32 %5, 0
br i1 %6, label %8, label %7
7: ; preds = %4
store i32 0, i32* %1
br label %9
8: ; preds = %4, %0
store i32 1, i32* %1
br label %9
9: ; preds = %8, %7
%10 = load i32, i32* %1
ret i32 %10
}

LLVM IR (-O2):
define i32 @gpio_deinit_port() {
%1 = tail call i32 @gpio_unexport(i32 27)
%2 = icmp eq i32 %1, 0
br i1 %2, label %3, label %6
3: ; preds = %0
%4 = tail call i32 @gpio_unexport(i32 17)
%5 = icmp eq i32 %4, 0
br i1 %5, label %7, label %6
6: ; preds = %3, %0
br label %7
7: ; preds = %3, %6
%8 = phi i32 [ 1, %6 ], [ 0, %3 ]
ret i32 %8
}
/* Variables and functions */
int rmdir(char *);
int wfile_strong_rmdir(char *dirname) {
  int status;
  status = rmdir(dirname);
  return (status);
}


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

x86 assembly (clang, -O2):
<wfile_strong_rmdir>:
jmp    1030 <rmdir@plt>

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

LLVM IR (-O2):
define i32 @wfile_strong_rmdir(i8* nocapture %0) {
%2 = tail call i32 @rmdir(i8* %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void print_usage(char *name) {
  printf("Usage: %s <n1> <n2> \n"
         "       where <n1> <n2> are positive integers\n",
         name);
}


x86 assembly (clang, -O0):
<print_usage>:
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):
<print_usage>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [67 x i8] c"Usage: %s <n1> <n2> \0A where <n1> <n2> are positive integers\0A\00"
define void @print_usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [67 x i8] c"Usage: %s <n1> <n2> \0A where <n1> <n2> are positive integers\0A\00"
define void @print_usage(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
char getchar();
int /*<<< orphan*/ printf(char *);
int main() {
  char c = 0;
  c = getchar();
  switch (c) {
  case 'a':
    printf("case a;\n");
    break;
  default:
    printf("default;\n");
    break;
  };
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movb   $0x0,-0x5(%rbp)
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
sub    $0x61,%al
jne    115e <main+0x3e>
jmp    114d <main+0x2d>
lea    0xeac(%rip),%rdi
call   1030 <printf@plt>
jmp    116a <main+0x4a>
lea    0xea4(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    $0x61,%al
lea    0xed8(%rip),%rax
lea    0xec8(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [9 x i8] c"case a;\0A\00"
@.str.1 = [10 x i8] c"default;\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
store i32 0, i32* %1
store i8 0, i8* %2
%3 = call signext i8 (...) @getchar()
store i8 %3, i8* %2
%4 = load i8, i8* %2
%5 = sext i8 %4 to i32
switch i32 %5, label %8 [
i32 97, label %6
]
6: ; preds = %0
%7 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
br label %10
8: ; preds = %0
%9 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
br label %10
10: ; preds = %8, %6
%11 = load i32, i32* %1
ret i32 %11
}

LLVM IR (-O2):
@str = [9 x i8] c"default;\00"
@str.2 = [8 x i8] c"case a;\00"
define i32 @main() {
%1 = tail call signext i8 (...) @getchar()
%2 = icmp eq i8 %1, 97
%3 = select i1 %2, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @str.2, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0)
%4 = tail call i32 @puts(i8* dereferenceable(1) %3)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ nextafter(double, double);
int /*<<< orphan*/ nextafterf(float, float);
int /*<<< orphan*/ nextafterl(long double, long double);
void uninitvar_nextafter(void) {
  float f1, f2;
  (void)nextafterf(f1, f2);
  double d1, d2;
  (void)nextafter(d1, d2);
  long double ld1, ld2;
  (void)nextafterl(ld1, ld2);
}


x86 assembly (clang, -O0):
<uninitvar_nextafter>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
call   1050 <nextafterf@plt>
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
call   1040 <nextafter@plt>
fldt   -0x30(%rbp)
fldt   -0x40(%rbp)
mov    %rsp,%rax
fstpt  0x10(%rax)
fstpt  (%rax)
call   1030 <nextafterl@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uninitvar_nextafter>:
sub    $0x28,%rsp
call   1050 <nextafterf@plt>
call   1040 <nextafter@plt>
call   1030 <nextafterl@plt>
add    $0x28,%rsp
ret

LLVM IR (-O0):
define void @uninitvar_nextafter() {
%1 = alloca float
%2 = alloca float
%3 = alloca double
%4 = alloca double
%5 = alloca x86_fp80
%6 = alloca x86_fp80
%7 = load float, float* %1
%8 = load float, float* %2
%9 = call i32 @nextafterf(float %7, float %8)
%10 = load double, double* %3
%11 = load double, double* %4
%12 = call i32 @nextafter(double %10, double %11)
%13 = load x86_fp80, x86_fp80* %5
%14 = load x86_fp80, x86_fp80* %6
%15 = call i32 @nextafterl(x86_fp80 %13, x86_fp80 %14)
ret void
}

LLVM IR (-O2):
define void @uninitvar_nextafter() {
%1 = tail call i32 @nextafterf(float undef, float undef)
%2 = tail call i32 @nextafter(double undef, double undef)
%3 = tail call i32 @nextafterl(x86_fp80 undef, x86_fp80 undef)
ret void
}
/* Type definitions */
struct file {
  int dummy;
};

/* Variables and functions */
struct file *file_init_depth(char const *, int);
struct file *file_init(const char *filepath) {
  return file_init_depth(filepath, -1);
}


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

x86 assembly (clang, -O2):
<file_init>:
mov    $0xffffffff,%esi
jmp    1030 <file_init_depth@plt>

LLVM IR (-O0):
%struct.file = type { i32 }
define %struct.file* @file_init(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call %struct.file* @file_init_depth(i8* %3, i32 -1)
ret %struct.file* %4
}

LLVM IR (-O2):
%struct.file = type { i32 }
define %struct.file* @file_init(i8* %0) {
%2 = tail call %struct.file* @file_init_depth(i8* %0, i32 -1)
ret %struct.file* %2
}
void RTProcDaemonizeUsingFork(void) {}


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

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

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

LLVM IR (-O2):
define void @RTProcDaemonizeUsingFork() {
ret void
}
f() {
  extern int j;
  f();
  extern int j;
}


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

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

LLVM IR (-O0):
define i32 @f() {
%1 = alloca i32
%2 = call i32 @f()
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
define i32 @f() {
br label %1
1: ; preds = %1, %0
br label %1
}
/* Variables and functions */
void *malloc(size_t);
void *objc_atomic_malloc(size_t size) { return malloc(size); }


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

x86 assembly (clang, -O2):
<objc_atomic_malloc>:
jmp    1030 <malloc@plt>

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

LLVM IR (-O2):
define noalias i8* @objc_atomic_malloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(void) {
  printf("Hello World\n");
  return (0);
}


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

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

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

LLVM IR (-O2):
@str = [12 x i8] c"Hello World\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, void *);
int /*<<< orphan*/ stderr;
void rtpp_log_setlevel_fin(void *pub) {
  fprintf(stderr,
          "Method rtpp_log@%p::setlevel (rtpp_log_setlevel) is invoked after "
          "destruction\x0a",
          pub);
  abort();
}


x86 assembly (clang, -O0):
<rtpp_log_setlevel_fin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xec0(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x0,%al
call   1030 <abort@plt>

x86 assembly (clang, -O2):
<rtpp_log_setlevel_fin>:
push   %rax
mov    %rdi,%rdx
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1040 <fprintf@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [79 x i8] c"Method rtpp_log@%p::setlevel (rtpp_log_setlevel) is invoked after destruction\0A\00"
define void @rtpp_log_setlevel_fin(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = call i32 (...) @abort()
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [79 x i8] c"Method rtpp_log@%p::setlevel (rtpp_log_setlevel) is invoked after destruction\0A\00"
define void @rtpp_log_setlevel_fin(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call i32 (...) @abort()
unreachable
}
/* Type definitions */
typedef int uint8_t;
typedef int uint16_t;

/* Variables and functions */
void modbusMaskWrite(uint8_t *mask, uint16_t n, uint8_t value) {
  if (value)
    mask[n >> 3] |= (1 << (n & 7));
  else
    mask[n >> 3] &= ~(1 << (n & 7));
}


x86 assembly (clang, -O0):
<modbusMaskWrite>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
je     113d <modbusMaskWrite+0x3d>
mov    -0xc(%rbp),%ecx
and    $0x7,%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sar    $0x3,%ecx
movslq %ecx,%rcx
or     (%rax,%rcx,4),%edx
mov    %edx,(%rax,%rcx,4)
jmp    1160 <modbusMaskWrite+0x60>
mov    -0xc(%rbp),%ecx
and    $0x7,%ecx
mov    $0x1,%edx
shl    %cl,%edx
xor    $0xffffffff,%edx
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sar    $0x3,%ecx
movslq %ecx,%rcx
and    (%rax,%rcx,4),%edx
mov    %edx,(%rax,%rcx,4)
pop    %rbp
ret

x86 assembly (clang, -O2):
<modbusMaskWrite>:
mov    %esi,%ecx
and    $0x7,%cl
mov    $0x1,%eax
shl    %cl,%eax
test   %edx,%edx
je     111a <modbusMaskWrite+0x1a>
sar    $0x3,%esi
movslq %esi,%rcx
or     %eax,(%rdi,%rcx,4)
ret
not    %eax
sar    $0x3,%esi
movslq %esi,%rcx
and    %eax,(%rdi,%rcx,4)
ret

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

LLVM IR (-O2):
define void @modbusMaskWrite(i32* nocapture %0, i32 %1, i32 %2) {
%4 = icmp eq i32 %2, 0
%5 = and i32 %1, 7
%6 = shl nuw nsw i32 1, %5
br i1 %4, label %13, label %7
7: ; preds = %3
%8 = ashr i32 %1, 3
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds i32, i32* %0, i64 %9
%11 = load i32, i32* %10
%12 = or i32 %11, %6
store i32 %12, i32* %10
br label %20
13: ; preds = %3
%14 = xor i32 %6, -1
%15 = ashr i32 %1, 3
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i32, i32* %0, i64 %16
%18 = load i32, i32* %17
%19 = and i32 %18, %14
store i32 %19, i32* %17
br label %20
20: ; preds = %13, %7
ret void
}
/* Variables and functions */
int /*<<< orphan*/ t();
int g(float b, short c) {
  t();
  return c + (int)b;
}


x86 assembly (clang, -O0):
<g>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %di,%ax
movss  %xmm0,-0x4(%rbp)
mov    %ax,-0x6(%rbp)
mov    $0x0,%al
call   1030 <t@plt>
movswl -0x6(%rbp),%eax
cvttss2si -0x4(%rbp),%ecx
add    %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<g>:
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebx
movss  %xmm0,0xc(%rsp)
xor    %eax,%eax
call   1030 <t@plt>
cvttss2si 0xc(%rsp),%eax
add    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @g(float %0, i16 signext %1) {
%3 = alloca float
%4 = alloca i16
store float %0, float* %3
store i16 %1, i16* %4
%5 = call i32 (...) @t()
%6 = load i16, i16* %4
%7 = sext i16 %6 to i32
%8 = load float, float* %3
%9 = fptosi float %8 to i32
%10 = add nsw i32 %7, %9
ret i32 %10
}

LLVM IR (-O2):
define i32 @g(float %0, i16 signext %1) {
%3 = tail call i32 (...) @t()
%4 = sext i16 %1 to i32
%5 = fptosi float %0 to i32
%6 = add nsw i32 %4, %5
ret i32 %6
}
int test_imm_A7uint32_reg(unsigned int val) {
  return ((val) & (0xA7 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_A7uint32_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
and    $0xa7,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @test_imm_A7uint32_reg(i32 %0) {
%2 = and i32 %0, 167
%3 = icmp eq i32 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ f();
int /*<<< orphan*/ printf(char *);
int main() {
  printf("Hello from C!\n");
  f();
}


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

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

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

LLVM IR (-O2):
@str = [14 x i8] c"Hello from C!\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (...) @f()
ret i32 0
}
int test_imm_EFuint64_midword_mem(unsigned long long *val) {
  return ((*val >> 16) & (0xEF << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_EFuint64_midword_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdx
shr    $0x10,%rdx
and    $0xef,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_EFuint64_midword_mem>:
testb  $0xef,0x2(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_EFuint64_midword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 15663104
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ cl_mem;

/* Variables and functions */
int /*<<< orphan*/ clReleaseMemObject(int /*<<< orphan*/);
void OpenCL_LBM_freeGrid(cl_mem ptr) { clReleaseMemObject(ptr); }


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

x86 assembly (clang, -O2):
<OpenCL_LBM_freeGrid>:
jmp    1030 <clReleaseMemObject@plt>

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

LLVM IR (-O2):
define void @OpenCL_LBM_freeGrid(i32 %0) {
%2 = tail call i32 @clReleaseMemObject(i32 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ print_array(int *, int);
int main() {
  int g[11] = {6, 4, 2, 15, 68, 8, 6, 2, 7, 0, 3};
  print_array(&*g, 11);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
lea    -0x30(%rbp),%rdi
lea    0xecd(%rip),%rsi
mov    $0x2c,%edx
call   1040 <memcpy@plt>
lea    -0x30(%rbp),%rdi
mov    $0xb,%esi
call   1030 <print_array@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x38,%rsp
movups 0xf01(%rip),%xmm0
movups %xmm0,0x1c(%rsp)
movaps 0xee9(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xecd(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0xb,%esi
call   1030 <print_array@plt>
xor    %eax,%eax
add    $0x38,%rsp
ret

LLVM IR (-O0):
@__const.main.g = [11 x i32] [i32 6, i32 4, i32 2, i32 15, i32 68, i32 8, i32 6, i32 2, i32 7, i32 0, i32 3]
define i32 @main() {
%1 = alloca [11 x i32]
%2 = bitcast [11 x i32]* %1 to i8*
%3 = getelementptr inbounds [11 x i32], [11 x i32]* %1, i64 0, i64 0
%4 = call i32 @print_array(i32* %3, i32 11)
ret i32 0
}

LLVM IR (-O2):
@__const.main.g = [11 x i32] [i32 6, i32 4, i32 2, i32 15, i32 68, i32 8, i32 6, i32 2, i32 7, i32 0, i32 3]
define i32 @main() {
%1 = alloca [11 x i32]
%2 = bitcast [11 x i32]* %1 to i8*
%3 = getelementptr inbounds [11 x i32], [11 x i32]* %1, i64 0, i64 0
%4 = call i32 @print_array(i32* %3, i32 11)
ret i32 0
}
/* Variables and functions */
int syscall(int, void const *);
int shmdt(const void *addr) { return syscall(306, addr); }


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

x86 assembly (clang, -O2):
<shmdt>:
mov    %rdi,%rsi
mov    $0x132,%edi
jmp    1030 <syscall@plt>

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

LLVM IR (-O2):
define i32 @shmdt(i8* %0) {
%2 = tail call i32 @syscall(i32 306, i8* %0)
ret i32 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ title;
struct file_tags {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ do_title_expn(char *, int, char const *,
                                 struct file_tags const *);
char *xstrdup(char *);
char *build_title_with_format(const struct file_tags *tags, const char *fmt) {
  char title[512];
  do_title_expn(title, sizeof(title), fmt, tags);
  return xstrdup(title);
}


x86 assembly (clang, -O0):
<build_title_with_format>:
push   %rbp
mov    %rsp,%rbp
sub    $0x210,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x210(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x8(%rbp),%rcx
mov    $0x200,%esi
call   1040 <do_title_expn@plt>
lea    -0x210(%rbp),%rdi
call   1030 <xstrdup@plt>
add    $0x210,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<build_title_with_format>:
push   %rbx
sub    $0x200,%rsp
mov    %rsi,%rdx
mov    %rdi,%rcx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x200,%esi
call   1040 <do_title_expn@plt>
mov    %rbx,%rdi
call   1030 <xstrdup@plt>
add    $0x200,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.file_tags = type { i32 }
define i8* @build_title_with_format(%struct.file_tags* %0, i8* %1) {
%3 = alloca %struct.file_tags*
%4 = alloca i8*
%5 = alloca [512 x i8]
store %struct.file_tags* %0, %struct.file_tags** %3
store i8* %1, i8** %4
%6 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 0
%7 = load i8*, i8** %4
%8 = load %struct.file_tags*, %struct.file_tags** %3
%9 = call i32 @do_title_expn(i8* %6, i32 512, i8* %7, %struct.file_tags* %8)
%10 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 0
%11 = call i8* @xstrdup(i8* %10)
ret i8* %11
}

LLVM IR (-O2):
%struct.file_tags = type { i32 }
define i8* @build_title_with_format(%struct.file_tags* %0, i8* %1) {
%3 = alloca [512 x i8]
%4 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%5 = call i32 @do_title_expn(i8* %4, i32 512, i8* %1, %struct.file_tags* %0)
%6 = call i8* @xstrdup(i8* %4)
ret i8* %6
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
int fileExists(const char *filename) {
  FILE *fp = fopen(filename, "r");
  if (fp) {
    fclose(fp);
    return 1;
  } else
    return 0;
}


x86 assembly (clang, -O0):
<fileExists>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xec9(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1160 <fileExists+0x40>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
movl   $0x1,-0x4(%rbp)
jmp    1167 <fileExists+0x47>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fileExists>:
push   %rax
lea    0xed8(%rip),%rsi
call   1040 <fopen@plt>
test   %rax,%rax
je     1141 <fileExists+0x21>
mov    %rax,%rdi
call   1030 <fclose@plt>
mov    $0x1,%eax
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
define i32 @fileExists(i8* nocapture %0) {
%2 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i32* %2, null
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @fclose(i32* %2)
br label %6
6: ; preds = %1, %4
%7 = phi i32 [ 1, %4 ], [ 0, %1 ]
ret i32 %7
}
/* Variables and functions */
int daemonize(int, char **);
int main(int argc, char *argv[]) {
  int rc;
  rc = daemonize(argc, argv);
  return rc;
}


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    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <daemonize@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
jmp    1030 <daemonize@plt>

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @daemonize(i32 %0, i8** %1)
ret i32 %3
}
/* Variables and functions */
char *malloc(size_t);
char *memcpy(char *, char const *, size_t);
int strlen(char const *);
char *strdup(const char *str) {
  size_t len;
  char *cp;
  len = strlen(str) + 1;
  cp = malloc(len);
  if (cp != NULL)
    return (memcpy(cp, str, len));
  return NULL;
}


x86 assembly (clang, -O0):
<strdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
add    $0x1,%eax
cltq
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <malloc@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     1180 <strdup+0x50>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1040 <memcpy@plt>
mov    %rax,-0x8(%rbp)
jmp    1188 <strdup+0x58>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strdup>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
call   1030 <strlen@plt>
add    $0x1,%eax
movslq %eax,%r15
mov    %r15,%rdi
call   1050 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
je     1161 <strdup+0x31>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1040 <memcpy@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @strdup(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i8*
store i8* %0, i8** %3
%6 = load i8*, i8** %3
%7 = call i32 @strlen(i8* %6)
%8 = add nsw i32 %7, 1
%9 = sext i32 %8 to i64
store i64 %9, i64* %4
%10 = load i64, i64* %4
%11 = call i8* @malloc(i64 %10)
store i8* %11, i8** %5
%12 = load i8*, i8** %5
%13 = icmp ne i8* %12, null
br i1 %13, label %14, label %19
14: ; preds = %1
%15 = load i8*, i8** %5
%16 = load i8*, i8** %3
%17 = load i64, i64* %4
%18 = call i8* @memcpy(i8* %15, i8* %16, i64 %17)
store i8* %18, i8** %2
br label %20
19: ; preds = %1
store i8* null, i8** %2
br label %20
20: ; preds = %19, %14
%21 = load i8*, i8** %2
ret i8* %21
}

LLVM IR (-O2):
define noalias i8* @strdup(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = add nsw i32 %2, 1
%4 = sext i32 %3 to i64
%5 = tail call i8* @malloc(i64 %4)
%6 = icmp eq i8* %5, null
br i1 %6, label %8, label %7
7: ; preds = %1
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %5, i8* align 1 %0, i64 %4, i1 false)
br label %8
8: ; preds = %1, %7
ret i8* %5
}
/* Variables and functions */
char *u_next_char(char const *);
size_t u_strlen(const char *str) {
  size_t len;
  for (len = 0; *str; len++)
    str = u_next_char(str);
  return len;
}


x86 assembly (clang, -O0):
<u_strlen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     114f <u_strlen+0x3f>
mov    -0x8(%rbp),%rdi
call   1030 <u_next_char@plt>
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1124 <u_strlen+0x14>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<u_strlen>:
push   %rbx
cmpb   $0x0,(%rdi)
je     1133 <u_strlen+0x23>
mov    %rdi,%rax
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    %rax,%rdi
call   1030 <u_next_char@plt>
add    $0x1,%rbx
cmpb   $0x0,(%rax)
jne    1120 <u_strlen+0x10>
jmp    1135 <u_strlen+0x25>
xor    %ebx,%ebx
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define i64 @u_strlen(i8* %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %1, %4
%5 = phi i64 [ %8, %4 ], [ 0, %1 ]
%6 = phi i8* [ %7, %4 ], [ %0, %1 ]
%7 = tail call i8* @u_next_char(i8* %6)
%8 = add i64 %5, 1
%9 = load i8, i8* %7
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4, %1
%12 = phi i64 [ 0, %1 ], [ %8, %4 ]
ret i64 %12
}
void sysheap_suppress_leak_detection(void) {}


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

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

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

LLVM IR (-O2):
define void @sysheap_suppress_leak_detection() {
ret void
}
void functDoWhile(int a) {
  char c = 'a';
  int i = 0;
  do {
    c++;
    if (c == 'c') {
      continue;
    }
    if (c == 'z') {
      break;
    }
    i++;
  } while (i < a);
}


x86 assembly (clang, -O0):
<functDoWhile>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movb   $0x61,-0x5(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x5(%rbp),%al
add    $0x1,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x63,%eax
jne    112c <functDoWhile+0x2c>
jmp    1147 <functDoWhile+0x47>
movsbl -0x5(%rbp),%eax
cmp    $0x7a,%eax
jne    113e <functDoWhile+0x3e>
jmp    1153 <functDoWhile+0x53>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jl     1112 <functDoWhile+0x12>
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @functDoWhile(i32 %0) {
ret void
}
/* Variables and functions */
bool check_digit(char c) {
  if ((c >= '0') && (c <= '9'))
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<check_digit>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x30,%eax
jl     1130 <check_digit+0x30>
movsbl -0x5(%rbp),%eax
cmp    $0x39,%eax
jg     1130 <check_digit+0x30>
movl   $0x1,-0x4(%rbp)
jmp    1137 <check_digit+0x37>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_digit>:
add    $0xd0,%dil
xor    %eax,%eax
cmp    $0xa,%dil
setb   %al
ret

LLVM IR (-O0):
define i32 @check_digit(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 sge i32 %5, 48
br i1 %6, label %7, label %12
7: ; preds = %1
%8 = load i8, i8* %3
%9 = sext i8 %8 to i32
%10 = icmp sle i32 %9, 57
br i1 %10, label %11, label %12
11: ; preds = %7
store i32 1, i32* %2
br label %13
12: ; preds = %7, %1
store i32 0, i32* %2
br label %13
13: ; preds = %12, %11
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
define i32 @check_digit(i8 signext %0) {
%2 = add i8 %0, -48
%3 = icmp ult i8 %2, 10
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isxdigit(int);
void t_isxdigit_0x5b() {
  Assert_real((isxdigit(91) == 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_isxdigit.c",
              460, ("isxdigit should be 0 for ["));
}


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

x86 assembly (clang, -O2):
<t_isxdigit_0x5b>:
push   %rax
mov    $0x5b,%edi
call   1030 <isxdigit@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf67(%rip),%rcx
mov    $0x1cc,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [169 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_isxdigit.c\00"
@.str.1 = [27 x i8] c"isxdigit should be 0 for [\00"
define void @t_isxdigit_0x5b() {
%1 = call i64 @isxdigit(i32 91)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([169 x i8], [169 x i8]* @.str, i64 0, i64 0), i32 460, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [169 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_isxdigit.c\00"
@.str.1 = [27 x i8] c"isxdigit should be 0 for [\00"
define void @t_isxdigit_0x5b() {
%1 = tail call i64 @isxdigit(i32 91)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([169 x i8], [169 x i8]* @.str, i64 0, i64 0), i32 460, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
ret void
}
int multiply7(int i) { return ((i << 3) - i); }


x86 assembly (clang, -O0):
<multiply7>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x3,%eax
sub    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<multiply7>:
lea    0x0(,%rdi,8),%eax
sub    %edi,%eax
ret

LLVM IR (-O0):
define i32 @multiply7(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = shl i32 %3, 3
%5 = load i32, i32* %2
%6 = sub nsw i32 %4, %5
ret i32 %6
}

LLVM IR (-O2):
define i32 @multiply7(i32 %0) {
%2 = mul i32 %0, 7
ret i32 %2
}
/* Variables and functions */
int S_IFIFO;
int S_IRWXU;
int mkfifo(char *, int);
int open(char *, int);
int mfifo(char *fname, int mode) {
  if (mkfifo(fname, S_IFIFO | S_IRWXU) == -1)
    return -1;
  return open(fname, mode);
}


x86 assembly (clang, -O0):
<mfifo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    0x2e9e(%rip),%rax
mov    (%rax),%esi
mov    0x2ea5(%rip),%rax
or     (%rax),%esi
call   1030 <mkfifo@plt>
cmp    $0xffffffff,%eax
jne    115f <mfifo+0x3f>
movl   $0xffffffff,-0x4(%rbp)
jmp    116e <mfifo+0x4e>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1040 <open@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mfifo>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
mov    0x2ea9(%rip),%rax
mov    0x2eb2(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
call   1030 <mkfifo@plt>
cmp    $0xffffffff,%eax
je     1154 <mfifo+0x34>
mov    %rbx,%rdi
mov    %ebp,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <open@plt>
mov    $0xffffffff,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@S_IFIFO = global i32 0
@S_IRWXU = global i32 0
define i32 @mfifo(i8* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
%6 = load i8*, i8** %4
%7 = load i32, i32* @S_IFIFO
%8 = load i32, i32* @S_IRWXU
%9 = or i32 %7, %8
%10 = call i32 @mkfifo(i8* %6, i32 %9)
%11 = icmp eq i32 %10, -1
br i1 %11, label %12, label %13
12: ; preds = %2
store i32 -1, i32* %3
br label %17
13: ; preds = %2
%14 = load i8*, i8** %4
%15 = load i32, i32* %5
%16 = call i32 @open(i8* %14, i32 %15)
store i32 %16, i32* %3
br label %17
17: ; preds = %13, %12
%18 = load i32, i32* %3
ret i32 %18
}

LLVM IR (-O2):
@S_IFIFO = global i32 0
@S_IRWXU = global i32 0
define i32 @mfifo(i8* %0, i32 %1) {
%3 = load i32, i32* @S_IFIFO
%4 = load i32, i32* @S_IRWXU
%5 = or i32 %4, %3
%6 = tail call i32 @mkfifo(i8* %0, i32 %5)
%7 = icmp eq i32 %6, -1
br i1 %7, label %10, label %8
8: ; preds = %2
%9 = tail call i32 @open(i8* %0, i32 %1)
br label %10
10: ; preds = %2, %8
%11 = phi i32 [ %9, %8 ], [ -1, %2 ]
ret i32 %11
}
void CFGMR3QueryU8Def(void) {}


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

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

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

LLVM IR (-O2):
define void @CFGMR3QueryU8Def() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
void _CATCAT_Xinv(void) {
  fputs("Invalid dynamic array argument\n", stderr);
  abort();
}


x86 assembly (clang, -O0):
<_CATCAT_Xinv>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%esi
lea    0xecc(%rip),%rdi
call   1040 <fputs@plt>
mov    $0x0,%al
call   1030 <abort@plt>

x86 assembly (clang, -O2):
<_CATCAT_Xinv>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%esi
lea    0xecf(%rip),%rdi
call   1040 <fputs@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@.str = [32 x i8] c"Invalid dynamic array argument\0A\00"
@stderr = global i32 0
define void @_CATCAT_Xinv() {
%1 = load i32, i32* @stderr
%2 = call i32 @fputs(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = call i32 (...) @abort()
unreachable
}

LLVM IR (-O2):
@.str = [32 x i8] c"Invalid dynamic array argument\0A\00"
@stderr = global i32 0
define void @_CATCAT_Xinv() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fputs(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = tail call i32 (...) @abort()
unreachable
}
double my_fabs(double n) {
  double f;
  if (n >= 0)
    f = n;
  else
    f = -n;
  return f;
}


x86 assembly (clang, -O0):
<my_fabs>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     112a <my_fabs+0x2a>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    114b <my_fabs+0x4b>
movsd  -0x8(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_fabs>:
movapd 0xef8(%rip),%xmm2
xorpd  %xmm0,%xmm2
xorpd  %xmm1,%xmm1
cmpnlesd %xmm0,%xmm1
andpd  %xmm1,%xmm2
andnpd %xmm0,%xmm1
orpd   %xmm2,%xmm1
movapd %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @my_fabs(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %2
%4 = load double, double* %2
%5 = fcmp oge double %4, 0.000000e+00
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = load double, double* %2
store double %7, double* %3
br label %11
8: ; preds = %1
%9 = load double, double* %2
%10 = fneg double %9
store double %10, double* %3
br label %11
11: ; preds = %8, %6
%12 = load double, double* %3
ret double %12
}

LLVM IR (-O2):
define double @my_fabs(double %0) {
%2 = fcmp ult double %0, 0.000000e+00
%3 = fneg double %0
%4 = select i1 %2, double %3, double %0
ret double %4
}
void cpuExit(void) {}


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

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

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

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


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

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

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

LLVM IR (-O2):
define void @stress_set_proc_limits() {
ret void
}
/* Variables and functions */
int twice_sum(int);
int foo() {
  int i;
  int j;
  int sum = 0;
  for (i = 0; i < 100; i++) {
    for (j = 0; j < 100; j++) {
      sum += i + j;
    }
  }
  return twice_sum(sum);
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x4(%rbp)
cmpl   $0x64,-0x4(%rbp)
jge    116e <foo+0x5e>
movl   $0x0,-0x8(%rbp)
cmpl   $0x64,-0x8(%rbp)
jge    115b <foo+0x4b>
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1137 <foo+0x27>
jmp    1160 <foo+0x50>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1126 <foo+0x16>
mov    -0xc(%rbp),%edi
call   1030 <twice_sum@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
mov    $0xf1b30,%edi
jmp    1030 <twice_sum@plt>

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

LLVM IR (-O2):
define i32 @foo() {
%1 = tail call i32 @twice_sum(i32 990000)
ret i32 %1
}
/* Type definitions */
typedef int pid_t;

/* Variables and functions */
int /*<<< orphan*/ WNOHANG;
int /*<<< orphan*/ printf(char *, int);
int waitpid(int, int *, int /*<<< orphan*/);
void sig_chld(int signo) {
  pid_t pid;
  int stat;
  while ((pid = waitpid(-1, &stat, WNOHANG)) > 0)
    printf("child %d terminated\n", pid);
  return;
}


x86 assembly (clang, -O0):
<sig_chld>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2eb6(%rip),%rax
mov    (%rax),%edx
mov    $0xffffffff,%edi
lea    -0xc(%rbp),%rsi
call   1040 <waitpid@plt>
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
jle    1162 <sig_chld+0x42>
mov    -0x8(%rbp),%esi
lea    0xea8(%rip),%rdi
call   1030 <printf@plt>
jmp    112b <sig_chld+0xb>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sig_chld>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    0x2eb8(%rip),%r15
mov    (%r15),%edx
lea    0xc(%rsp),%rsi
mov    $0xffffffff,%edi
call   1040 <waitpid@plt>
test   %eax,%eax
jle    117e <sig_chld+0x5e>
lea    0xeb3(%rip),%r14
lea    0xc(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    (%r15),%edx
mov    $0xffffffff,%edi
mov    %rbx,%rsi
call   1040 <waitpid@plt>
test   %eax,%eax
jg     1160 <sig_chld+0x40>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@WNOHANG = global i32 0
@.str = [21 x i8] c"child %d terminated\0A\00"
define void @sig_chld(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
br label %5
5: ; preds = %9, %1
%6 = load i32, i32* @WNOHANG
%7 = call i32 @waitpid(i32 -1, i32* %4, i32 %6)
store i32 %7, i32* %3
%8 = icmp sgt i32 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %5
%10 = load i32, i32* %3
%11 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %10)
br label %5
12: ; preds = %5
ret void
}

LLVM IR (-O2):
@WNOHANG = global i32 0
@.str = [21 x i8] c"child %d terminated\0A\00"
define void @sig_chld(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = load i32, i32* @WNOHANG
%5 = call i32 @waitpid(i32 -1, i32* %2, i32 %4)
%6 = icmp sgt i32 %5, 0
br i1 %6, label %7, label %13
7: ; preds = %1, %7
%8 = phi i32 [ %11, %7 ], [ %5, %1 ]
%9 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = load i32, i32* @WNOHANG
%11 = call i32 @waitpid(i32 -1, i32* %2, i32 %10)
%12 = icmp sgt i32 %11, 0
br i1 %12, label %7, label %13
13: ; preds = %7, %1
ret void
}
void *Sys_FS_LockFile(const char *path) { return (void *)1; }


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

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

LLVM IR (-O0):
define i8* @Sys_FS_LockFile(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
ret i8* inttoptr (i64 1 to i8*)
}

LLVM IR (-O2):
define i8* @Sys_FS_LockFile(i8* nocapture readnone %0) {
ret i8* inttoptr (i64 1 to i8*)
}
int __of_attach_node_sysfs(struct device_node *np) { return 0; }


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

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

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

LLVM IR (-O2):
%struct.device_node = type opaque
define i32 @__of_attach_node_sysfs(%struct.device_node* nocapture readnone %0) {
ret i32 0
}