xunge/DecIR huggingface dataset:
/* Variables and functions */
int strlen(char *);
char *trim_length(char *buffer, int length) {
  if (strlen(buffer) <= length)
    return buffer;
  buffer[length] = '\0';
  return buffer;
}


x86 assembly (clang, -O0):
<trim_length>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
cmp    -0x14(%rbp),%eax
jg     113e <trim_length+0x2e>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1152 <trim_length+0x42>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<trim_length>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
call   1030 <strlen@plt>
cmp    %ebp,%eax
jle    1128 <trim_length+0x18>
movslq %ebp,%rax
movb   $0x0,(%rbx,%rax,1)
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i8* @trim_length(i8* returned %0, i32 %1) {
%3 = tail call i32 @strlen(i8* %0)
%4 = icmp sgt i32 %3, %1
br i1 %4, label %5, label %8
5: ; preds = %2
%6 = sext i32 %1 to i64
%7 = getelementptr inbounds i8, i8* %0, i64 %6
store i8 0, i8* %7
br label %8
8: ; preds = %2, %5
ret i8* %0
}
/* Variables and functions */
int open(char *, int);
int /*<<< orphan*/ strcat(char *, char const *);
int /*<<< orphan*/ strcpy(char *, char *);
int devopen(const char *dev, int flags) {
  char t[1024];
  strcpy(t, "/dev/");
  strcat(t, dev);
  return open(t, flags);
}


x86 assembly (clang, -O0):
<devopen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x410,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
lea    -0x410(%rbp),%rdi
lea    0xeb0(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x410(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1050 <strcat@plt>
lea    -0x410(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1040 <open@plt>
add    $0x410,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<devopen>:
push   %rbp
push   %r14
push   %rbx
sub    $0x400,%rsp
mov    %esi,%r14d
mov    %rdi,%rbx
lea    0xeb8(%rip),%rsi
mov    %rsp,%rbp
mov    %rbp,%rdi
call   1030 <strcpy@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1050 <strcat@plt>
mov    %rbp,%rdi
mov    %r14d,%esi
call   1040 <open@plt>
add    $0x400,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"/dev/\00"
define i32 @devopen(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca [1024 x i8]
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%7 = call i32 @strcpy(i8* %6, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%8 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%9 = load i8*, i8** %3
%10 = call i32 @strcat(i8* %8, i8* %9)
%11 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%12 = load i32, i32* %4
%13 = call i32 @open(i8* %11, i32 %12)
ret i32 %13
}

LLVM IR (-O2):
@.str = [6 x i8] c"/dev/\00"
define i32 @devopen(i8* %0, i32 %1) {
%3 = alloca [1024 x i8]
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%5 = call i32 @strcpy(i8* %4, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @strcat(i8* %4, i8* %0)
%7 = call i32 @open(i8* %4, i32 %1)
ret i32 %7
}
/* Variables and functions */
void *malloc(size_t);
void *ft_malloc(size_t size) { return (malloc(size)); }


x86 assembly (clang, -O0):
<ft_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):
<ft_malloc>:
jmp    1030 <malloc@plt>

LLVM IR (-O0):
define i8* @ft_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* @ft_malloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
ret i8* %2
}
/* Variables and functions */
int _in_(int);
long time() { return ((_in_(0x1d) << 16 >> 16) / 0xf22a1); }


x86 assembly (clang, -O0):
<time>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1d,%edi
call   1030 <_in_@plt>
shl    $0x10,%eax
sar    $0x10,%eax
mov    $0xf22a1,%ecx
cltd
idiv   %ecx
cltq
pop    %rbp
ret

x86 assembly (clang, -O2):
<time>:
push   %rax
mov    $0x1d,%edi
call   1030 <_in_@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i64 @time() {
%1 = call i32 @_in_(i32 29)
%2 = shl i32 %1, 16
%3 = ashr i32 %2, 16
%4 = sdiv i32 %3, 991905
%5 = sext i32 %4 to i64
ret i64 %5
}

LLVM IR (-O2):
define i64 @time() {
%1 = tail call i32 @_in_(i32 29)
ret i64 0
}
void cbv_swap(int x, int y) {
  int tmp = 0;
  tmp = x;
  x = y;
  y = tmp;
  return;
}


x86 assembly (clang, -O0):
<cbv_swap>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @cbv_swap(i32 %0, i32 %1) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ putc(char, int /*<<< orphan*/ *);
void OutputSymbol(int symbol, FILE *stream) {
  switch (symbol) {
  case 0:
    putc('A', stream);
    break;
  case 1:
    putc('C', stream);
    break;
  case 2:
    putc('G', stream);
    break;
  case 3:
    putc('T', stream);
    break;
  default:
    putc('-', stream);
    break;
  }
}


x86 assembly (clang, -O0):
<OutputSymbol>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    %rax,-0x18(%rbp)
sub    $0x3,%rax
ja     1190 <OutputSymbol+0x80>
mov    -0x18(%rbp),%rax
lea    0xec5(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x10(%rbp),%rsi
mov    $0x41,%edi
call   1030 <putc@plt>
jmp    119e <OutputSymbol+0x8e>
mov    -0x10(%rbp),%rsi
mov    $0x43,%edi
call   1030 <putc@plt>
jmp    119e <OutputSymbol+0x8e>
mov    -0x10(%rbp),%rsi
mov    $0x47,%edi
call   1030 <putc@plt>
jmp    119e <OutputSymbol+0x8e>
mov    -0x10(%rbp),%rsi
mov    $0x54,%edi
call   1030 <putc@plt>
jmp    119e <OutputSymbol+0x8e>
mov    -0x10(%rbp),%rsi
mov    $0x2d,%edi
call   1030 <putc@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<OutputSymbol>:
lea    0x0(,%rdi,8),%ecx
mov    $0x54474341,%eax
shr    %cl,%eax
cmp    $0x4,%edi
mov    $0x2d,%ecx
cmovb  %eax,%ecx
movsbl %cl,%edi
jmp    1030 <putc@plt>

LLVM IR (-O0):
define void @OutputSymbol(i32 %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
store i32 %0, i32* %3
store i32* %1, i32** %4
%5 = load i32, i32* %3
switch i32 %5, label %18 [
i32 0, label %6
i32 1, label %9
i32 2, label %12
i32 3, label %15
]
6: ; preds = %2
%7 = load i32*, i32** %4
%8 = call i32 @putc(i8 signext 65, i32* %7)
br label %21
9: ; preds = %2
%10 = load i32*, i32** %4
%11 = call i32 @putc(i8 signext 67, i32* %10)
br label %21
12: ; preds = %2
%13 = load i32*, i32** %4
%14 = call i32 @putc(i8 signext 71, i32* %13)
br label %21
15: ; preds = %2
%16 = load i32*, i32** %4
%17 = call i32 @putc(i8 signext 84, i32* %16)
br label %21
18: ; preds = %2
%19 = load i32*, i32** %4
%20 = call i32 @putc(i8 signext 45, i32* %19)
br label %21
21: ; preds = %18, %15, %12, %9, %6
ret void
}

LLVM IR (-O2):
define void @OutputSymbol(i32 %0, i32* nocapture %1) {
%3 = icmp ult i32 %0, 4
%4 = shl i32 %0, 3
%5 = lshr i32 1413956417, %4
%6 = trunc i32 %5 to i8
%7 = select i1 %3, i8 %6, i8 45
%8 = tail call i32 @putc(i8 signext %7, i32* %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ _test_MIN_biggerulong_smallerint(int /*<<< orphan*/, int);
int _test_various_MIN_biggerulong_smallerint() {
  _test_MIN_biggerulong_smallerint(0, -1);
  return 0;
}


x86 assembly (clang, -O0):
<_test_various_MIN_biggerulong_smallerint>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
mov    $0xffffffff,%esi
call   1030 <_test_MIN_biggerulong_smallerint@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_test_various_MIN_biggerulong_smallerint>:
push   %rax
xor    %edi,%edi
mov    $0xffffffff,%esi
call   1030 <_test_MIN_biggerulong_smallerint@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @_test_various_MIN_biggerulong_smallerint() {
%1 = call i32 @_test_MIN_biggerulong_smallerint(i32 0, i32 -1)
ret i32 0
}

LLVM IR (-O2):
define i32 @_test_various_MIN_biggerulong_smallerint() {
%1 = tail call i32 @_test_MIN_biggerulong_smallerint(i32 0, i32 -1)
ret i32 0
}
unsigned int highest_bit(unsigned int x) {
  x |= (x >> 1);
  x |= (x >> 2);
  x |= (x >> 4);
  x |= (x >> 8);
  x |= (x >> 16);
  return x - (x >> 1);
}


x86 assembly (clang, -O0):
<highest_bit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x1,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x2,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x4,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x8,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x10,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x4(%rbp),%ecx
shr    $0x1,%ecx
sub    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<highest_bit>:
mov    %edi,%eax
shr    %eax
or     %edi,%eax
mov    %eax,%ecx
shr    $0x2,%ecx
or     %eax,%ecx
mov    %ecx,%eax
shr    $0x4,%eax
or     %ecx,%eax
mov    %eax,%ecx
shr    $0x8,%ecx
or     %eax,%ecx
mov    %ecx,%eax
shr    $0x10,%eax
or     %ecx,%eax
mov    %eax,%ecx
shr    %ecx
sub    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @highest_bit(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = lshr i32 %3, 1
%5 = load i32, i32* %2
%6 = or i32 %5, %4
store i32 %6, i32* %2
%7 = load i32, i32* %2
%8 = lshr i32 %7, 2
%9 = load i32, i32* %2
%10 = or i32 %9, %8
store i32 %10, i32* %2
%11 = load i32, i32* %2
%12 = lshr i32 %11, 4
%13 = load i32, i32* %2
%14 = or i32 %13, %12
store i32 %14, i32* %2
%15 = load i32, i32* %2
%16 = lshr i32 %15, 8
%17 = load i32, i32* %2
%18 = or i32 %17, %16
store i32 %18, i32* %2
%19 = load i32, i32* %2
%20 = lshr i32 %19, 16
%21 = load i32, i32* %2
%22 = or i32 %21, %20
store i32 %22, i32* %2
%23 = load i32, i32* %2
%24 = load i32, i32* %2
%25 = lshr i32 %24, 1
%26 = sub i32 %23, %25
ret i32 %26
}

LLVM IR (-O2):
define i32 @highest_bit(i32 %0) {
%2 = lshr i32 %0, 1
%3 = or i32 %2, %0
%4 = lshr i32 %3, 2
%5 = or i32 %4, %3
%6 = lshr i32 %5, 4
%7 = or i32 %6, %5
%8 = lshr i32 %7, 8
%9 = or i32 %8, %7
%10 = lshr i32 %9, 16
%11 = or i32 %10, %9
%12 = lshr i32 %11, 1
%13 = sub i32 %11, %12
ret i32 %13
}
/* Variables and functions */
int ex_get_cpu_ws();
int EXCPWS() { return (ex_get_cpu_ws()); }


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

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

LLVM IR (-O0):
define i32 @EXCPWS() {
%1 = call i32 (...) @ex_get_cpu_ws()
ret i32 %1
}

LLVM IR (-O2):
define i32 @EXCPWS() {
%1 = tail call i32 (...) @ex_get_cpu_ws()
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main() {
  int r;
  int x = 10;
  int y = 20;
  int diff = y - x;
  srand(time(NULL));
  r = rand() % (diff + 1) + x;
  printf("Random Number from 10 to 20: %d", r);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xa,-0xc(%rbp)
movl   $0x14,-0x10(%rbp)
mov    -0x10(%rbp),%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
mov    $0x0,%al
call   1060 <rand@plt>
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
cltd
idiv   %ecx
add    -0xc(%rbp),%edx
mov    %edx,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe6a(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x2e8ba2e9,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x21,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,4),%edx
lea    (%rcx,%rdx,2),%ecx
neg    %ecx
lea    (%rax,%rcx,1),%esi
add    $0xa,%esi
lea    0xe7f(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [32 x i8] c"Random Number from 10 to 20: %d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 10, i32* %3
store i32 20, i32* %4
%6 = load i32, i32* %4
%7 = load i32, i32* %3
%8 = sub nsw i32 %6, %7
store i32 %8, i32* %5
%9 = call i32 @time(i32* null)
%10 = call i32 @srand(i32 %9)
%11 = call i32 (...) @rand()
%12 = load i32, i32* %5
%13 = add nsw i32 %12, 1
%14 = srem i32 %11, %13
%15 = load i32, i32* %3
%16 = add nsw i32 %14, %15
store i32 %16, i32* %2
%17 = load i32, i32* %2
%18 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 %17)
ret i32 0
}

LLVM IR (-O2):
@.str = [32 x i8] c"Random Number from 10 to 20: %d\00"
define i32 @main() {
%1 = tail call i32 @time(i32* null)
%2 = tail call i32 @srand(i32 %1)
%3 = tail call i32 (...) @rand()
%4 = srem i32 %3, 11
%5 = add nsw i32 %4, 10
%6 = tail call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 %5)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ SOCK_STREAM;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ perror(char *);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int htxd_create_socket(void) {
  int socket_fd;
  socket_fd = socket(AF_INET, SOCK_STREAM, 0);
  if (socket_fd == -1) {
    perror("ERROR: while creating socket. Exiting...");
    exit(1);
  }
  return socket_fd;
}


x86 assembly (clang, -O0):
<htxd_create_socket>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2ea9(%rip),%rax
mov    (%rax),%edi
mov    0x2e90(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1050 <socket@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0xffffffff,-0x4(%rbp)
jne    1174 <htxd_create_socket+0x44>
lea    0xe9b(%rip),%rdi
call   1030 <perror@plt>
mov    $0x1,%edi
call   1040 <exit@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<htxd_create_socket>:
push   %rax
mov    0x2eb0(%rip),%rax
mov    (%rax),%edi
mov    0x2e97(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1050 <socket@plt>
cmp    $0xffffffff,%eax
je     1151 <htxd_create_socket+0x21>
pop    %rcx
ret
lea    0xea8(%rip),%rdi
call   1030 <perror@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str = [41 x i8] c"ERROR: while creating socket. Exiting...\00"
define i32 @htxd_create_socket() {
%1 = alloca i32
%2 = load i32, i32* @AF_INET
%3 = load i32, i32* @SOCK_STREAM
%4 = call i32 @socket(i32 %2, i32 %3, i32 0)
store i32 %4, i32* %1
%5 = load i32, i32* %1
%6 = icmp eq i32 %5, -1
br i1 %6, label %7, label %10
7: ; preds = %0
%8 = call i32 @perror(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @exit(i32 1)
unreachable
10: ; preds = %0
%11 = load i32, i32* %1
ret i32 %11
}

LLVM IR (-O2):
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str = [41 x i8] c"ERROR: while creating socket. Exiting...\00"
define i32 @htxd_create_socket() {
%1 = load i32, i32* @AF_INET
%2 = load i32, i32* @SOCK_STREAM
%3 = tail call i32 @socket(i32 %1, i32 %2, i32 0)
%4 = icmp eq i32 %3, -1
br i1 %4, label %5, label %8
5: ; preds = %0
%6 = tail call i32 @perror(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @exit(i32 1)
unreachable
8: ; preds = %0
ret i32 %3
}
int omap_cfg_reg(unsigned long reg_cfg) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @omap_cfg_reg(i64 %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isupper(int);
void t_isupper_0x1b() {
  Assert_real((isupper(27) == 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_isupper.c",
              140, ("isupper should be 0 for 0x1b"));
}


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

x86 assembly (clang, -O2):
<t_isupper_0x1b>:
push   %rax
mov    $0x1b,%edi
call   1030 <isupper@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x8c,%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_isupper.c\00"
@.str.1 = [29 x i8] c"isupper should be 0 for 0x1b\00"
define void @t_isupper_0x1b() {
%1 = call i64 @isupper(i32 27)
%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 140, i8* getelementptr inbounds ([29 x i8], [29 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_isupper.c\00"
@.str.1 = [29 x i8] c"isupper should be 0 for 0x1b\00"
define void @t_isupper_0x1b() {
%1 = tail call i64 @isupper(i32 27)
%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 140, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int atoi_len(char const *, int);
int /*<<< orphan*/ memcpy(char *, char const *, int);
void packet_unpack_word_req(const char *packet, char *word) {
  int word_len = atoi_len(packet, 4);
  int len = (4 + 2);
  memcpy(word, packet + len, word_len);
  len += word_len;
  word[word_len] = '\0';
}


x86 assembly (clang, -O0):
<packet_unpack_word_req>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x4,%esi
call   1040 <atoi_len@plt>
mov    %eax,-0x14(%rbp)
movl   $0x6,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
movslq -0x18(%rbp),%rax
add    %rax,%rsi
mov    -0x14(%rbp),%edx
call   1030 <memcpy@plt>
mov    -0x14(%rbp),%eax
add    -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<packet_unpack_word_req>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
mov    $0x4,%esi
call   1040 <atoi_len@plt>
mov    %eax,%ebp
add    $0x6,%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <memcpy@plt>
movslq %ebp,%rax
movb   $0x0,(%r14,%rax,1)
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define void @packet_unpack_word_req(i8* %0, i8* %1) {
%3 = tail call i32 @atoi_len(i8* %0, i32 4)
%4 = getelementptr inbounds i8, i8* %0, i64 6
%5 = tail call i32 @memcpy(i8* %1, i8* %4, i32 %3)
%6 = sext i32 %3 to i64
%7 = getelementptr inbounds i8, i8* %1, i64 %6
store i8 0, i8* %7
ret void
}
long long gcd(long long a, long long b) {
  long long temp;
  if (a < b) {
    temp = a;
    a = b;
    b = temp;
  }
  while (a % b != 0) {
    a %= b;
    temp = a;
    a = b;
    b = temp;
  }
  return b;
}


x86 assembly (clang, -O0):
<gcd>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
jge    1132 <gcd+0x32>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x10(%rbp)
jmp    1137 <gcd+0x37>
mov    -0x8(%rbp),%rax
cqto
idivq  -0x10(%rbp)
cmp    $0x0,%rdx
je     1179 <gcd+0x79>
mov    -0x10(%rbp),%rcx
mov    -0x8(%rbp),%rax
cqto
idiv   %rcx
mov    %rdx,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x10(%rbp)
jmp    1137 <gcd+0x37>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i64 @gcd(i64 %0, i64 %1) {
%3 = icmp slt i64 %0, %1
%4 = select i1 %3, i64 %1, i64 %0
%5 = select i1 %3, i64 %0, i64 %1
br label %6
6: ; preds = %6, %2
%7 = phi i64 [ %4, %2 ], [ %8, %6 ]
%8 = phi i64 [ %5, %2 ], [ %9, %6 ]
%9 = srem i64 %7, %8
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %6
11: ; preds = %6
ret i64 %8
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void fun(int a) {
  if (1 == a) {
    return;
  }
  printf("Hello World!\n");
  return;
}


x86 assembly (clang, -O0):
<fun>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x1,%eax
cmp    -0x4(%rbp),%eax
jne    112e <fun+0x1e>
jmp    113a <fun+0x2a>
lea    0xecb(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fun>:
cmp    $0x1,%edi
jne    1116 <fun+0x6>
ret
lea    0xee3(%rip),%rdi
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"Hello World!\0A\00"
define void @fun(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp eq i32 1, %3
br i1 %4, label %5, label %6
5: ; preds = %1
br label %8
6: ; preds = %1
%7 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %5
ret void
}

LLVM IR (-O2):
@str = [13 x i8] c"Hello World!\00"
define void @fun(i32 %0) {
%2 = icmp eq i32 %0, 1
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
br label %5
5: ; preds = %1, %3
ret void
}
/* Type definitions */
typedef unsigned long uint32_t;

/* Variables and functions */
void CRCConfigSet(uint32_t ui32Base, uint32_t ui32CRCConfig) {
  ;

  ;
  (*((volatile unsigned long *)(ui32Base + 0x00000400))) = ui32CRCConfig;
}


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

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

LLVM IR (-O0):
define void @CRCConfigSet(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, 1024
%8 = inttoptr i64 %7 to i64*
store volatile i64 %5, i64* %8
ret void
}

LLVM IR (-O2):
define void @CRCConfigSet(i64 %0, i64 %1) {
%3 = add i64 %0, 1024
%4 = inttoptr i64 %3 to i64*
store volatile i64 %1, i64* %4
ret void
}
/* Variables and functions */
int exact_square(int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int inp_num;
  scanf(" %d", &inp_num);
  printf("%d ", exact_square(inp_num));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%edi
call   1040 <exact_square@plt>
mov    %eax,%esi
lea    0xea4(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%edi
call   1040 <exact_square@plt>
lea    0xeb2(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [4 x i8] c" %d\00"
@.str.1 = [4 x i8] c"%d \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %2)
%4 = load i32, i32* %2
%5 = call i32 @exact_square(i32 %4)
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %5)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c" %d\00"
@.str.1 = [4 x i8] c"%d \00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = call i32 @exact_square(i32 %4)
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %5)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
void usage(const char *mess) {
  fprintf(stderr, "Error: %s\n", mess);
  fprintf(stderr, "Usage: add_header model_id input_file output_file\n");
  fprintf(stderr, "\n");
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
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
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2e92(%rip),%rax
mov    (%rax),%edi
lea    0xeb4(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2e7b(%rip),%rax
mov    (%rax),%edi
lea    0xece(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rbx
mov    %rdi,%rdx
mov    0x2eb5(%rip),%rbx
mov    (%rbx),%edi
lea    0xecc(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0xec7(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0xee8(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [11 x i8] c"Error: %s\0A\00"
@.str.1 = [51 x i8] c"Usage: add_header model_id input_file output_file\0A\00"
@.str.2 = [2 x i8] c"\0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 (i32, i8*, ...) @fprintf(i32 %3, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = load i32, i32* @stderr
%7 = call i32 (i32, i8*, ...) @fprintf(i32 %6, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.1, i64 0, i64 0))
%8 = load i32, i32* @stderr
%9 = call i32 (i32, i8*, ...) @fprintf(i32 %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [11 x i8] c"Error: %s\0A\00"
@.str.1 = [51 x i8] c"Usage: add_header model_id input_file output_file\0A\00"
@.str.2 = [2 x i8] c"\0A\00"
define void @usage(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 (i32, i8*, ...) @fprintf(i32 %2, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = load i32, i32* @stderr
%5 = tail call i32 (i32, i8*, ...) @fprintf(i32 %4, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.1, i64 0, i64 0))
%6 = load i32, i32* @stderr
%7 = tail call i32 (i32, i8*, ...) @fprintf(i32 %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%8 = tail call i32 @exit(i32 1)
unreachable
}
/* Type definitions */
struct timeval {
  unsigned int tv_sec;
  unsigned int tv_usec;
};

/* Variables and functions */
int /*<<< orphan*/ select(int /*<<< orphan*/, int /*<<< orphan*/ *,
                          int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                          struct timeval *);
void delay(unsigned ms) {
  struct timeval t;
  t.tv_sec = ms / 1000;
  t.tv_usec = (ms % 1000) * 1000;
  select(0, NULL, NULL, NULL, &t);
}


x86 assembly (clang, -O0):
<delay>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x3e8,%ecx
xor    %edx,%edx
div    %ecx
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x3e8,%ecx
xor    %edx,%edx
div    %ecx
imul   $0x3e8,%edx,%eax
mov    %eax,-0xc(%rbp)
xor    %edi,%edi
xor    %eax,%eax
mov    %eax,%ecx
lea    -0x10(%rbp),%r8
mov    %rcx,%rsi
mov    %rcx,%rdx
call   1030 <select@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<delay>:
push   %rax
mov    %edi,%eax
imul   $0x10624dd3,%rax,%rax
shr    $0x26,%rax
mov    %eax,(%rsp)
imul   $0x3e8,%eax,%eax
sub    %eax,%edi
imul   $0x3e8,%edi,%eax
mov    %eax,0x4(%rsp)
mov    %rsp,%r8
xor    %edi,%edi
xor    %esi,%esi
xor    %edx,%edx
xor    %ecx,%ecx
call   1030 <select@plt>
pop    %rax
ret

LLVM IR (-O0):
%struct.timeval = type { i32, i32 }
define void @delay(i32 %0) {
%2 = alloca i32
%3 = alloca %struct.timeval
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = udiv i32 %4, 1000
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i32 0, i32 0
store i32 %5, i32* %6
%7 = load i32, i32* %2
%8 = urem i32 %7, 1000
%9 = mul i32 %8, 1000
%10 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i32 0, i32 1
store i32 %9, i32* %10
%11 = call i32 @select(i32 0, i32* null, i32* null, i32* null, %struct.timeval* %3)
ret void
}

LLVM IR (-O2):
%struct.timeval = type { i32, i32 }
define void @delay(i32 %0) {
%2 = alloca %struct.timeval
%3 = bitcast %struct.timeval* %2 to i8*
%4 = udiv i32 %0, 1000
%5 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i64 0, i32 0
store i32 %4, i32* %5
%6 = urem i32 %0, 1000
%7 = mul nuw nsw i32 %6, 1000
%8 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i64 0, i32 1
store i32 %7, i32* %8
%9 = call i32 @select(i32 0, i32* null, i32* null, i32* null, %struct.timeval* %2)
ret void
}
int skip_spaces(cpp, end) const char **cpp;
const char *end;
{
  const char *cp = *cpp;
  while (cp < end && *cp == ' ')
    ++cp;
  *cpp = cp;
  return 0;
}


x86 assembly (clang, -O0):
<skip_spaces>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rcx
xor    %eax,%eax
cmp    -0x10(%rbp),%rcx
mov    %al,-0x19(%rbp)
jae    113a <skip_spaces+0x3a>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
sete   %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    114a <skip_spaces+0x4a>
jmp    115b <skip_spaces+0x5b>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1117 <skip_spaces+0x17>
mov    -0x18(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<skip_spaces>:
mov    (%rdi),%rax
cmp    %rsi,%rax
jae    1122 <skip_spaces+0x22>
mov    %rsi,%rcx
sub    %rax,%rcx
xchg   %ax,%ax
cmpb   $0x20,(%rax)
jne    1122 <skip_spaces+0x22>
add    $0x1,%rax
add    $0xffffffffffffffff,%rcx
jne    1110 <skip_spaces+0x10>
mov    %rsi,%rax
mov    %rax,(%rdi)
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @skip_spaces(i8** nocapture %0, i8* readnone %1) {
%3 = load i8*, i8** %0
%4 = icmp ult i8* %3, %1
br i1 %4, label %5, label %17
5: ; preds = %2
%6 = ptrtoint i8* %3 to i64
%7 = ptrtoint i8* %1 to i64
%8 = sub i64 %7, %6
%9 = getelementptr i8, i8* %3, i64 %8
br label %10
10: ; preds = %5, %14
%11 = phi i8* [ %15, %14 ], [ %3, %5 ]
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 32
br i1 %13, label %14, label %17
14: ; preds = %10
%15 = getelementptr inbounds i8, i8* %11, i64 1
%16 = icmp eq i8* %15, %9
br i1 %16, label %17, label %10
17: ; preds = %10, %14, %2
%18 = phi i8* [ %3, %2 ], [ %9, %14 ], [ %11, %10 ]
store i8* %18, i8** %0
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ abort();
void *thread_abort(void *arg) {
  abort();
  return NULL;
}


x86 assembly (clang, -O0):
<thread_abort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <abort@plt>

x86 assembly (clang, -O2):
<thread_abort>:
push   %rax
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i8* @thread_abort(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (...) @abort()
unreachable
}

LLVM IR (-O2):
define noalias i8* @thread_abort(i8* nocapture readnone %0) {
%2 = tail call i32 (...) @abort()
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ drop_mem(int);
void drop_mems(int *memids, int no) {
  int i;
  for (i = 0; i < no; i++, memids++) {
    drop_mem(*memids);
  }
}


x86 assembly (clang, -O0):
<drop_mems>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1157 <drop_mems+0x47>
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
call   1030 <drop_mem@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x8(%rbp)
jmp    1126 <drop_mems+0x16>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<drop_mems>:
push   %r15
push   %r14
push   %rbx
test   %esi,%esi
jle    1142 <drop_mems+0x32>
mov    %rdi,%r14
mov    %esi,%r15d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%r14,%rbx,4),%edi
call   1030 <drop_mem@plt>
add    $0x1,%rbx
cmp    %ebx,%r15d
jne    1130 <drop_mems+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @drop_mems(i32* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %12
4: ; preds = %2, %4
%5 = phi i32 [ %9, %4 ], [ 0, %2 ]
%6 = phi i32* [ %10, %4 ], [ %0, %2 ]
%7 = load i32, i32* %6
%8 = tail call i32 @drop_mem(i32 %7)
%9 = add nuw nsw i32 %5, 1
%10 = getelementptr inbounds i32, i32* %6, i64 1
%11 = icmp eq i32 %9, %1
br i1 %11, label %12, label %4
12: ; preds = %4, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ test_mem();
int /*<<< orphan*/ test_signal();
int main(int argc, char *argv[]) {
  if (0) {
    test_signal();
  }
  if (1) {
    test_mem();
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <test_mem@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <test_mem@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @test_mem()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
int main(void) {
  int x = -2E4;
  signed int y = -2E4;
  printf("integer with modifier: %d and without modifier %d\n", y, x);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xffffb1e0,-0x8(%rbp)
movl   $0xffffb1e0,-0xc(%rbp)
mov    -0xc(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xec6(%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
mov    $0xffffb1e0,%esi
mov    $0xffffb1e0,%edx
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [51 x i8] c"integer with modifier: %d and without modifier %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 -20000, i32* %2
store i32 -20000, i32* %3
%4 = load i32, i32* %3
%5 = load i32, i32* %2
%6 = call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0), i32 %4, i32 %5)
ret i32 0
}

LLVM IR (-O2):
@.str = [51 x i8] c"integer with modifier: %d and without modifier %d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0), i32 -20000, i32 -20000)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ gcd(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ nondet_int();
int main() {
  gcd(nondet_int(), nondet_int());
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <nondet_int@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1030 <nondet_int@plt>
mov    -0x8(%rbp),%edi
mov    %eax,%esi
call   1040 <gcd@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1030 <nondet_int@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1030 <nondet_int@plt>
mov    %ebx,%edi
mov    %eax,%esi
call   1040 <gcd@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @nondet_int()
%3 = call i32 (...) @nondet_int()
%4 = call i32 @gcd(i32 %2, i32 %3)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @nondet_int()
%2 = tail call i32 (...) @nondet_int()
%3 = tail call i32 @gcd(i32 %1, i32 %2)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ free(double *);
void FreeVectd(double *vectptr) { free(vectptr); }


x86 assembly (clang, -O0):
<FreeVectd>:
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):
<FreeVectd>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @FreeVectd(double* nocapture %0) {
%2 = tail call i32 @free(double* %0)
ret void
}
__attribute__((__weak__, __always___)) char *
softboundmpx_textdomain(const char *domainname) {
  void *ret_ptr = textdomain(domainname);
  __softboundmpx_store_return_metadata(
      ret_ptr, (void *)((char *)ret_ptr + strlen(ret_ptr)));
  return ret_ptr;
}


x86 assembly (clang, -O0):
<softboundmpx_textdomain>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1030 <textdomain@plt>
cltq
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x20(%rbp),%rsi
mov    -0x18(%rbp),%rdi
add    %rax,%rsi
mov    $0x0,%al
call   1050 <__softboundmpx_store_return_metadata@plt>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<softboundmpx_textdomain>:
push   %rbx
xor    %eax,%eax
call   1030 <textdomain@plt>
movslq %eax,%rbx
mov    %rbx,%rdi
call   1040 <strlen@plt>
lea    (%rax,%rbx,1),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <__softboundmpx_store_return_metadata@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define weak i8* @softboundmpx_textdomain(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 (i8*, ...) bitcast (i32 (...)* @textdomain to i32 (i8*, ...)*)(i8* %4)
%6 = sext i32 %5 to i64
%7 = inttoptr i64 %6 to i8*
store i8* %7, i8** %3
%8 = load i8*, i8** %3
%9 = load i8*, i8** %3
%10 = load i8*, i8** %3
%11 = call i64 @strlen(i8* %10)
%12 = getelementptr inbounds i8, i8* %9, i64 %11
%13 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @__softboundmpx_store_return_metadata to i32 (i8*, i8*, ...)*)(i8* %8, i8* %12)
%14 = load i8*, i8** %3
ret i8* %14
}

LLVM IR (-O2):
define weak i8* @softboundmpx_textdomain(i8* %0) {
%2 = tail call i32 (i8*, ...) bitcast (i32 (...)* @textdomain to i32 (i8*, ...)*)(i8* %0)
%3 = sext i32 %2 to i64
%4 = inttoptr i64 %3 to i8*
%5 = tail call i64 @strlen(i8* dereferenceable(1) %4)
%6 = getelementptr inbounds i8, i8* %4, i64 %5
%7 = tail call i32 (i8*, i8*, ...) bitcast (i32 (...)* @__softboundmpx_store_return_metadata to i32 (i8*, i8*, ...)*)(i8* %4, i8* %6)
ret i8* %4
}
void breakpoint(void) {}


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

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

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

LLVM IR (-O2):
define void @breakpoint() {
ret void
}
double psi(double r) { return 0.; }


x86 assembly (clang, -O0):
<psi>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
xorps  %xmm0,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<psi>:
xorps  %xmm0,%xmm0
ret

LLVM IR (-O0):
define double @psi(double %0) {
%2 = alloca double
store double %0, double* %2
ret double 0.000000e+00
}

LLVM IR (-O2):
define double @psi(double %0) {
ret double 0.000000e+00
}
unsigned blend_half32(register unsigned color1, register unsigned color2) {
  return (((((color1 >> 16) + (color2 >> 16)) >> 1) << 16) |
          (((((color1 & 0xFF00) >> 8) + ((color2 & 0xFF00) >> 8)) >> 1) << 8) |
          (((color1 & 0xFF) + (color2 & 0xFF)) >> 1));
}


x86 assembly (clang, -O0):
<blend_half32>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x10,%eax
mov    -0x8(%rbp),%ecx
shr    $0x10,%ecx
add    %ecx,%eax
shr    $0x1,%eax
shl    $0x10,%eax
mov    -0x4(%rbp),%ecx
and    $0xff00,%ecx
shr    $0x8,%ecx
mov    -0x8(%rbp),%edx
and    $0xff00,%edx
shr    $0x8,%edx
add    %edx,%ecx
shr    $0x1,%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0x4(%rbp),%ecx
and    $0xff,%ecx
mov    -0x8(%rbp),%edx
and    $0xff,%edx
add    %edx,%ecx
shr    $0x1,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<blend_half32>:
push   %rbx
mov    %esi,%ecx
mov    %edi,%eax
movzbl %ah,%edx
movzbl %al,%esi
mov    %edi,%ebx
shr    $0x10,%ebx
movzbl %ch,%edi
movzbl %cl,%eax
shr    $0x10,%ecx
add    %ebx,%ecx
and    $0xfffffffe,%ecx
shl    $0xf,%ecx
add    %edx,%edi
shl    $0x7,%edi
and    $0xff00,%edi
add    %esi,%eax
shr    %eax
or     %ecx,%eax
or     %edi,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @blend_half32(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = lshr i32 %5, 16
%7 = load i32, i32* %4
%8 = lshr i32 %7, 16
%9 = add i32 %6, %8
%10 = lshr i32 %9, 1
%11 = shl i32 %10, 16
%12 = load i32, i32* %3
%13 = and i32 %12, 65280
%14 = lshr i32 %13, 8
%15 = load i32, i32* %4
%16 = and i32 %15, 65280
%17 = lshr i32 %16, 8
%18 = add i32 %14, %17
%19 = lshr i32 %18, 1
%20 = shl i32 %19, 8
%21 = or i32 %11, %20
%22 = load i32, i32* %3
%23 = and i32 %22, 255
%24 = load i32, i32* %4
%25 = and i32 %24, 255
%26 = add i32 %23, %25
%27 = lshr i32 %26, 1
%28 = or i32 %21, %27
ret i32 %28
}

LLVM IR (-O2):
define i32 @blend_half32(i32 %0, i32 %1) {
%3 = lshr i32 %0, 16
%4 = lshr i32 %1, 16
%5 = add nuw nsw i32 %4, %3
%6 = shl nuw i32 %5, 15
%7 = and i32 %6, -65536
%8 = lshr i32 %0, 8
%9 = and i32 %8, 255
%10 = lshr i32 %1, 8
%11 = and i32 %10, 255
%12 = add nuw nsw i32 %11, %9
%13 = shl nuw nsw i32 %12, 7
%14 = and i32 %13, 65280
%15 = and i32 %0, 255
%16 = and i32 %1, 255
%17 = add nuw nsw i32 %16, %15
%18 = lshr i32 %17, 1
%19 = or i32 %7, %18
%20 = or i32 %19, %14
ret i32 %20
}
void print_msg(int msqid) {}


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

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

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

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