xunge/DecIR huggingface dataset:
/* Variables and functions */
scalar_t__ prime(int);
int /*<<< orphan*/ printf(char *, int);
void main() {
  int i;
  for (i = 2; i <= 100; i++)
    if (prime(i))
      printf("%d\n ", i);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x2,-0x4(%rbp)
cmpl   $0x64,-0x4(%rbp)
jg     116d <main+0x4d>
mov    -0x4(%rbp),%edi
call   1040 <prime@plt>
cmp    $0x0,%rax
je     115a <main+0x3a>
mov    -0x4(%rbp),%esi
lea    0xeab(%rip),%rdi
call   1030 <printf@plt>
jmp    115f <main+0x3f>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    112f <main+0xf>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0x2,%ebx
lea    0xed0(%rip),%r14
jmp    1148 <main+0x28>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%ebx
cmp    $0x65,%ebx
je     1160 <main+0x40>
mov    %ebx,%edi
call   1040 <prime@plt>
test   %rax,%rax
je     1140 <main+0x20>
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
jmp    1140 <main+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%d\0A \00"
define void @main() {
%1 = alloca i32
store i32 2, i32* %1
br label %2
2: ; preds = %13, %0
%3 = load i32, i32* %1
%4 = icmp sle i32 %3, 100
br i1 %4, label %5, label %16
5: ; preds = %2
%6 = load i32, i32* %1
%7 = call i64 @prime(i32 %6)
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %5
%10 = load i32, i32* %1
%11 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %10)
br label %12
12: ; preds = %9, %5
br label %13
13: ; preds = %12
%14 = load i32, i32* %1
%15 = add nsw i32 %14, 1
store i32 %15, i32* %1
br label %2
16: ; preds = %2
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"%d\0A \00"
define void @main() {
br label %1
1: ; preds = %0, %7
%2 = phi i32 [ 2, %0 ], [ %8, %7 ]
%3 = tail call i64 @prime(i32 %2)
%4 = icmp eq i64 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %1
%6 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %2)
br label %7
7: ; preds = %1, %5
%8 = add nuw nsw i32 %2, 1
%9 = icmp eq i32 %8, 101
br i1 %9, label %10, label %1
10: ; preds = %7
ret void
}
char *getFileName(char *fn) {
  char *ret = fn;
  while (*fn != 0) {
    fn++;
    if (*fn == '\\' || *fn == '/')
      ret = fn + 1;
  }
  return ret;
}


x86 assembly (clang, -O0):
<getFileName>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     115d <getFileName+0x5d>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5c,%eax
je     114c <getFileName+0x4c>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
jne    1158 <getFileName+0x58>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1110 <getFileName+0x10>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getFileName>:
mov    %rdi,%rax
cmpb   $0x0,(%rdi)
je     112b <getFileName+0x2b>
lea    0x2(%rax),%rcx
jmp    111b <getFileName+0x1b>
xchg   %ax,%ax
mov    %rcx,%rax
add    $0x1,%rcx
test   %dl,%dl
je     112b <getFileName+0x2b>
movzbl -0x1(%rcx),%edx
cmp    $0x5c,%dl
je     1110 <getFileName+0x10>
cmp    $0x2f,%dl
je     1110 <getFileName+0x10>
jmp    1113 <getFileName+0x13>
ret

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

LLVM IR (-O2):
define i8* @getFileName(i8* %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %14, label %4
4: ; preds = %1, %11
%5 = phi i8* [ %12, %11 ], [ %0, %1 ]
%6 = phi i8* [ %7, %11 ], [ %0, %1 ]
%7 = getelementptr inbounds i8, i8* %6, i64 1
%8 = load i8, i8* %7
switch i8 %8, label %11 [
i8 92, label %9
i8 47, label %9
]
9: ; preds = %4, %4
%10 = getelementptr inbounds i8, i8* %6, i64 2
br label %11
11: ; preds = %4, %9
%12 = phi i8* [ %10, %9 ], [ %5, %4 ]
%13 = icmp eq i8 %8, 0
br i1 %13, label %14, label %4
14: ; preds = %11, %1
%15 = phi i8* [ %0, %1 ], [ %12, %11 ]
ret i8* %15
}
unsigned int fn5(unsigned int x) { return x + (x & 1); }


x86 assembly (clang, -O0):
<fn5>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x4(%rbp),%ecx
and    $0x1,%ecx
add    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fn5>:
mov    %edi,%eax
and    $0x1,%eax
add    %edi,%eax
ret

LLVM IR (-O0):
define i32 @fn5(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* %2
%5 = and i32 %4, 1
%6 = add i32 %3, %5
ret i32 %6
}

LLVM IR (-O2):
define i32 @fn5(i32 %0) {
%2 = and i32 %0, 1
%3 = add i32 %2, %0
ret i32 %3
}
__attribute__((always_)) __attribute__((unused)) void
IndexToData(int *piFace, int *piVert, const int iIndexIn) {
  piVert[0] = iIndexIn & 0x3;
  piFace[0] = iIndexIn >> 2;
}


x86 assembly (clang, -O0):
<IndexToData>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x14(%rbp),%ecx
and    $0x3,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x14(%rbp),%ecx
sar    $0x2,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<IndexToData>:
mov    %edx,%eax
and    $0x3,%eax
mov    %eax,(%rsi)
sar    $0x2,%edx
mov    %edx,(%rdi)
ret

LLVM IR (-O0):
define void @IndexToData(i32* %0, i32* %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32
store i32* %0, i32** %4
store i32* %1, i32** %5
store i32 %2, i32* %6
%7 = load i32, i32* %6
%8 = and i32 %7, 3
%9 = load i32*, i32** %5
%10 = getelementptr inbounds i32, i32* %9, i64 0
store i32 %8, i32* %10
%11 = load i32, i32* %6
%12 = ashr i32 %11, 2
%13 = load i32*, i32** %4
%14 = getelementptr inbounds i32, i32* %13, i64 0
store i32 %12, i32* %14
ret void
}

LLVM IR (-O2):
define void @IndexToData(i32* nocapture writeonly %0, i32* nocapture writeonly %1, i32 %2) {
%4 = and i32 %2, 3
store i32 %4, i32* %1
%5 = ashr i32 %2, 2
store i32 %5, i32* %0
ret void
}
unsigned char xtime(unsigned char a) {
  return ((a & 0x80) ? ((a << 1) ^ 0x1B) : (a << 1));
}


x86 assembly (clang, -O0):
<xtime>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
and    $0x80,%eax
cmp    $0x0,%eax
je     112e <xtime+0x2e>
movzbl -0x1(%rbp),%eax
shl    $0x1,%eax
xor    $0x1b,%eax
mov    %eax,-0x8(%rbp)
jmp    1138 <xtime+0x38>
movzbl -0x1(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xtime>:
lea    (%rdi,%rdi,1),%eax
movzbl %al,%ecx
xor    $0x1b,%al
test   %dil,%dil
movzbl %al,%eax
cmovns %ecx,%eax
ret

LLVM IR (-O0):
define zeroext i8 @xtime(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = and i32 %4, 128
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %12
7: ; preds = %1
%8 = load i8, i8* %2
%9 = zext i8 %8 to i32
%10 = shl i32 %9, 1
%11 = xor i32 %10, 27
br label %16
12: ; preds = %1
%13 = load i8, i8* %2
%14 = zext i8 %13 to i32
%15 = shl i32 %14, 1
br label %16
16: ; preds = %12, %7
%17 = phi i32 [ %11, %7 ], [ %15, %12 ]
%18 = trunc i32 %17 to i8
ret i8 %18
}

LLVM IR (-O2):
define zeroext i8 @xtime(i8 zeroext %0) {
%2 = icmp sgt i8 %0, -1
%3 = shl i8 %0, 1
%4 = xor i8 %3, 27
%5 = select i1 %2, i8 %3, i8 %4
ret i8 %5
}
int scsi_bidi_cmnd(struct scsi_cmnd *cmd) { return 0; }


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

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

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

LLVM IR (-O2):
%struct.scsi_cmnd = type opaque
define i32 @scsi_bidi_cmnd(%struct.scsi_cmnd* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
int sub(int, int);
int main() {
  int a;
  int b = 1;
  double c = 0;
  char d = 'x';
  a = 10 / 2;
  c = (b + 3) * 4 - 5;
  b = sub(10, 8);
  return a;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0xc(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
movb   $0x78,-0x19(%rbp)
movl   $0x5,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x3,%eax
shl    $0x2,%eax
sub    $0x5,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    $0xa,%edi
mov    $0x8,%esi
call   1030 <sub@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0xa,%edi
mov    $0x8,%esi
call   1030 <sub@plt>
mov    $0x5,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca double
%5 = alloca i8
store i32 0, i32* %1
store i32 1, i32* %3
store double 0.000000e+00, double* %4
store i8 120, i8* %5
store i32 5, i32* %2
%6 = load i32, i32* %3
%7 = add nsw i32 %6, 3
%8 = mul nsw i32 %7, 4
%9 = sub nsw i32 %8, 5
%10 = sitofp i32 %9 to double
store double %10, double* %4
%11 = call i32 @sub(i32 10, i32 8)
store i32 %11, i32* %3
%12 = load i32, i32* %2
ret i32 %12
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @sub(i32 10, i32 8)
ret i32 5
}
/* Type definitions */
struct Node {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ thmprv_invariant(int);
void append(struct Node *head, struct Node *toAdd) {
  struct Node *p = head;
  while (p != (struct Node *)0) {
    thmprv_invariant(1);
    p = p;
  }
}


x86 assembly (clang, -O0):
<append>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     114a <append+0x3a>
mov    $0x1,%edi
call   1030 <thmprv_invariant@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    1128 <append+0x18>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<append>:
push   %rax
test   %rdi,%rdi
je     112c <append+0x1c>
mov    $0x1,%edi
call   1030 <thmprv_invariant@plt>
mov    $0x1,%edi
call   1030 <thmprv_invariant@plt>
jmp    1120 <append+0x10>
pop    %rax
ret

LLVM IR (-O0):
%struct.Node = type { i32 }
define void @append(%struct.Node* %0, %struct.Node* %1) {
%3 = alloca %struct.Node*
%4 = alloca %struct.Node*
%5 = alloca %struct.Node*
store %struct.Node* %0, %struct.Node** %3
store %struct.Node* %1, %struct.Node** %4
%6 = load %struct.Node*, %struct.Node** %3
store %struct.Node* %6, %struct.Node** %5
br label %7
7: ; preds = %10, %2
%8 = load %struct.Node*, %struct.Node** %5
%9 = icmp ne %struct.Node* %8, null
br i1 %9, label %10, label %13
10: ; preds = %7
%11 = call i32 @thmprv_invariant(i32 1)
%12 = load %struct.Node*, %struct.Node** %5
store %struct.Node* %12, %struct.Node** %5
br label %7
13: ; preds = %7
ret void
}

LLVM IR (-O2):
%struct.Node = type { i32 }
define void @append(%struct.Node* readnone %0, %struct.Node* nocapture readnone %1) {
%3 = icmp eq %struct.Node* %0, null
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = tail call i32 @thmprv_invariant(i32 1)
br label %6
6: ; preds = %6, %4
%7 = tail call i32 @thmprv_invariant(i32 1)
br label %6
8: ; preds = %2
ret void
}
/* Variables and functions */
scalar_t__ malloc(int);
void func(char **p, int num) { *p = (char *)malloc(num); }


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

x86 assembly (clang, -O2):
<func>:
push   %rbx
mov    %rdi,%rbx
mov    %esi,%edi
call   1030 <malloc@plt>
mov    %rax,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define void @func(i8** %0, i32 %1) {
%3 = alloca i8**
%4 = alloca i32
store i8** %0, i8*** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = call i64 @malloc(i32 %5)
%7 = inttoptr i64 %6 to i8*
%8 = load i8**, i8*** %3
store i8* %7, i8** %8
ret void
}

LLVM IR (-O2):
define void @func(i8** nocapture writeonly %0, i32 %1) {
%3 = tail call i64 @malloc(i32 %1)
%4 = inttoptr i64 %3 to i8*
store i8* %4, i8** %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ printf(char *, char *);
void SendCmd(char *_s) {
  printf("Cmd:%s\r\n", _s);
  free(_s);
}


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

x86 assembly (clang, -O2):
<SendCmd>:
push   %rbx
mov    %rdi,%rbx
lea    0xed5(%rip),%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

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

LLVM IR (-O2):
@.str = [9 x i8] c"Cmd:%s\0D\0A\00"
define void @SendCmd(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 @free(i8* %0)
ret void
}
float ToRadians(float angle, int radix) {
  switch (radix) {
  case 1:
    return (float)(angle * 3.1415926535897932384626433832795 / 180.0);
  case 2:
    return (float)(angle * 3.1415926535897932384626433832795 / 200.0);
  default:
    return angle;
  }
}


x86 assembly (clang, -O0):
<ToRadians>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x8(%rbp)
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
sub    $0x1,%eax
je     1131 <ToRadians+0x31>
jmp    1120 <ToRadians+0x20>
mov    -0x10(%rbp),%eax
sub    $0x2,%eax
je     1160 <ToRadians+0x60>
jmp    118f <ToRadians+0x8f>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xec6(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xec2(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1199 <ToRadians+0x99>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe97(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe83(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1199 <ToRadians+0x99>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<ToRadians>:
cmp    $0x2,%edi
je     1120 <ToRadians+0x20>
cmp    $0x1,%edi
jne    1138 <ToRadians+0x38>
cvtss2sd %xmm0,%xmm0
mulsd  0xeea(%rip),%xmm0
divsd  0xef2(%rip),%xmm0
jmp    1134 <ToRadians+0x34>
cvtss2sd %xmm0,%xmm0
mulsd  0xed4(%rip),%xmm0
divsd  0xed4(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
ret

LLVM IR (-O0):
define float @ToRadians(float %0, i32 %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca i32
store float %0, float* %4
store i32 %1, i32* %5
%6 = load i32, i32* %5
switch i32 %6, label %19 [
i32 1, label %7
i32 2, label %13
]
7: ; preds = %2
%8 = load float, float* %4
%9 = fpext float %8 to double
%10 = fmul double %9, 0x400921FB54442D18
%11 = fdiv double %10, 1.800000e+02
%12 = fptrunc double %11 to float
store float %12, float* %3
br label %21
13: ; preds = %2
%14 = load float, float* %4
%15 = fpext float %14 to double
%16 = fmul double %15, 0x400921FB54442D18
%17 = fdiv double %16, 2.000000e+02
%18 = fptrunc double %17 to float
store float %18, float* %3
br label %21
19: ; preds = %2
%20 = load float, float* %4
store float %20, float* %3
br label %21
21: ; preds = %19, %13, %7
%22 = load float, float* %3
ret float %22
}

LLVM IR (-O2):
define float @ToRadians(float %0, i32 %1) {
switch i32 %1, label %13 [
i32 1, label %3
i32 2, label %8
]
3: ; preds = %2
%4 = fpext float %0 to double
%5 = fmul double %4, 0x400921FB54442D18
%6 = fdiv double %5, 1.800000e+02
%7 = fptrunc double %6 to float
br label %13
8: ; preds = %2
%9 = fpext float %0 to double
%10 = fmul double %9, 0x400921FB54442D18
%11 = fdiv double %10, 2.000000e+02
%12 = fptrunc double %11 to float
br label %13
13: ; preds = %2, %8, %3
%14 = phi float [ %12, %8 ], [ %7, %3 ], [ %0, %2 ]
ret float %14
}
void av_stereo3d_alloc() {}


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

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

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

LLVM IR (-O2):
define void @av_stereo3d_alloc() {
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
uint32_t ror1(uint32_t x) { return (x >> 1) | (x << 31); }


x86 assembly (clang, -O0):
<ror1>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x1,%eax
mov    -0x4(%rbp),%ecx
shl    $0x1f,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ror1>:
mov    %edi,%eax
sar    %eax
shl    $0x1f,%edi
or     %edi,%eax
ret

LLVM IR (-O0):
define i32 @ror1(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = ashr i32 %3, 1
%5 = load i32, i32* %2
%6 = shl i32 %5, 31
%7 = or i32 %4, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @ror1(i32 %0) {
%2 = ashr i32 %0, 1
%3 = shl i32 %0, 31
%4 = or i32 %2, %3
ret i32 %4
}
void fail() {}


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

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

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

LLVM IR (-O2):
define void @fail() {
ret void
}
int db_last_modified(int id) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @db_last_modified(i32 %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int /*<<< orphan*/, char *, int, char *);
int /*<<< orphan*/ isalpha(int);
void t_isalpha_0x71() {
  Assert_real((isalpha(113)),
              "/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_isalpha.c",
              570, ("isalpha should be 1 for q"));
}


x86 assembly (clang, -O0):
<t_isalpha_0x71>:
push   %rbp
mov    %rsp,%rbp
mov    $0x71,%edi
call   1030 <isalpha@plt>
mov    %eax,%edi
lea    0xec9(%rip),%rsi
mov    $0x23a,%edx
lea    0xf65(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isalpha_0x71>:
push   %rax
mov    $0x71,%edi
call   1030 <isalpha@plt>
lea    0xece(%rip),%rsi
lea    0xf6f(%rip),%rcx
mov    %eax,%edi
mov    $0x23a,%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_isalpha.c\00"
@.str.1 = [26 x i8] c"isalpha should be 1 for q\00"
define void @t_isalpha_0x71() {
%1 = call i32 @isalpha(i32 113)
%2 = call i32 @Assert_real(i32 %1, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 570, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isalpha.c\00"
@.str.1 = [26 x i8] c"isalpha should be 1 for q\00"
define void @t_isalpha_0x71() {
%1 = tail call i32 @isalpha(i32 113)
%2 = tail call i32 @Assert_real(i32 %1, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 570, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ dev_t;
typedef int /*<<< orphan*/ dev;

/* Variables and functions */
int /*<<< orphan*/ AT_FDCWD;
int /*<<< orphan*/ memset(int /*<<< orphan*/ *, int /*<<< orphan*/, int);
int mknodat(int /*<<< orphan*/, char *, int, int /*<<< orphan*/);
int main(void) {
  dev_t dev;
  (void)memset(&dev, 0, sizeof(dev));
  return mknodat(AT_FDCWD, "test", 0600, dev);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x8(%rbp),%rdi
xor    %esi,%esi
mov    $0x4,%edx
call   1030 <memset@plt>
mov    0x2e92(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%ecx
lea    0xeae(%rip),%rsi
mov    $0x180,%edx
call   1040 <mknodat@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0x4(%rsp),%rdi
xor    %esi,%esi
mov    $0x4,%edx
call   1030 <memset@plt>
mov    0x2e9f(%rip),%rax
mov    (%rax),%edi
mov    0x4(%rsp),%ecx
lea    0xeba(%rip),%rsi
mov    $0x180,%edx
call   1040 <mknodat@plt>
pop    %rcx
ret

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

LLVM IR (-O2):
@AT_FDCWD = global i32 0
@.str = [5 x i8] c"test\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @memset(i32* %1, i32 0, i32 4)
%4 = load i32, i32* @AT_FDCWD
%5 = load i32, i32* %1
%6 = call i32 @mknodat(i32 %4, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 384, i32 %5)
ret i32 %6
}
/* Type definitions */
typedef int /*<<< orphan*/ WINDOW;

/* Variables and functions */
int mvwprintw(int /*<<< orphan*/ *, int, int, char const *, char *);
int s_mvwprintw(WINDOW *win, int y, int x, const char *fmt, char *string) {
  return (mvwprintw(win, y, x, fmt, string));
}


x86 assembly (clang, -O0):
<s_mvwprintw>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%r8
call   1030 <mvwprintw@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<s_mvwprintw>:
jmp    1030 <mvwprintw@plt>

LLVM IR (-O0):
define i32 @s_mvwprintw(i32* %0, i32 %1, i32 %2, i8* %3, i8* %4) {
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i8*
store i32* %0, i32** %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i8* %3, i8** %9
store i8* %4, i8** %10
%11 = load i32*, i32** %6
%12 = load i32, i32* %7
%13 = load i32, i32* %8
%14 = load i8*, i8** %9
%15 = load i8*, i8** %10
%16 = call i32 @mvwprintw(i32* %11, i32 %12, i32 %13, i8* %14, i8* %15)
ret i32 %16
}

LLVM IR (-O2):
define i32 @s_mvwprintw(i32* %0, i32 %1, i32 %2, i8* %3, i8* %4) {
%6 = tail call i32 @mvwprintw(i32* %0, i32 %1, i32 %2, i8* %3, i8* %4)
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void genImpar(int n) {
  int i, impar;
  for (i = 0; i < n; i++) {
    impar = 2 * i + 1;
    printf("%d ", impar);
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<genImpar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1159 <genImpar+0x49>
mov    -0x8(%rbp),%eax
shl    $0x1,%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1122 <genImpar+0x12>
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<genImpar>:
push   %rbp
push   %r14
push   %rbx
test   %edi,%edi
jle    1154 <genImpar+0x34>
mov    %edi,%ebx
mov    $0x1,%ebp
lea    0xeca(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x2,%ebp
add    $0xffffffff,%ebx
jne    1140 <genImpar+0x20>
mov    $0xa,%edi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%d \00"
@.str.1 = [2 x i8] c"\0A\00"
define void @genImpar(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
br label %5
5: ; preds = %15, %1
%6 = load i32, i32* %3
%7 = load i32, i32* %2
%8 = icmp slt i32 %6, %7
br i1 %8, label %9, label %18
9: ; preds = %5
%10 = load i32, i32* %3
%11 = mul nsw i32 2, %10
%12 = add nsw i32 %11, 1
store i32 %12, i32* %4
%13 = load i32, i32* %4
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %13)
br label %15
15: ; preds = %9
%16 = load i32, i32* %3
%17 = add nsw i32 %16, 1
store i32 %17, i32* %3
br label %5
18: ; preds = %5
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d \00"
define void @genImpar(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %3, label %10
3: ; preds = %1, %3
%4 = phi i32 [ %8, %3 ], [ 0, %1 ]
%5 = shl nuw nsw i32 %4, 1
%6 = or i32 %5, 1
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = add nuw nsw i32 %4, 1
%9 = icmp eq i32 %8, %0
br i1 %9, label %10, label %3
10: ; preds = %3, %1
%11 = tail call i32 @putchar(i32 10)
ret void
}
void mbo_ap_check_sta_assoc(struct hostapd_data *hapd, struct sta_info *sta,
                            struct ieee802_11_elems *elems) {}


x86 assembly (clang, -O0):
<mbo_ap_check_sta_assoc>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.hostapd_data = type opaque
%struct.sta_info = type opaque
%struct.ieee802_11_elems = type opaque
define void @mbo_ap_check_sta_assoc(%struct.hostapd_data* %0, %struct.sta_info* %1, %struct.ieee802_11_elems* %2) {
%4 = alloca %struct.hostapd_data*
%5 = alloca %struct.sta_info*
%6 = alloca %struct.ieee802_11_elems*
store %struct.hostapd_data* %0, %struct.hostapd_data** %4
store %struct.sta_info* %1, %struct.sta_info** %5
store %struct.ieee802_11_elems* %2, %struct.ieee802_11_elems** %6
ret void
}

LLVM IR (-O2):
%struct.hostapd_data = type opaque
%struct.sta_info = type opaque
%struct.ieee802_11_elems = type opaque
define void @mbo_ap_check_sta_assoc(%struct.hostapd_data* nocapture %0, %struct.sta_info* nocapture %1, %struct.ieee802_11_elems* nocapture %2) {
ret void
}
int Abs(int val) {
  if (val < 0)
    return -val;
  return val;
}


x86 assembly (clang, -O0):
<Abs>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    111e <Abs+0x1e>
xor    %eax,%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1124 <Abs+0x24>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @Abs(i32 %0) {
%2 = tail call i32 @llvm.abs.i32(i32 %0, i1 true)
ret i32 %2
}
int is_leap(int year) {
  if (year % 100 == 0) {
    return year % 400 == 0;
  }
  return year % 4 == 0;
}


x86 assembly (clang, -O0):
<is_leap>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1139 <is_leap+0x39>
mov    -0x8(%rbp),%eax
mov    $0x190,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
jmp    1152 <is_leap+0x52>
mov    -0x8(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_leap>:
imul   $0xc28f5c29,%edi,%eax
add    $0x51eb850,%eax
ror    $0x2,%eax
cmp    $0x28f5c28,%eax
jbe    111a <is_leap+0x1a>
and    $0x3,%edi
jmp    1139 <is_leap+0x39>
movslq %edi,%rax
imul   $0x51eb851f,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x27,%rax
add    %ecx,%eax
imul   $0x190,%eax,%eax
sub    %eax,%edi
xor    %eax,%eax
test   %edi,%edi
sete   %al
ret

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

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


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
mov    0x2f15(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0x2f12(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0x2f0f(%rip),%rax
mov    %rax,-0x8(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
@constinit = private global [3 x [2 x i32]] [[2 x i32] [i32 1, i32 2], [2 x i32] [i32 3, i32 4], [2 x i32] [i32 5, i32 6]]
define void @f() {
%1 = alloca [3 x [2 x i32]]
%2 = getelementptr inbounds [3 x [2 x i32]], [3 x [2 x i32]]* %1, i64 0, i64 0
%3 = bitcast [3 x [2 x i32]]* %1 to i8*
%4 = getelementptr inbounds [3 x [2 x i32]], [3 x [2 x i32]]* %1, i64 0, i64 0
ret void
}

LLVM IR (-O2):
define void @f() {
ret void
}
int main() {
  signed short int a = L'a';
  signed short int b = L'b';
  return b - a;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movw   $0x61,-0x6(%rbp)
movw   $0x62,-0x8(%rbp)
movswl -0x8(%rbp),%eax
movswl -0x6(%rbp),%ecx
sub    %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i16
%3 = alloca i16
store i32 0, i32* %1
store i16 97, i16* %2
store i16 98, i16* %3
%4 = load i16, i16* %3
%5 = sext i16 %4 to i32
%6 = load i16, i16* %2
%7 = sext i16 %6 to i32
%8 = sub nsw i32 %5, %7
ret i32 %8
}

LLVM IR (-O2):
define i32 @main() {
ret i32 1
}
/* Variables and functions */
char *strrchr(char const *, char);
char *my_basename(const char *path) {
  const char *base = strrchr(path, '/');
  if (base)
    return (char *)base + 1;
  return (char *)path;
}


x86 assembly (clang, -O0):
<my_basename>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x2f,%esi
call   1030 <strrchr@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     114a <my_basename+0x3a>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1152 <my_basename+0x42>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_basename>:
push   %rbx
mov    %rdi,%rbx
mov    $0x2f,%esi
call   1030 <strrchr@plt>
lea    0x1(%rax),%rcx
test   %rax,%rax
cmove  %rbx,%rcx
mov    %rcx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define i8* @my_basename(i8* %0) {
%2 = tail call i8* @strrchr(i8* dereferenceable(1) %0, i8 signext 47)
%3 = icmp eq i8* %2, null
%4 = getelementptr inbounds i8, i8* %2, i64 1
%5 = select i1 %3, i8* %0, i8* %4
ret i8* %5
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char const *);
int /*<<< orphan*/ *stderr;
int /*<<< orphan*/ *stdout;
void helpAndLeave(const char *progname, int status) {
  FILE *stream = stderr;
  if (status == EXIT_SUCCESS) {
    stream = stdout;
  }
  fprintf(stream, "Usage: %s <seconds>.\n", progname);
  exit(status);
}


x86 assembly (clang, -O0):
<helpAndLeave>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    0x2eaa(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    0x2e89(%rip),%rcx
cmp    (%rcx),%eax
jne    115d <helpAndLeave+0x3d>
mov    0x2e82(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rdx
lea    0xe94(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0xc(%rbp),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<helpAndLeave>:
push   %rbx
mov    %esi,%ebx
mov    %rdi,%rdx
mov    0x2ea3(%rip),%rax
cmp    %esi,(%rax)
jne    113a <helpAndLeave+0x1a>
mov    0x2ea0(%rip),%rax
jmp    1141 <helpAndLeave+0x21>
mov    0x2e9f(%rip),%rax
mov    (%rax),%rdi
lea    0xeb5(%rip),%rsi
call   1030 <fprintf@plt>
mov    %ebx,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32* null
@EXIT_SUCCESS = global i32 0
@stdout = global i32* null
@.str = [22 x i8] c"Usage: %s <seconds>.\0A\00"
define void @helpAndLeave(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32*
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i32*, i32** @stderr
store i32* %6, i32** %5
%7 = load i32, i32* %4
%8 = load i32, i32* @EXIT_SUCCESS
%9 = icmp eq i32 %7, %8
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = load i32*, i32** @stdout
store i32* %11, i32** %5
br label %12
12: ; preds = %10, %2
%13 = load i32*, i32** %5
%14 = load i8*, i8** %3
%15 = call i32 @fprintf(i32* %13, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %14)
%16 = load i32, i32* %4
%17 = call i32 @exit(i32 %16)
unreachable
}

LLVM IR (-O2):
@stderr = global i32* null
@EXIT_SUCCESS = global i32 0
@stdout = global i32* null
@.str = [22 x i8] c"Usage: %s <seconds>.\0A\00"
define void @helpAndLeave(i8* %0, i32 %1) {
%3 = load i32, i32* @EXIT_SUCCESS
%4 = icmp eq i32 %3, %1
%5 = load i32*, i32** @stdout
%6 = load i32*, i32** @stderr
%7 = select i1 %4, i32* %5, i32* %6
%8 = tail call i32 @fprintf(i32* %7, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %0)
%9 = tail call i32 @exit(i32 %1)
unreachable
}
void rop3_249_0_0(unsigned char *D, unsigned char S, unsigned char T) {
  unsigned char stk1;
  unsigned char stk2;
  stk2 = *D ^ S;
  stk2 = ~stk2;
  stk1 = T | stk2;
  *D = stk1;
}


x86 assembly (clang, -O0):
<rop3_249_0_0>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
movzbl -0x9(%rbp),%ecx
xor    %ecx,%eax
mov    %al,-0xc(%rbp)
movzbl -0xc(%rbp),%eax
xor    $0xffffffff,%eax
mov    %al,-0xc(%rbp)
movzbl -0xa(%rbp),%eax
movzbl -0xc(%rbp),%ecx
or     %ecx,%eax
mov    %al,-0xb(%rbp)
mov    -0xb(%rbp),%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<rop3_249_0_0>:
xor    (%rdi),%sil
not    %sil
or     %dl,%sil
mov    %sil,(%rdi)
ret

LLVM IR (-O0):
define void @rop3_249_0_0(i8* %0, i8 zeroext %1, i8 zeroext %2) {
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8
%8 = alloca i8
store i8* %0, i8** %4
store i8 %1, i8* %5
store i8 %2, i8* %6
%9 = load i8*, i8** %4
%10 = load i8, i8* %9
%11 = zext i8 %10 to i32
%12 = load i8, i8* %5
%13 = zext i8 %12 to i32
%14 = xor i32 %11, %13
%15 = trunc i32 %14 to i8
store i8 %15, i8* %8
%16 = load i8, i8* %8
%17 = zext i8 %16 to i32
%18 = xor i32 %17, -1
%19 = trunc i32 %18 to i8
store i8 %19, i8* %8
%20 = load i8, i8* %6
%21 = zext i8 %20 to i32
%22 = load i8, i8* %8
%23 = zext i8 %22 to i32
%24 = or i32 %21, %23
%25 = trunc i32 %24 to i8
store i8 %25, i8* %7
%26 = load i8, i8* %7
%27 = load i8*, i8** %4
store i8 %26, i8* %27
ret void
}

LLVM IR (-O2):
define void @rop3_249_0_0(i8* nocapture %0, i8 zeroext %1, i8 zeroext %2) {
%4 = load i8, i8* %0
%5 = xor i8 %4, %1
%6 = xor i8 %5, -1
%7 = or i8 %6, %2
store i8 %7, i8* %0
ret void
}
/* Variables and functions */
unsigned long ntohl(unsigned long);
unsigned long ficlNtohl(unsigned long number) { return ntohl(number); }


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

x86 assembly (clang, -O2):
<ficlNtohl>:
jmp    1030 <ntohl@plt>

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

LLVM IR (-O2):
define i64 @ficlNtohl(i64 %0) {
%2 = tail call i64 @ntohl(i64 %0)
ret i64 %2
}
/* Type definitions */
struct buffer_head {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ __bforget(struct buffer_head *);
void bforget(struct buffer_head *buf) {
  if (buf)
    __bforget(buf);
}


x86 assembly (clang, -O0):
<bforget>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1130 <bforget+0x20>
mov    -0x8(%rbp),%rdi
call   1030 <__bforget@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bforget>:
test   %rdi,%rdi
je     111a <bforget+0xa>
jmp    1030 <__bforget@plt>
ret

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

LLVM IR (-O2):
%struct.buffer_head = type { i32 }
define void @bforget(%struct.buffer_head* %0) {
%2 = icmp eq %struct.buffer_head* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @__bforget(%struct.buffer_head* %0)
br label %5
5: ; preds = %3, %1
ret void
}
int restore_weight(signed char weight) {
  int result;
  if ((result = (int)weight << 3) > 0)
    result += (result + 64) >> 7;
  return result;
}


x86 assembly (clang, -O0):
<restore_weight>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
shl    $0x3,%eax
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
jle    112c <restore_weight+0x2c>
mov    -0x8(%rbp),%eax
add    $0x40,%eax
sar    $0x7,%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<restore_weight>:
lea    0x40(,%rdi,8),%eax
sar    $0x7,%eax
xor    %ecx,%ecx
test   %dil,%dil
cmovg  %eax,%ecx
lea    (%rcx,%rdi,8),%eax
ret

LLVM IR (-O0):
define i32 @restore_weight(i8 signext %0) {
%2 = alloca i8
%3 = alloca i32
store i8 %0, i8* %2
%4 = load i8, i8* %2
%5 = sext i8 %4 to i32
%6 = shl i32 %5, 3
store i32 %6, i32* %3
%7 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %14
8: ; preds = %1
%9 = load i32, i32* %3
%10 = add nsw i32 %9, 64
%11 = ashr i32 %10, 7
%12 = load i32, i32* %3
%13 = add nsw i32 %12, %11
store i32 %13, i32* %3
br label %14
14: ; preds = %8, %1
%15 = load i32, i32* %3
ret i32 %15
}

LLVM IR (-O2):
define i32 @restore_weight(i8 signext %0) {
%2 = sext i8 %0 to i32
%3 = shl nsw i32 %2, 3
%4 = icmp sgt i8 %0, 0
%5 = add nsw i32 %3, 64
%6 = ashr i32 %5, 7
%7 = select i1 %4, i32 %6, i32 0
%8 = add nsw i32 %7, %3
ret i32 %8
}
void ECAPClockDisable(unsigned int baseAdd) {
  (*((volatile unsigned int *)(baseAdd + 0x08))) |= 0x02;
}


x86 assembly (clang, -O0):
<ECAPClockDisable>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x8,%eax
mov    %eax,%eax
mov    (%rax),%ecx
or     $0x2,%ecx
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<ECAPClockDisable>:
add    $0x8,%edi
orl    $0x2,(%rdi)
ret

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

LLVM IR (-O2):
define void @ECAPClockDisable(i32 %0) {
%2 = add i32 %0, 8
%3 = zext i32 %2 to i64
%4 = inttoptr i64 %3 to i32*
%5 = load volatile i32, i32* %4
%6 = or i32 %5, 2
store volatile i32 %6, i32* %4
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
void p_free_vector(float *v, long nl, long nh) { free((char *)(v + nl - 1)); }


x86 assembly (clang, -O0):
<p_free_vector>:
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),%rax
shl    $0x2,%rax
add    %rax,%rdi
add    $0xfffffffffffffffc,%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<p_free_vector>:
lea    (%rdi,%rsi,4),%rdi
add    $0xfffffffffffffffc,%rdi
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @p_free_vector(float* %0, i64 %1, i64 %2) {
%4 = alloca float*
%5 = alloca i64
%6 = alloca i64
store float* %0, float** %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%7 = load float*, float** %4
%8 = load i64, i64* %5
%9 = getelementptr inbounds float, float* %7, i64 %8
%10 = getelementptr inbounds float, float* %9, i64 -1
%11 = bitcast float* %10 to i8*
%12 = call i32 @free(i8* %11)
ret void
}

LLVM IR (-O2):
define void @p_free_vector(float* nocapture %0, i64 %1, i64 %2) {
%4 = getelementptr inbounds float, float* %0, i64 %1
%5 = getelementptr inbounds float, float* %4, i64 -1
%6 = bitcast float* %5 to i8*
%7 = tail call i32 @free(i8* %6)
ret void
}
double ConvertAnyFormat(void) { return 0; }


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

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

LLVM IR (-O0):
define double @ConvertAnyFormat() {
ret double 0.000000e+00
}

LLVM IR (-O2):
define double @ConvertAnyFormat() {
ret double 0.000000e+00
}
long uu() { return 0x7fff7fffL; }


x86 assembly (clang, -O0):
<uu>:
push   %rbp
mov    %rsp,%rbp
mov    $0x7fff7fff,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i64 @uu() {
ret i64 2147450879
}

LLVM IR (-O2):
define i64 @uu() {
ret i64 2147450879
}
/* Variables and functions */
int /*<<< orphan*/ clang_analyzer_eval(int);
scalar_t__ strcasecmp(char *, char *);
void strcasecmp_constant_and_var_1() {
  char *x = "abc";
  clang_analyzer_eval(strcasecmp("Abc", x) == 0);
}


x86 assembly (clang, -O0):
<strcasecmp_constant_and_var_1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xec6(%rip),%rdi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <clang_analyzer_eval@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcasecmp_constant_and_var_1>:
push   %rax
lea    0xedc(%rip),%rdi
lea    0xed1(%rip),%rsi
call   1030 <strcasecmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
pop    %rax
jmp    1040 <clang_analyzer_eval@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"abc\00"
@.str.1 = [4 x i8] c"Abc\00"
define void @strcasecmp_constant_and_var_1() {
%1 = alloca i8*
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8** %1
%2 = load i8*, i8** %1
%3 = call i64 @strcasecmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%4 = icmp eq i64 %3, 0
%5 = zext i1 %4 to i32
%6 = call i32 @clang_analyzer_eval(i32 %5)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"abc\00"
@.str.1 = [4 x i8] c"Abc\00"
define void @strcasecmp_constant_and_var_1() {
%1 = tail call i64 @strcasecmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @clang_analyzer_eval(i32 %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
char getchar();
int /*<<< orphan*/ putc(char, int /*<<< orphan*/);
int /*<<< orphan*/ putchar(char);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ stdout;
main() {
  char c;
  c = getchar();
  fflush(stdin);
  putc(c, stdout);
  putchar(c);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %al,-0x1(%rbp)
mov    0x2e8f(%rip),%rax
mov    (%rax),%edi
call   1060 <fflush@plt>
mov    -0x1(%rbp),%al
mov    0x2e6e(%rip),%rcx
mov    (%rcx),%esi
movsbl %al,%edi
call   1040 <putc@plt>
movsbl -0x1(%rbp),%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1050 <getchar@plt>
mov    %eax,%ebx
mov    0x2e97(%rip),%rax
mov    (%rax),%edi
call   1060 <fflush@plt>
mov    0x2e79(%rip),%rax
mov    (%rax),%esi
movsbl %bl,%ebx
mov    %ebx,%edi
call   1040 <putc@plt>
mov    %ebx,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@stdin = global i32 0
@stdout = global i32 0
define i32 @main() {
%1 = alloca i8
%2 = call signext i8 (...) @getchar()
store i8 %2, i8* %1
%3 = load i32, i32* @stdin
%4 = call i32 @fflush(i32 %3)
%5 = load i8, i8* %1
%6 = load i32, i32* @stdout
%7 = call i32 @putc(i8 signext %5, i32 %6)
%8 = load i8, i8* %1
%9 = call i32 @putchar(i8 signext %8)
ret i32 0
}

LLVM IR (-O2):
@stdin = global i32 0
@stdout = global i32 0
define i32 @main() {
%1 = tail call signext i8 (...) @getchar()
%2 = load i32, i32* @stdin
%3 = tail call i32 @fflush(i32 %2)
%4 = load i32, i32* @stdout
%5 = tail call i32 @putc(i8 signext %1, i32 %4)
%6 = tail call i32 @putchar(i8 signext %1)
ret i32 0
}
int baz(int a) { return 4; }


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

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

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

LLVM IR (-O2):
define i32 @baz(i32 %0) {
ret i32 4
}