xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ int_copy(int *, int *);
int restrict_test(void) {
  int a = 5, b = 2;
  int_copy(&b, &a);
  return a != b;
}


x86 assembly (clang, -O0):
<restrict_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x5,-0x4(%rbp)
movl   $0x2,-0x8(%rbp)
lea    -0x8(%rbp),%rdi
lea    -0x4(%rbp),%rsi
call   1030 <int_copy@plt>
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
setne  %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<restrict_test>:
push   %rax
movl   $0x5,0x4(%rsp)
movl   $0x2,(%rsp)
mov    %rsp,%rdi
lea    0x4(%rsp),%rsi
call   1030 <int_copy@plt>
mov    0x4(%rsp),%ecx
xor    %eax,%eax
cmp    (%rsp),%ecx
setne  %al
pop    %rcx
ret

LLVM IR (-O0):
define i32 @restrict_test() {
%1 = alloca i32
%2 = alloca i32
store i32 5, i32* %1
store i32 2, i32* %2
%3 = call i32 @int_copy(i32* %2, i32* %1)
%4 = load i32, i32* %1
%5 = load i32, i32* %2
%6 = icmp ne i32 %4, %5
%7 = zext i1 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
define i32 @restrict_test() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
store i32 5, i32* %1
%4 = bitcast i32* %2 to i8*
store i32 2, i32* %2
%5 = call i32 @int_copy(i32* %2, i32* %1)
%6 = load i32, i32* %1
%7 = load i32, i32* %2
%8 = icmp ne i32 %6, %7
%9 = zext i1 %8 to i32
ret i32 %9
}
/* Type definitions */
typedef int /*<<< orphan*/ wchar_t;
typedef int /*<<< orphan*/ va_list;

/* Variables and functions */
int __mingw_vfwscanf(int /*<<< orphan*/, int /*<<< orphan*/ const *,
                     int /*<<< orphan*/);
int /*<<< orphan*/ stdin;
int __mingw_vwscanf(const wchar_t *format, va_list argp) {
  return __mingw_vfwscanf(stdin, format, argp);
}


x86 assembly (clang, -O0):
<__mingw_vwscanf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    0x2ec2(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1030 <__mingw_vfwscanf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__mingw_vwscanf>:
mov    %esi,%edx
mov    %rdi,%rsi
mov    0x2ecc(%rip),%rax
mov    (%rax),%edi
jmp    1030 <__mingw_vfwscanf@plt>

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

LLVM IR (-O2):
@stdin = global i32 0
define i32 @__mingw_vwscanf(i32* %0, i32 %1) {
%3 = load i32, i32* @stdin
%4 = tail call i32 @__mingw_vfwscanf(i32 %3, i32* %0, i32 %1)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ GetLine(char *, int, int /*<<< orphan*/);
int atoi(char *);
int GetInt(void) {
  char s[20];
  GetLine(s, 18, 0);
  return (atoi(s));
}


x86 assembly (clang, -O0):
<GetInt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    -0x20(%rbp),%rdi
mov    $0x12,%esi
xor    %edx,%edx
call   1030 <GetLine@plt>
lea    -0x20(%rbp),%rdi
call   1040 <atoi@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetInt>:
push   %rbx
sub    $0x20,%rsp
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x12,%esi
xor    %edx,%edx
call   1030 <GetLine@plt>
mov    %rbx,%rdi
call   1040 <atoi@plt>
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @GetInt() {
%1 = alloca [20 x i8]
%2 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%3 = call i32 @GetLine(i8* %2, i32 18, i32 0)
%4 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%5 = call i32 @atoi(i8* %4)
ret i32 %5
}

LLVM IR (-O2):
define i32 @GetInt() {
%1 = alloca [20 x i8]
%2 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%3 = call i32 @GetLine(i8* %2, i32 18, i32 0)
%4 = call i32 @atoi(i8* %2)
ret i32 %4
}
/* Variables and functions */
long atoi(char *);
int /*<<< orphan*/ self_assignement();
int main(int argc, char *argv[]) {
  long i, n;
  n = atoi(argv[1]);
  for (i = 0; i < n; i++)
    self_assignement();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <atoi@plt>
mov    %rax,-0x20(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x20(%rbp),%rax
jge    1175 <main+0x55>
mov    $0x0,%al
call   1030 <self_assignement@plt>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    114f <main+0x2f>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    0x8(%rsi),%rdi
call   1040 <atoi@plt>
test   %rax,%rax
jle    114d <main+0x2d>
mov    %rax,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %eax,%eax
call   1030 <self_assignement@plt>
add    $0xffffffffffffffff,%rbx
jne    1140 <main+0x20>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call i64 @atoi(i8* %4)
%6 = icmp sgt i64 %5, 0
br i1 %6, label %7, label %12
7: ; preds = %2, %7
%8 = phi i64 [ %10, %7 ], [ 0, %2 ]
%9 = tail call i32 (...) @self_assignement()
%10 = add nuw nsw i64 %8, 1
%11 = icmp eq i64 %10, %5
br i1 %11, label %12, label %7
12: ; preds = %7, %2
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int sommaDispari(int);
int main(void) {
  int n;
  scanf("%d", &n);
  printf("%d", sommaDispari(n));
  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   1030 <sommaDispari@plt>
mov    %eax,%esi
lea    0xea0(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xec4(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    0xc(%rsp),%edi
call   1030 <sommaDispari@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 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 ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%4 = load i32, i32* %2
%5 = call i32 @sommaDispari(i32 %4)
%6 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %5)
ret i32 0
}

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


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

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

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

LLVM IR (-O2):
define void @PostOfficeDeInit() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ RESHLm(int);
void RES2HLm() { RESHLm(0x04); }


x86 assembly (clang, -O0):
<RES2HLm>:
push   %rbp
mov    %rsp,%rbp
mov    $0x4,%edi
call   1030 <RESHLm@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<RES2HLm>:
mov    $0x4,%edi
jmp    1030 <RESHLm@plt>

LLVM IR (-O0):
define void @RES2HLm() {
%1 = call i32 @RESHLm(i32 4)
ret void
}

LLVM IR (-O2):
define void @RES2HLm() {
%1 = tail call i32 @RESHLm(i32 4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ strcpy(char *, char const *);
size_t strlen(char *);
char *strcat(char *dst, const char *src) {
  size_t p;
  p = strlen(dst);
  strcpy(&dst[p], src);
  return dst;
}


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

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

LLVM IR (-O0):
define i8* @strcat(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i64
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = call i64 @strlen(i8* %6)
store i64 %7, i64* %5
%8 = load i8*, i8** %3
%9 = load i64, i64* %5
%10 = getelementptr inbounds i8, i8* %8, i64 %9
%11 = load i8*, i8** %4
%12 = call i32 @strcpy(i8* %10, i8* %11)
%13 = load i8*, i8** %3
ret i8* %13
}

LLVM IR (-O2):
define i8* @strcat(i8* returned %0, i8* %1) {
%3 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = tail call i32 @strcpy(i8* %4, i8* %1)
ret i8* %0
}
/* Variables and functions */
bool isOperator(char c) { return c == '+' || c == '-' || c == '*' || c == '/'; }


x86 assembly (clang, -O0):
<isOperator>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x2b,%ecx
mov    %al,-0x2(%rbp)
je     114d <isOperator+0x4d>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x2d,%ecx
mov    %al,-0x2(%rbp)
je     114d <isOperator+0x4d>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x2a,%ecx
mov    %al,-0x2(%rbp)
je     114d <isOperator+0x4d>
movsbl -0x1(%rbp),%eax
cmp    $0x2f,%eax
sete   %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isOperator>:
cmp    $0x2d,%dil
ja     1120 <isOperator+0x20>
mov    $0x1,%eax
movzbl %dil,%ecx
movabs $0x2c0000000000,%rdx
bt     %rcx,%rdx
jae    1120 <isOperator+0x20>
ret
xor    %eax,%eax
cmp    $0x2f,%dil
sete   %al
ret

LLVM IR (-O0):
define i32 @isOperator(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp eq i32 %4, 43
br i1 %5, label %18, label %6
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp eq i32 %8, 45
br i1 %9, label %18, label %10
10: ; preds = %6
%11 = load i8, i8* %2
%12 = sext i8 %11 to i32
%13 = icmp eq i32 %12, 42
br i1 %13, label %18, label %14
14: ; preds = %10
%15 = load i8, i8* %2
%16 = sext i8 %15 to i32
%17 = icmp eq i32 %16, 47
br label %18
18: ; preds = %14, %10, %6, %1
%19 = phi i1 [ true, %10 ], [ true, %6 ], [ true, %1 ], [ %17, %14 ]
%20 = zext i1 %19 to i32
ret i32 %20
}

LLVM IR (-O2):
define i32 @isOperator(i8 signext %0) {
switch i8 %0, label %2 [
i8 45, label %5
i8 43, label %5
i8 42, label %5
]
2: ; preds = %1
%3 = icmp eq i8 %0, 47
%4 = zext i1 %3 to i32
br label %5
5: ; preds = %1, %1, %1, %2
%6 = phi i32 [ 1, %1 ], [ %4, %2 ], [ 1, %1 ], [ 1, %1 ]
ret i32 %6
}
int isLeapYear(int year) {
  if ((year % 4 == 0) && ((year % 100 != 0) || (year % 400 == 0)))
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<isLeapYear>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    114f <isLeapYear+0x4f>
mov    -0x8(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1143 <isLeapYear+0x43>
mov    -0x8(%rbp),%eax
mov    $0x190,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    114f <isLeapYear+0x4f>
movl   $0x1,-0x4(%rbp)
jmp    1156 <isLeapYear+0x56>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isLeapYear>:
test   $0x3,%dil
jne    1143 <isLeapYear+0x43>
imul   $0xc28f5c29,%edi,%ecx
add    $0x51eb850,%ecx
ror    $0x2,%ecx
mov    $0x1,%eax
cmp    $0x28f5c28,%ecx
ja     1145 <isLeapYear+0x45>
movslq %edi,%rcx
imul   $0x51eb851f,%rcx,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x27,%rcx
add    %edx,%ecx
imul   $0x190,%ecx,%ecx
sub    %ecx,%edi
je     1145 <isLeapYear+0x45>
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @isLeapYear(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = srem i32 %4, 4
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %16
7: ; preds = %1
%8 = load i32, i32* %3
%9 = srem i32 %8, 100
%10 = icmp ne i32 %9, 0
br i1 %10, label %15, label %11
11: ; preds = %7
%12 = load i32, i32* %3
%13 = srem i32 %12, 400
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %11, %7
store i32 1, i32* %2
br label %17
16: ; preds = %11, %1
store i32 0, i32* %2
br label %17
17: ; preds = %16, %15
%18 = load i32, i32* %2
ret i32 %18
}

LLVM IR (-O2):
define i32 @isLeapYear(i32 %0) {
%2 = and i32 %0, 3
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %10
4: ; preds = %1
%5 = srem i32 %0, 100
%6 = icmp ne i32 %5, 0
%7 = srem i32 %0, 400
%8 = icmp eq i32 %7, 0
%9 = or i1 %6, %8
br i1 %9, label %11, label %10
10: ; preds = %4, %1
br label %11
11: ; preds = %4, %10
%12 = phi i32 [ 0, %10 ], [ 1, %4 ]
ret i32 %12
}
void RTStrmWriteEx(void) {}


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

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

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

LLVM IR (-O2):
define void @RTStrmWriteEx() {
ret void
}
int AdvancedAI_Play(void *p, void *game) { return 0; }


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

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

LLVM IR (-O0):
define i32 @AdvancedAI_Play(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
ret i32 0
}

LLVM IR (-O2):
define i32 @AdvancedAI_Play(i8* nocapture readnone %0, i8* nocapture readnone %1) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ LOG_ERR;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ syslog(int /*<<< orphan*/, char *, char *);
void usage() {
  syslog(LOG_ERR, "usage: rshd [-%s]", "alnLVh");
  exit(2);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
lea    0xed7(%rip),%rdx
call   1030 <syslog@plt>
mov    $0x2,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    0x2eb0(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
lea    0xeda(%rip),%rdx
call   1030 <syslog@plt>
mov    $0x2,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@LOG_ERR = global i32 0
@.str = [18 x i8] c"usage: rshd [-%s]\00"
@.str.1 = [7 x i8] c"alnLVh\00"
define void @usage() {
%1 = load i32, i32* @LOG_ERR
%2 = call i32 @syslog(i32 %1, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @exit(i32 2)
unreachable
}

LLVM IR (-O2):
@LOG_ERR = global i32 0
@.str = [18 x i8] c"usage: rshd [-%s]\00"
@.str.1 = [7 x i8] c"alnLVh\00"
define void @usage() {
%1 = load i32, i32* @LOG_ERR
%2 = tail call i32 @syslog(i32 %1, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @exit(i32 2)
unreachable
}
char char_fetch_and_acquire(char *ptr, int value) {
  return __atomic_fetch_and(ptr, value, 2);
}


x86 assembly (clang, -O0):
<char_fetch_and_acquire>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%ecx
mov    %cl,-0xd(%rbp)
mov    -0xd(%rbp),%cl
mov    %cl,-0x10(%rbp)
mov    (%rax),%al
mov    %al,-0xf(%rbp)
mov    -0xf(%rbp),%al
mov    -0x18(%rbp),%rcx
mov    -0x10(%rbp),%sil
mov    %al,%dl
and    %sil,%dl
lock cmpxchg %dl,(%rcx)
sete   %cl
mov    %al,-0x19(%rbp)
test   $0x1,%cl
mov    %al,-0xf(%rbp)
jne    114f <char_fetch_and_acquire+0x4f>
jmp    1124 <char_fetch_and_acquire+0x24>
mov    -0x19(%rbp),%al
mov    %al,-0xe(%rbp)
movsbl -0xe(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<char_fetch_and_acquire>:
mov    (%rdi),%al
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %eax,%ecx
and    %sil,%cl
lock cmpxchg %cl,(%rdi)
jne    1110 <char_fetch_and_acquire+0x10>
ret

LLVM IR (-O0):
define signext i8 @char_fetch_and_acquire(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8
%6 = alloca i8
store i8* %0, i8** %3
store i32 %1, i32* %4
%7 = load i8*, i8** %3
%8 = load i32, i32* %4
%9 = trunc i32 %8 to i8
store i8 %9, i8* %5
%10 = load i8, i8* %5
%11 = atomicrmw and i8* %7, i8 %10 acquire
store i8 %11, i8* %6
%12 = load i8, i8* %6
ret i8 %12
}

LLVM IR (-O2):
define signext i8 @char_fetch_and_acquire(i8* nocapture %0, i32 %1) {
%3 = trunc i32 %1 to i8
%4 = atomicrmw and i8* %0, i8 %3 acquire
ret i8 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_attr_t;

/* Variables and functions */
int pthread_attr_getstack(int /*<<< orphan*/ *, void **, size_t *);
int my_pthread_attr_getstack(pthread_attr_t const *__attr, void **stack_base,
                             size_t *stack_size) {
  pthread_attr_t *realattr = (pthread_attr_t *)*(int *)__attr;
  return pthread_attr_getstack(realattr, stack_base, stack_size);
}


x86 assembly (clang, -O0):
<my_pthread_attr_getstack>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movslq (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <pthread_attr_getstack@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_pthread_attr_getstack>:
movslq (%rdi),%rdi
jmp    1030 <pthread_attr_getstack@plt>

LLVM IR (-O0):
define i32 @my_pthread_attr_getstack(i32* %0, i8** %1, i64* %2) {
%4 = alloca i32*
%5 = alloca i8**
%6 = alloca i64*
%7 = alloca i32*
store i32* %0, i32** %4
store i8** %1, i8*** %5
store i64* %2, i64** %6
%8 = load i32*, i32** %4
%9 = load i32, i32* %8
%10 = sext i32 %9 to i64
%11 = inttoptr i64 %10 to i32*
store i32* %11, i32** %7
%12 = load i32*, i32** %7
%13 = load i8**, i8*** %5
%14 = load i64*, i64** %6
%15 = call i32 @pthread_attr_getstack(i32* %12, i8** %13, i64* %14)
ret i32 %15
}

LLVM IR (-O2):
define i32 @my_pthread_attr_getstack(i32* nocapture %0, i8** %1, i64* %2) {
%4 = load i32, i32* %0
%5 = sext i32 %4 to i64
%6 = inttoptr i64 %5 to i32*
%7 = tail call i32 @pthread_attr_getstack(i32* %6, i8** %1, i64* %2)
ret i32 %7
}
unsigned short return_ushort() { return 42; }


x86 assembly (clang, -O0):
<return_ushort>:
push   %rbp
mov    %rsp,%rbp
mov    $0x2a,%ax
movzwl %ax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<return_ushort>:
mov    $0x2a,%ax
ret

LLVM IR (-O0):
define zeroext i16 @return_ushort() {
ret i16 42
}

LLVM IR (-O2):
define zeroext i16 @return_ushort() {
ret i16 42
}
/* Variables and functions */
int /*<<< orphan*/ print_char_console(char const);
void print_string_console(const char *my_string) {
  while (*my_string != '\0') {
    print_char_console(*my_string);
    my_string++;
  }
}


x86 assembly (clang, -O0):
<print_string_console>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1149 <print_string_console+0x39>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <print_char_console@plt>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    111c <print_string_console+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_string_console>:
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     1133 <print_string_console+0x23>
mov    %rdi,%rbx
add    $0x1,%rbx
xchg   %ax,%ax
movsbl %al,%edi
call   1030 <print_char_console@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <print_string_console+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @print_string_console(i8* nocapture %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 i8 [ %9, %4 ], [ %2, %1 ]
%6 = phi i8* [ %8, %4 ], [ %0, %1 ]
%7 = tail call i32 @print_char_console(i8 signext %5)
%8 = getelementptr inbounds i8, i8* %6, i64 1
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4, %1
ret void
}
/* Variables and functions */
void func2(int **f) {
  if (*f != NULL) {
    **f = 5;
  }
}


x86 assembly (clang, -O0):
<func2>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
je     1123 <func2+0x23>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movl   $0x5,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<func2>:
mov    (%rdi),%rax
test   %rax,%rax
je     110e <func2+0xe>
movl   $0x5,(%rax)
ret

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

LLVM IR (-O2):
define void @func2(i32** nocapture %0) {
%2 = load i32*, i32** %0
%3 = icmp eq i32* %2, null
br i1 %3, label %5, label %4
4: ; preds = %1
store i32 5, i32* %2
br label %5
5: ; preds = %4, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ pri_funct_msg_vr(char *);
void _tga_stat_column_head(void) {
  pri_funct_msg_vr("bo  num map img mapor mapsi mbi xorig yorig xsize ysize "
                   "pix img filename");
}


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

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

LLVM IR (-O0):
@.str = [73 x i8] c"bo num map img mapor mapsi mbi xorig yorig xsize ysize pix img filename\00"
define void @_tga_stat_column_head() {
%1 = call i32 @pri_funct_msg_vr(i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [73 x i8] c"bo num map img mapor mapsi mbi xorig yorig xsize ysize pix img filename\00"
define void @_tga_stat_column_head() {
%1 = tail call i32 @pri_funct_msg_vr(i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str, i64 0, i64 0))
ret void
}
long sumOfSquares(long a, long b) { return a * a + b * b; }


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

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

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

LLVM IR (-O2):
define i64 @sumOfSquares(i64 %0, i64 %1) {
%3 = mul nsw i64 %0, %0
%4 = mul nsw i64 %1, %1
%5 = add nuw nsw i64 %4, %3
ret i64 %5
}
/* Variables and functions */
long double __infer_nondet_long_double();
long double log1pl(long double x) { return __infer_nondet_long_double(); }


x86 assembly (clang, -O0):
<log1pl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
xor    %eax,%eax
call   1030 <__infer_nondet_long_double@plt>
fld    %st(0)
fstp   %st(0)
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define x86_fp80 @log1pl(x86_fp80 %0) {
%2 = alloca x86_fp80
store x86_fp80 %0, x86_fp80* %2
%3 = call x86_fp80 (...) @__infer_nondet_long_double()
ret x86_fp80 %3
}

LLVM IR (-O2):
define x86_fp80 @log1pl(x86_fp80 %0) {
%2 = tail call x86_fp80 (...) @__infer_nondet_long_double()
ret x86_fp80 %2
}
void cli(void) { asm("cli"); }


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

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

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

LLVM IR (-O2):
define void @cli() {
tail call void asm sideeffect "cli", "~{dirflag},~{fpsr},~{flags}"()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ printf(char *, char, char);
int main() {
  int i = 0x0102;
  char *p = (char *)&i;
  printf("Bytes of i: %d, %d\n", p[0], p[1]);
  assert(p[0] == 2);
  assert(p[1] == 1);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x102,-0x4(%rbp)
lea    -0x4(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%cl
mov    -0x10(%rbp),%rax
lea    0xeb8(%rip),%rdi
movsbl %cl,%esi
movsbl 0x1(%rax),%edx
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x1,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
mov    $0x2,%esi
mov    $0x1,%edx
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <assert@plt>
mov    $0x1,%edi
call   1040 <assert@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [20 x i8] c"Bytes of i: %d, %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
store i32 258, i32* %1
%3 = bitcast i32* %1 to i8*
store i8* %3, i8** %2
%4 = load i8*, i8** %2
%5 = getelementptr inbounds i8, i8* %4, i64 0
%6 = load i8, i8* %5
%7 = load i8*, i8** %2
%8 = getelementptr inbounds i8, i8* %7, i64 1
%9 = load i8, i8* %8
%10 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8 signext %6, i8 signext %9)
%11 = load i8*, i8** %2
%12 = getelementptr inbounds i8, i8* %11, i64 0
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %14, 2
%16 = zext i1 %15 to i32
%17 = call i32 @assert(i32 %16)
%18 = load i8*, i8** %2
%19 = getelementptr inbounds i8, i8* %18, i64 1
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = icmp eq i32 %21, 1
%23 = zext i1 %22 to i32
%24 = call i32 @assert(i32 %23)
ret i32 0
}

LLVM IR (-O2):
@.str = [20 x i8] c"Bytes of i: %d, %d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8 signext 2, i8 signext 1)
%2 = tail call i32 @assert(i32 1)
%3 = tail call i32 @assert(i32 1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isascii(int);
void t_isascii_0xa0() {
  Assert_real((isascii(160) == 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_isascii.c",
              805, ("isascii should be 0 for 0xa0"));
}


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

x86 assembly (clang, -O2):
<t_isascii_0xa0>:
push   %rax
mov    $0xa0,%edi
call   1030 <isascii@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x325,%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_isascii.c\00"
@.str.1 = [29 x i8] c"isascii should be 0 for 0xa0\00"
define void @t_isascii_0xa0() {
%1 = call i64 @isascii(i32 160)
%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 805, 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_isascii.c\00"
@.str.1 = [29 x i8] c"isascii should be 0 for 0xa0\00"
define void @t_isascii_0xa0() {
%1 = tail call i64 @isascii(i32 160)
%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 805, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ft_error();
void *malloc(size_t);
void *ft_malloc(size_t size) {
  void *ptr;
  ptr = malloc(size);
  if (!ptr) {
    ft_error();
    return (((void *)0));
  }
  return (ptr);
}


x86 assembly (clang, -O0):
<ft_malloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1158 <ft_malloc+0x38>
mov    $0x0,%al
call   1040 <ft_error@plt>
movq   $0x0,-0x8(%rbp)
jmp    1160 <ft_malloc+0x40>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_malloc>:
push   %rbx
call   1030 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1135 <ft_malloc+0x15>
xor    %eax,%eax
call   1040 <ft_error@plt>
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define noalias i8* @ft_malloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 (...) @ft_error()
br label %6
6: ; preds = %1, %4
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int);
void parent_handler(int signal) {
  printf("client child recv a signal=%d\n", signal);
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<parent_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xecb(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e9f(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<parent_handler>:
push   %rax
mov    %edi,%esi
lea    0xed6(%rip),%rdi
call   1030 <printf@plt>
mov    0x2eaa(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [31 x i8] c"client child recv a signal=%d\0A\00"
@EXIT_SUCCESS = global i32 0
define void @parent_handler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = load i32, i32* @EXIT_SUCCESS
%6 = call i32 @exit(i32 %5)
unreachable
}

LLVM IR (-O2):
@.str = [31 x i8] c"client child recv a signal=%d\0A\00"
@EXIT_SUCCESS = global i32 0
define void @parent_handler(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 %0)
%3 = load i32, i32* @EXIT_SUCCESS
%4 = tail call i32 @exit(i32 %3)
unreachable
}
/* Type definitions */
struct carray {
  int dummy;
};

/* Variables and functions */
struct carray *_carray_map(struct carray *, int (*)(void *, void *), void *,
                           int /*<<< orphan*/);
struct carray *carray_reject(struct carray *a, int (*match_fn)(void *, void *),
                             void *arg) {
  return _carray_map(a, match_fn, arg, 0);
}


x86 assembly (clang, -O0):
<carray_reject>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
xor    %ecx,%ecx
call   1030 <_carray_map@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<carray_reject>:
xor    %ecx,%ecx
jmp    1030 <_carray_map@plt>

LLVM IR (-O0):
%struct.carray = type { i32 }
define %struct.carray* @carray_reject(%struct.carray* %0, i32 (i8*, i8*)* %1, i8* %2) {
%4 = alloca %struct.carray*
%5 = alloca i32 (i8*, i8*)*
%6 = alloca i8*
store %struct.carray* %0, %struct.carray** %4
store i32 (i8*, i8*)* %1, i32 (i8*, i8*)** %5
store i8* %2, i8** %6
%7 = load %struct.carray*, %struct.carray** %4
%8 = load i32 (i8*, i8*)*, i32 (i8*, i8*)** %5
%9 = load i8*, i8** %6
%10 = call %struct.carray* @_carray_map(%struct.carray* %7, i32 (i8*, i8*)* %8, i8* %9, i32 0)
ret %struct.carray* %10
}

LLVM IR (-O2):
%struct.carray = type { i32 }
define %struct.carray* @carray_reject(%struct.carray* %0, i32 (i8*, i8*)* %1, i8* %2) {
%4 = tail call %struct.carray* @_carray_map(%struct.carray* %0, i32 (i8*, i8*)* %1, i8* %2, i32 0)
ret %struct.carray* %4
}
/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, unsigned char);
void sprint_mov_to_atRi(char *str, unsigned char i) {
  sprintf(str, "MOV   @R%X, A                    ", i);
}


x86 assembly (clang, -O0):
<sprint_mov_to_atRi>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xed3(%rip),%rsi
movzbl -0x9(%rbp),%edx
call   1030 <sprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sprint_mov_to_atRi>:
mov    %esi,%edx
lea    0xee7(%rip),%rsi
jmp    1030 <sprintf@plt>

LLVM IR (-O0):
@.str = [34 x i8] c"MOV @R%X, A \00"
define void @sprint_mov_to_atRi(i8* %0, i8 zeroext %1) {
%3 = alloca i8*
%4 = alloca i8
store i8* %0, i8** %3
store i8 %1, i8* %4
%5 = load i8*, i8** %3
%6 = load i8, i8* %4
%7 = call i32 @sprintf(i8* %5, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8 zeroext %6)
ret void
}

LLVM IR (-O2):
@.str = [34 x i8] c"MOV @R%X, A \00"
define void @sprint_mov_to_atRi(i8* nocapture writeonly %0, i8 zeroext %1) {
%3 = tail call i32 @sprintf(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8 zeroext %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void walk(int steps) {
  printf("I'm a dog, I can jump %d steps one time\n", steps);
}


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

x86 assembly (clang, -O2):
<walk>:
mov    %edi,%esi
lea    0xee7(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [41 x i8] c"I'm a dog, I can jump %d steps one time\0A\00"
define void @walk(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i32 %3)
ret void
}

LLVM IR (-O2):
@.str = [41 x i8] c"I'm a dog, I can jump %d steps one time\0A\00"
define void @walk(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
int method() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @method() {
ret i32 0
}
unsigned long nvx_rgb_hash(unsigned char r, unsigned char g, unsigned char b) {
  unsigned long h = 5381;
  h = ((h << 5) + h) + r;
  h = ((h << 5) + h) + g;
  h = ((h << 5) + h) + b;
  return h;
}


x86 assembly (clang, -O0):
<nvx_rgb_hash>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %sil,%cl
mov    %dil,%dl
mov    %dl,-0x1(%rbp)
mov    %cl,-0x2(%rbp)
mov    %al,-0x3(%rbp)
movq   $0x1505,-0x10(%rbp)
mov    -0x10(%rbp),%rax
shl    $0x5,%rax
add    -0x10(%rbp),%rax
movzbl -0x1(%rbp),%ecx
add    %rcx,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
shl    $0x5,%rax
add    -0x10(%rbp),%rax
movzbl -0x2(%rbp),%ecx
add    %rcx,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
shl    $0x5,%rax
add    -0x10(%rbp),%rax
movzbl -0x3(%rbp),%ecx
add    %rcx,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<nvx_rgb_hash>:
mov    %edi,%eax
mov    %rax,%rcx
shl    $0x5,%rcx
add    %rax,%rcx
mov    %esi,%eax
add    %rcx,%rax
mov    %rax,%rcx
shl    $0x5,%rcx
add    %rax,%rcx
mov    %edx,%eax
add    %rcx,%rax
add    $0xb86b2e5,%rax
ret

LLVM IR (-O0):
define i64 @nvx_rgb_hash(i8 zeroext %0, i8 zeroext %1, i8 zeroext %2) {
%4 = alloca i8
%5 = alloca i8
%6 = alloca i8
%7 = alloca i64
store i8 %0, i8* %4
store i8 %1, i8* %5
store i8 %2, i8* %6
store i64 5381, i64* %7
%8 = load i64, i64* %7
%9 = shl i64 %8, 5
%10 = load i64, i64* %7
%11 = add i64 %9, %10
%12 = load i8, i8* %4
%13 = zext i8 %12 to i64
%14 = add i64 %11, %13
store i64 %14, i64* %7
%15 = load i64, i64* %7
%16 = shl i64 %15, 5
%17 = load i64, i64* %7
%18 = add i64 %16, %17
%19 = load i8, i8* %5
%20 = zext i8 %19 to i64
%21 = add i64 %18, %20
store i64 %21, i64* %7
%22 = load i64, i64* %7
%23 = shl i64 %22, 5
%24 = load i64, i64* %7
%25 = add i64 %23, %24
%26 = load i8, i8* %6
%27 = zext i8 %26 to i64
%28 = add i64 %25, %27
store i64 %28, i64* %7
%29 = load i64, i64* %7
ret i64 %29
}

LLVM IR (-O2):
define i64 @nvx_rgb_hash(i8 zeroext %0, i8 zeroext %1, i8 zeroext %2) {
%4 = zext i8 %0 to i64
%5 = mul nuw nsw i64 %4, 33
%6 = add nuw nsw i64 %5, 5859909
%7 = zext i8 %1 to i64
%8 = add nuw nsw i64 %6, %7
%9 = mul nuw nsw i64 %8, 33
%10 = zext i8 %2 to i64
%11 = add nuw nsw i64 %9, %10
ret i64 %11
}
/* Variables and functions */
int htoi(char *);
int /*<<< orphan*/ printf(char *, int);
int main() {
  int test = htoi("0xAA");
  printf("= %d\n", test);
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [5 x i8] c"0xAA\00"
@.str.1 = [6 x i8] c"= %d\0A\00"
define i32 @main() {
%1 = tail call i32 @htoi(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %1)
ret i32 0
}
/* Variables and functions */
int strlen(char *s) {
  int i;
  for (i = 0; s[i] != '\0'; i++)
    ;
  return i;
}


x86 assembly (clang, -O0):
<strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1137 <strlen+0x37>
jmp    1129 <strlen+0x29>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <strlen+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strlen>:
mov    $0xffffffff,%eax
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%eax
cmpb   $0x0,(%rdi)
lea    0x1(%rdi),%rdi
jne    1110 <strlen+0x10>
ret

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

LLVM IR (-O2):
define i32 @strlen(i8* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ %7, %2 ], [ 0, %1 ]
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
%7 = add nuw i64 %3, 1
br i1 %6, label %8, label %2
8: ; preds = %2
%9 = trunc i64 %3 to i32
ret i32 %9
}
long long test_di(long long a, long long b) {
  return (a << 19) | ((unsigned long long)b >> 45);
}


x86 assembly (clang, -O0):
<test_di>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
shl    $0x13,%rax
mov    -0x10(%rbp),%rcx
shr    $0x2d,%rcx
or     %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_di>:
mov    %rdi,%rax
shld   $0x13,%rsi,%rax
ret

LLVM IR (-O0):
define i64 @test_di(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = shl i64 %5, 19
%7 = load i64, i64* %4
%8 = lshr i64 %7, 45
%9 = or i64 %6, %8
ret i64 %9
}

LLVM IR (-O2):
define i64 @test_di(i64 %0, i64 %1) {
%3 = tail call i64 @llvm.fshl.i64(i64 %0, i64 %1, i64 19)
ret i64 %3
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void list_Free(void *data) { free((data)); }


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

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

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

LLVM IR (-O2):
define void @list_Free(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
/* Type definitions */
typedef int uint8_t;
typedef int uint16_t;

/* Variables and functions */
int /*<<< orphan*/ emu8k_outw(int, int, void *);
void emu8k_outb(uint16_t addr, uint8_t val, void *p) {
  if (addr & 1)
    emu8k_outw(addr & ~1, val << 8, p);
  else
    emu8k_outw(addr, val, p);
}


x86 assembly (clang, -O0):
<emu8k_outb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x4(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     114b <emu8k_outb+0x3b>
mov    -0x4(%rbp),%edi
and    $0xfffffffe,%edi
mov    -0x8(%rbp),%esi
shl    $0x8,%esi
mov    -0x10(%rbp),%rdx
call   1030 <emu8k_outw@plt>
jmp    115a <emu8k_outb+0x4a>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%rdx
call   1030 <emu8k_outw@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<emu8k_outb>:
test   $0x1,%dil
je     111c <emu8k_outb+0xc>
and    $0xfffffffe,%edi
shl    $0x8,%esi
jmp    1030 <emu8k_outw@plt>

LLVM IR (-O0):
define void @emu8k_outb(i32 %0, i32 %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
store i32 %0, i32* %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%7 = load i32, i32* %4
%8 = and i32 %7, 1
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %17
10: ; preds = %3
%11 = load i32, i32* %4
%12 = and i32 %11, -2
%13 = load i32, i32* %5
%14 = shl i32 %13, 8
%15 = load i8*, i8** %6
%16 = call i32 @emu8k_outw(i32 %12, i32 %14, i8* %15)
br label %22
17: ; preds = %3
%18 = load i32, i32* %4
%19 = load i32, i32* %5
%20 = load i8*, i8** %6
%21 = call i32 @emu8k_outw(i32 %18, i32 %19, i8* %20)
br label %22
22: ; preds = %17, %10
ret void
}

LLVM IR (-O2):
define void @emu8k_outb(i32 %0, i32 %1, i8* %2) {
%4 = and i32 %0, 1
%5 = icmp eq i32 %4, 0
br i1 %5, label %10, label %6
6: ; preds = %3
%7 = and i32 %0, -2
%8 = shl i32 %1, 8
%9 = tail call i32 @emu8k_outw(i32 %7, i32 %8, i8* %2)
br label %12
10: ; preds = %3
%11 = tail call i32 @emu8k_outw(i32 %0, i32 %1, i8* %2)
br label %12
12: ; preds = %10, %6
ret void
}
/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, unsigned char);
int writeString(char *, unsigned char *);
int drive(unsigned char n, unsigned char *d) {
  char f[30];
  sprintf(f, "/sys/class/gpio/gpio%d/drive", n);
  return writeString(f, d);
}


x86 assembly (clang, -O0):
<drive>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x30(%rbp),%rdi
lea    0xec3(%rip),%rsi
movzbl -0x1(%rbp),%edx
call   1040 <sprintf@plt>
lea    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <writeString@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<drive>:
push   %r14
push   %rbx
sub    $0x28,%rsp
mov    %rsi,%rbx
mov    %edi,%edx
lea    0xecd(%rip),%rsi
mov    %rsp,%r14
mov    %r14,%rdi
call   1040 <sprintf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <writeString@plt>
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [29 x i8] c"/sys/class/gpio/gpio%d/drive\00"
define i32 @drive(i8 zeroext %0, i8* %1) {
%3 = alloca i8
%4 = alloca i8*
%5 = alloca [30 x i8]
store i8 %0, i8* %3
store i8* %1, i8** %4
%6 = getelementptr inbounds [30 x i8], [30 x i8]* %5, i64 0, i64 0
%7 = load i8, i8* %3
%8 = call i32 @sprintf(i8* %6, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8 zeroext %7)
%9 = getelementptr inbounds [30 x i8], [30 x i8]* %5, i64 0, i64 0
%10 = load i8*, i8** %4
%11 = call i32 @writeString(i8* %9, i8* %10)
ret i32 %11
}

LLVM IR (-O2):
@.str = [29 x i8] c"/sys/class/gpio/gpio%d/drive\00"
define i32 @drive(i8 zeroext %0, i8* %1) {
%3 = alloca [30 x i8]
%4 = getelementptr inbounds [30 x i8], [30 x i8]* %3, i64 0, i64 0
%5 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8 zeroext %0)
%6 = call i32 @writeString(i8* %4, i8* %1)
ret i32 %6
}
int test_imm_98uint64_highword_reg(unsigned long long val) {
  return ((val >> 32) & (0x98 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_98uint64_highword_reg>:
movabs $0x9800000000,%rax
test   %rax,%rdi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_98uint64_highword_reg(i64 %0) {
%2 = and i64 %0, 652835028992
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}