xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ errAbort(char *, char *, char *);
char *mustFindVarData(char *);
int sscanf(char *, char *, double *);
double cgiDouble(char *varName) {
  char *data;
  double x;
  data = mustFindVarData(varName);
  if (sscanf(data, "%lf", &x) < 1)
    errAbort("Expecting real number in %s, got \"%s\"\n", varName, data);
  return x;
}


x86 assembly (clang, -O0):
<cgiDouble>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <mustFindVarData@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xeac(%rip),%rsi
lea    -0x18(%rbp),%rdx
call   1040 <sscanf@plt>
cmp    $0x1,%eax
jge    117a <cgiDouble+0x4a>
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
lea    0xe8f(%rip),%rdi
call   1030 <errAbort@plt>
movsd  -0x18(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cgiDouble>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1050 <mustFindVarData@plt>
mov    %rax,%rbx
lea    0xeba(%rip),%rsi
mov    %rsp,%rdx
mov    %rax,%rdi
call   1040 <sscanf@plt>
test   %eax,%eax
jg     1167 <cgiDouble+0x37>
lea    0xea8(%rip),%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1030 <errAbort@plt>
movsd  (%rsp),%xmm0
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%lf\00"
@.str.1 = [39 x i8] c"Expecting real number in %s, got \22%s\22\0A\00"
define double @cgiDouble(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca double
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i8* @mustFindVarData(i8* %5)
store i8* %6, i8** %3
%7 = load i8*, i8** %3
%8 = call i32 @sscanf(i8* %7, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %4)
%9 = icmp slt i32 %8, 1
br i1 %9, label %10, label %14
10: ; preds = %1
%11 = load i8*, i8** %2
%12 = load i8*, i8** %3
%13 = call i32 @errAbort(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), i8* %11, i8* %12)
br label %14
14: ; preds = %10, %1
%15 = load double, double* %4
ret double %15
}

LLVM IR (-O2):
@.str = [4 x i8] c"%lf\00"
@.str.1 = [39 x i8] c"Expecting real number in %s, got \22%s\22\0A\00"
define double @cgiDouble(i8* %0) {
%2 = alloca double
%3 = bitcast double* %2 to i8*
%4 = tail call i8* @mustFindVarData(i8* %0)
%5 = call i32 @sscanf(i8* %4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %2)
%6 = icmp slt i32 %5, 1
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = call i32 @errAbort(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), i8* %0, i8* %4)
br label %9
9: ; preds = %7, %1
%10 = load double, double* %2
ret double %10
}
double scale_dh32(double x, double y, double z) { return 0.0; }


x86 assembly (clang, -O0):
<scale_dh32>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
xorps  %xmm0,%xmm0
pop    %rbp
ret

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

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

LLVM IR (-O2):
define double @scale_dh32(double %0, double %1, double %2) {
ret double 0.000000e+00
}
int test_imm_40int64_midword_reg(long long val) {
  return ((val >> 16) & (0x40 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_40int64_midword_reg>:
test   $0x400000,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_40int64_midword_reg(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = ashr i64 %3, 16
%5 = and i64 %4, 64
%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_40int64_midword_reg(i64 %0) {
%2 = and i64 %0, 4194304
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ memset(void *, int /*<<< orphan*/, size_t);
void *realloc(void *, size_t);
void *recalloc(void *p, size_t oldSize, size_t newSize) {
  p = realloc(p, newSize);
  if (!p || oldSize > newSize)
    return p;
  memset(p + oldSize, 0, newSize - oldSize);
  return p;
}


x86 assembly (clang, -O0):
<recalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1040 <realloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     115e <recalloc+0x3e>
mov    -0x18(%rbp),%rax
cmp    -0x20(%rbp),%rax
jbe    116b <recalloc+0x4b>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    118a <recalloc+0x6a>
mov    -0x10(%rbp),%rdi
add    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rdx
sub    -0x18(%rbp),%rdx
xor    %esi,%esi
call   1030 <memset@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<recalloc>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%rbx
mov    %rsi,%r15
mov    %rdx,%rsi
call   1040 <realloc@plt>
mov    %rax,%r14
sub    %r15,%rbx
jb     1150 <recalloc+0x30>
test   %r14,%r14
je     1150 <recalloc+0x30>
mov    %r14,%rdi
add    %r15,%rdi
xor    %esi,%esi
mov    %rbx,%rdx
call   1030 <memset@plt>
mov    %r14,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @recalloc(i8* %0, i64 %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i64
store i8* %0, i8** %5
store i64 %1, i64* %6
store i64 %2, i64* %7
%8 = load i8*, i8** %5
%9 = load i64, i64* %7
%10 = call i8* @realloc(i8* %8, i64 %9)
store i8* %10, i8** %5
%11 = load i8*, i8** %5
%12 = icmp ne i8* %11, null
br i1 %12, label %13, label %17
13: ; preds = %3
%14 = load i64, i64* %6
%15 = load i64, i64* %7
%16 = icmp ugt i64 %14, %15
br i1 %16, label %17, label %19
17: ; preds = %13, %3
%18 = load i8*, i8** %5
store i8* %18, i8** %4
br label %28
19: ; preds = %13
%20 = load i8*, i8** %5
%21 = load i64, i64* %6
%22 = getelementptr i8, i8* %20, i64 %21
%23 = load i64, i64* %7
%24 = load i64, i64* %6
%25 = sub i64 %23, %24
%26 = call i32 @memset(i8* %22, i32 0, i64 %25)
%27 = load i8*, i8** %5
store i8* %27, i8** %4
br label %28
28: ; preds = %19, %17
%29 = load i8*, i8** %4
ret i8* %29
}

LLVM IR (-O2):
define i8* @recalloc(i8* nocapture %0, i64 %1, i64 %2) {
%4 = tail call i8* @realloc(i8* %0, i64 %2)
%5 = icmp eq i8* %4, null
%6 = icmp ult i64 %2, %1
%7 = or i1 %6, %5
br i1 %7, label %12, label %8
8: ; preds = %3
%9 = getelementptr i8, i8* %4, i64 %1
%10 = sub i64 %2, %1
%11 = tail call i32 @memset(i8* %9, i32 0, i64 %10)
br label %12
12: ; preds = %3, %8
ret i8* %4
}
/* Type definitions */
struct sockaddr {
  int dummy;
};

/* Variables and functions */
int recvfrom(int, char *, int, int /*<<< orphan*/, struct sockaddr *,
             int /*<<< orphan*/ *);
int /*<<< orphan*/ write(int, char *, int);
void TraitementSock(int sock) {
  char buf[256 + 1];
  int taillemessage;
  taillemessage = recvfrom(sock, buf, 257, 0, (struct sockaddr *)NULL, NULL);
  write(1, buf, taillemessage);
}


x86 assembly (clang, -O0):
<TraitementSock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x110(%rbp),%rsi
mov    $0x101,%edx
xor    %ecx,%ecx
xor    %eax,%eax
mov    %eax,%r9d
mov    %r9,%r8
call   1040 <recvfrom@plt>
mov    %eax,-0x114(%rbp)
lea    -0x110(%rbp),%rsi
mov    -0x114(%rbp),%edx
mov    $0x1,%edi
call   1030 <write@plt>
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<TraitementSock>:
push   %rbx
sub    $0x110,%rsp
mov    %rsp,%rbx
mov    %rbx,%rsi
mov    $0x101,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
call   1040 <recvfrom@plt>
mov    $0x1,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <write@plt>
add    $0x110,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.sockaddr = type { i32 }
define void @TraitementSock(i32 %0) {
%2 = alloca i32
%3 = alloca [257 x i8]
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = getelementptr inbounds [257 x i8], [257 x i8]* %3, i64 0, i64 0
%7 = call i32 @recvfrom(i32 %5, i8* %6, i32 257, i32 0, %struct.sockaddr* null, i32* null)
store i32 %7, i32* %4
%8 = getelementptr inbounds [257 x i8], [257 x i8]* %3, i64 0, i64 0
%9 = load i32, i32* %4
%10 = call i32 @write(i32 1, i8* %8, i32 %9)
ret void
}

LLVM IR (-O2):
%struct.sockaddr = type { i32 }
define void @TraitementSock(i32 %0) {
%2 = alloca [257 x i8]
%3 = getelementptr inbounds [257 x i8], [257 x i8]* %2, i64 0, i64 0
%4 = call i32 @recvfrom(i32 %0, i8* %3, i32 257, i32 0, %struct.sockaddr* null, i32* null)
%5 = call i32 @write(i32 1, i8* %3, i32 %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ put_count();
main(void) {
  for (int i = 0; i < 10; i++) {
    put_count();
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    1145 <main+0x35>
mov    $0x0,%al
call   1030 <put_count@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1126 <main+0x16>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @put_count()
%2 = tail call i32 (...) @put_count()
%3 = tail call i32 (...) @put_count()
%4 = tail call i32 (...) @put_count()
%5 = tail call i32 (...) @put_count()
%6 = tail call i32 (...) @put_count()
%7 = tail call i32 (...) @put_count()
%8 = tail call i32 (...) @put_count()
%9 = tail call i32 (...) @put_count()
%10 = tail call i32 (...) @put_count()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ leaf();
__attribute__((optimize("no-omit-frame-pointer"))) void non_leaf_2(void) {
  leaf();
}


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

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

LLVM IR (-O0):
define void @non_leaf_2() {
%1 = call i32 (...) @leaf()
ret void
}

LLVM IR (-O2):
define void @non_leaf_2() {
%1 = tail call i32 (...) @leaf()
ret void
}
/* Variables and functions */
int masked_match4(char *, char *, char *);
int masked_match(char *net_tok, char *mask_tok, char *string) {
  return masked_match4(net_tok, mask_tok, string);
}


x86 assembly (clang, -O0):
<masked_match>:
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
call   1030 <masked_match4@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<masked_match>:
jmp    1030 <masked_match4@plt>

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

LLVM IR (-O2):
define i32 @masked_match(i8* %0, i8* %1, i8* %2) {
%4 = tail call i32 @masked_match4(i8* %0, i8* %1, i8* %2)
ret i32 %4
}
void RGBAToYJRow_SSSE3() {}


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

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

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

LLVM IR (-O2):
define void @RGBAToYJRow_SSSE3() {
ret void
}
void fly_mouse(int enabled) {}


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

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

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

LLVM IR (-O2):
define void @fly_mouse(i32 %0) {
ret void
}
/* Type definitions */
struct ListNode {
  int dummy;
};

/* Variables and functions */
struct ListNode *recursive(int /*<<< orphan*/ *, struct ListNode *);
struct ListNode *reverseList(struct ListNode *head) {
  return recursive(NULL, head);
}


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

x86 assembly (clang, -O2):
<reverseList>:
mov    %rdi,%rsi
xor    %edi,%edi
jmp    1030 <recursive@plt>

LLVM IR (-O0):
%struct.ListNode = type { i32 }
define %struct.ListNode* @reverseList(%struct.ListNode* %0) {
%2 = alloca %struct.ListNode*
store %struct.ListNode* %0, %struct.ListNode** %2
%3 = load %struct.ListNode*, %struct.ListNode** %2
%4 = call %struct.ListNode* @recursive(i32* null, %struct.ListNode* %3)
ret %struct.ListNode* %4
}

LLVM IR (-O2):
%struct.ListNode = type { i32 }
define %struct.ListNode* @reverseList(%struct.ListNode* %0) {
%2 = tail call %struct.ListNode* @recursive(i32* null, %struct.ListNode* %0)
ret %struct.ListNode* %2
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ GPIODirModeSet(int /*<<< orphan*/, int /*<<< orphan*/, int);
int /*<<< orphan*/ GPIOPadConfigSet(int /*<<< orphan*/, int /*<<< orphan*/, int,
                                    int);
void GPIOPinTypePWM(uint32_t ui32Port, uint8_t ui8Pins) {
  ;
  GPIODirModeSet(ui32Port, ui8Pins, 0x00000002);
  GPIOPadConfigSet(ui32Port, ui8Pins, 0x00000001, 0x00000008);
}


x86 assembly (clang, -O0):
<GPIOPinTypePWM>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    $0x2,%edx
call   1040 <GPIODirModeSet@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    $0x1,%edx
mov    $0x8,%ecx
call   1030 <GPIOPadConfigSet@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GPIOPinTypePWM>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
mov    $0x2,%edx
call   1040 <GPIODirModeSet@plt>
mov    %ebp,%edi
mov    %ebx,%esi
mov    $0x1,%edx
mov    $0x8,%ecx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <GPIOPadConfigSet@plt>

LLVM IR (-O0):
define void @GPIOPinTypePWM(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = call i32 @GPIODirModeSet(i32 %5, i32 %6, i32 2)
%8 = load i32, i32* %3
%9 = load i32, i32* %4
%10 = call i32 @GPIOPadConfigSet(i32 %8, i32 %9, i32 1, i32 8)
ret void
}

LLVM IR (-O2):
define void @GPIOPinTypePWM(i32 %0, i32 %1) {
%3 = tail call i32 @GPIODirModeSet(i32 %0, i32 %1, i32 2)
%4 = tail call i32 @GPIOPadConfigSet(i32 %0, i32 %1, i32 1, i32 8)
ret void
}
int f3(volatile int *a) {
  int b = a[2];
  int c = a[1];
  return b + c;
}


x86 assembly (clang, -O0):
<f3>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f3>:
mov    0x8(%rdi),%eax
add    0x4(%rdi),%eax
ret

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

LLVM IR (-O2):
define i32 @f3(i32* %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 2
%3 = load volatile i32, i32* %2
%4 = getelementptr inbounds i32, i32* %0, i64 1
%5 = load volatile i32, i32* %4
%6 = add nsw i32 %5, %3
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ swaptmesh();
void swaptm_() { swaptmesh(); }


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

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

LLVM IR (-O0):
define void @swaptm_() {
%1 = call i32 (...) @swaptmesh()
ret void
}

LLVM IR (-O2):
define void @swaptm_() {
%1 = tail call i32 (...) @swaptmesh()
ret void
}
void gtk_tree_view_set_expander_column() {}


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

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

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

LLVM IR (-O2):
define void @gtk_tree_view_set_expander_column() {
ret void
}
int _getpid(int a) {
  (void)a;
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @_getpid(i32 %0) {
ret i32 0
}
/* Variables and functions */
float powf(float, double);
float gamma_sRGB_b(float a) {
  return (a <= 0.04045) ? a / 12.92 : powf((a + 0.055) / 1.055, 2.4);
}


x86 assembly (clang, -O0):
<gamma_sRGB_b>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xed2(%rip),%xmm0
ucomisd %xmm1,%xmm0
jb     1157 <gamma_sRGB_b+0x47>
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xed7(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    1192 <gamma_sRGB_b+0x82>
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xeb0(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  0xe9c(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movsd  0xe84(%rip),%xmm1
call   1030 <powf@plt>
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gamma_sRGB_b>:
push   %rax
cvtss2sd %xmm0,%xmm0
movsd  0xee3(%rip),%xmm1
ucomisd %xmm0,%xmm1
jae    114a <gamma_sRGB_b+0x3a>
addsd  0xee5(%rip),%xmm0
divsd  0xee5(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
movsd  0xee1(%rip),%xmm1
call   1030 <powf@plt>
cvtss2sd %xmm0,%xmm0
jmp    1152 <gamma_sRGB_b+0x42>
divsd  0xeb6(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @gamma_sRGB_b(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fpext float %3 to double
%5 = fcmp ole double %4, 4.045000e-02
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load float, float* %2
%8 = fpext float %7 to double
%9 = fdiv double %8, 1.292000e+01
br label %18
10: ; preds = %1
%11 = load float, float* %2
%12 = fpext float %11 to double
%13 = fadd double %12, 5.500000e-02
%14 = fdiv double %13, 1.055000e+00
%15 = fptrunc double %14 to float
%16 = call float @powf(float %15, double 2.400000e+00)
%17 = fpext float %16 to double
br label %18
18: ; preds = %10, %6
%19 = phi double [ %9, %6 ], [ %17, %10 ]
%20 = fptrunc double %19 to float
ret float %20
}

LLVM IR (-O2):
define float @gamma_sRGB_b(float %0) {
%2 = fpext float %0 to double
%3 = fcmp ugt double %2, 4.045000e-02
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = fdiv double %2, 1.292000e+01
br label %12
6: ; preds = %1
%7 = fadd double %2, 5.500000e-02
%8 = fdiv double %7, 1.055000e+00
%9 = fptrunc double %8 to float
%10 = tail call float @powf(float %9, double 2.400000e+00)
%11 = fpext float %10 to double
br label %12
12: ; preds = %6, %4
%13 = phi double [ %5, %4 ], [ %11, %6 ]
%14 = fptrunc double %13 to float
ret float %14
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_attr_t;

/* Variables and functions */
int ENOSYS;
int pthread_attr_setscope(pthread_attr_t *attr, int scope) { return (ENOSYS); }


x86 assembly (clang, -O0):
<pthread_attr_setscope>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    0x2ed6(%rip),%rax
mov    (%rax),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pthread_attr_setscope>:
mov    0x2ee1(%rip),%rax
mov    (%rax),%eax
ret

LLVM IR (-O0):
@ENOSYS = global i32 0
define i32 @pthread_attr_setscope(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%5 = load i32, i32* @ENOSYS
ret i32 %5
}

LLVM IR (-O2):
@ENOSYS = global i32 0
define i32 @pthread_attr_setscope(i32* nocapture readnone %0, i32 %1) {
%3 = load i32, i32* @ENOSYS
ret i32 %3
}
/* Type definitions */
typedef int uint64_t;
struct timespec {
  int tv_sec;
  int tv_nsec;
};

/* Variables and functions */
uint64_t lean_time(struct timespec ts) {
  return (ts.tv_sec * 1000000) + (ts.tv_nsec / 1000);
}


x86 assembly (clang, -O0):
<lean_time>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
imul   $0xf4240,-0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
add    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<lean_time>:
imul   $0xf4240,%edi,%ecx
sar    $0x20,%rdi
imul   $0x10624dd3,%rdi,%rax
mov    %rax,%rdx
shr    $0x3f,%rdx
sar    $0x26,%rax
add    %edx,%eax
add    %ecx,%eax
ret

LLVM IR (-O0):
%struct.timespec = type { i32, i32 }
define i32 @lean_time(i64 %0) {
%2 = alloca %struct.timespec
%3 = bitcast %struct.timespec* %2 to i64*
store i64 %0, i64* %3
%4 = getelementptr inbounds %struct.timespec, %struct.timespec* %2, i32 0, i32 0
%5 = load i32, i32* %4
%6 = mul nsw i32 %5, 1000000
%7 = getelementptr inbounds %struct.timespec, %struct.timespec* %2, i32 0, i32 1
%8 = load i32, i32* %7
%9 = sdiv i32 %8, 1000
%10 = add nsw i32 %6, %9
ret i32 %10
}

LLVM IR (-O2):
define i32 @lean_time(i64 %0) {
%2 = trunc i64 %0 to i32
%3 = lshr i64 %0, 32
%4 = trunc i64 %3 to i32
%5 = mul nsw i32 %2, 1000000
%6 = sdiv i32 %4, 1000
%7 = add nsw i32 %6, %5
ret i32 %7
}
int test_imm_18uint8_mem(unsigned char *val) {
  return ((*val) & (0x18 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_18uint8_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%edx
and    $0x18,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @test_imm_18uint8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, 24
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ getpid();
int kill(int /*<<< orphan*/, int);
int raise(int signo) { return (kill(getpid(), signo)); }


x86 assembly (clang, -O0):
<raise>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,%edi
mov    -0x4(%rbp),%esi
call   1040 <kill@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<raise>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <getpid@plt>
mov    %eax,%edi
mov    %ebx,%esi
pop    %rbx
jmp    1040 <kill@plt>

LLVM IR (-O0):
define i32 @raise(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @getpid()
%4 = load i32, i32* %2
%5 = call i32 @kill(i32 %3, i32 %4)
ret i32 %5
}

LLVM IR (-O2):
define i32 @raise(i32 %0) {
%2 = tail call i32 (...) @getpid()
%3 = tail call i32 @kill(i32 %2, i32 %0)
ret i32 %3
}
void wait_on_sync_kiocb(void) { nsc_assert(0, __func__); }


x86 assembly (clang, -O0):
<wait_on_sync_kiocb>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
lea    0xee3(%rip),%rsi
mov    $0x0,%al
call   1030 <nsc_assert@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<wait_on_sync_kiocb>:
lea    0xee9(%rip),%rsi
xor    %edi,%edi
xor    %eax,%eax
jmp    1030 <nsc_assert@plt>

LLVM IR (-O0):
@__func__.wait_on_sync_kiocb = [19 x i8] c"wait_on_sync_kiocb\00"
define void @wait_on_sync_kiocb() {
%1 = call i32 (i32, i8*, ...) bitcast (i32 (...)* @nsc_assert to i32 (i32, i8*, ...)*)(i32 0, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @__func__.wait_on_sync_kiocb, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@__func__.wait_on_sync_kiocb = [19 x i8] c"wait_on_sync_kiocb\00"
define void @wait_on_sync_kiocb() {
%1 = tail call i32 (i32, i8*, ...) bitcast (i32 (...)* @nsc_assert to i32 (i32, i8*, ...)*)(i32 0, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @__func__.wait_on_sync_kiocb, i64 0, i64 0))
ret void
}
void smc_outl(unsigned long val, unsigned int addr) {
  *((volatile unsigned long *)addr) =
      ((val << 8) & 0xff000000) | ((val >> 8) & 0x00ff0000) |
      ((val << 8) & 0x0000ff00) | ((val >> 8) & 0x000000ff);
}


x86 assembly (clang, -O0):
<smc_outl>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rcx
shl    $0x8,%rcx
movabs $0xff000000,%rax
and    %rax,%rcx
mov    -0x8(%rbp),%rax
shr    $0x8,%rax
and    $0xff0000,%rax
or     %rax,%rcx
mov    -0x8(%rbp),%rax
shl    $0x8,%rax
and    $0xff00,%rax
or     %rax,%rcx
mov    -0x8(%rbp),%rax
shr    $0x8,%rax
and    $0xff,%rax
or     %rax,%rcx
mov    -0xc(%rbp),%eax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<smc_outl>:
mov    %rdi,%rax
shl    $0x8,%rax
movzwl %ax,%ecx
and    $0xff000000,%eax
shr    $0x8,%rdi
movzbl %dil,%edx
and    $0xff0000,%edi
or     %rax,%rdi
or     %rdi,%rcx
or     %rcx,%rdx
mov    %esi,%eax
mov    %rdx,(%rax)
ret

LLVM IR (-O0):
define void @smc_outl(i64 %0, i32 %1) {
%3 = alloca i64
%4 = alloca i32
store i64 %0, i64* %3
store i32 %1, i32* %4
%5 = load i64, i64* %3
%6 = shl i64 %5, 8
%7 = and i64 %6, 4278190080
%8 = load i64, i64* %3
%9 = lshr i64 %8, 8
%10 = and i64 %9, 16711680
%11 = or i64 %7, %10
%12 = load i64, i64* %3
%13 = shl i64 %12, 8
%14 = and i64 %13, 65280
%15 = or i64 %11, %14
%16 = load i64, i64* %3
%17 = lshr i64 %16, 8
%18 = and i64 %17, 255
%19 = or i64 %15, %18
%20 = load i32, i32* %4
%21 = zext i32 %20 to i64
%22 = inttoptr i64 %21 to i64*
store volatile i64 %19, i64* %22
ret void
}

LLVM IR (-O2):
define void @smc_outl(i64 %0, i32 %1) {
%3 = shl i64 %0, 8
%4 = and i64 %3, 4278190080
%5 = lshr i64 %0, 8
%6 = and i64 %5, 16711680
%7 = or i64 %4, %6
%8 = and i64 %3, 65280
%9 = or i64 %7, %8
%10 = and i64 %5, 255
%11 = or i64 %9, %10
%12 = zext i32 %1 to i64
%13 = inttoptr i64 %12 to i64*
store volatile i64 %11, i64* %13
ret void
}
/* Variables and functions */
int /*<<< orphan*/ f4_aux(float *);
float f4(void) {
  float x;
  f4_aux(&x);
  return x;
}


x86 assembly (clang, -O0):
<f4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x4(%rbp),%rdi
call   1030 <f4_aux@plt>
movss  -0x4(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f4>:
push   %rax
lea    0x4(%rsp),%rdi
call   1030 <f4_aux@plt>
movss  0x4(%rsp),%xmm0
pop    %rax
ret

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

LLVM IR (-O2):
define float @f4() {
%1 = alloca float
%2 = bitcast float* %1 to i8*
%3 = call i32 @f4_aux(float* %1)
%4 = load float, float* %1
ret float %4
}
/* Variables and functions */
int /*<<< orphan*/ ccvt_420p(int, int, unsigned char const *, unsigned char *,
                             int);
void ccvt_420p_rgb24(int width, int height, const void *src, void *dst) {
  ccvt_420p(width, height, (const unsigned char *)src, (unsigned char *)dst, 1);
}


x86 assembly (clang, -O0):
<ccvt_420p_rgb24>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    $0x1,%r8d
call   1030 <ccvt_420p@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ccvt_420p_rgb24>:
mov    $0x1,%r8d
jmp    1030 <ccvt_420p@plt>

LLVM IR (-O0):
define void @ccvt_420p_rgb24(i32 %0, i32 %1, i8* %2, i8* %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i8*
store i32 %0, i32* %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%9 = load i32, i32* %5
%10 = load i32, i32* %6
%11 = load i8*, i8** %7
%12 = load i8*, i8** %8
%13 = call i32 @ccvt_420p(i32 %9, i32 %10, i8* %11, i8* %12, i32 1)
ret void
}

LLVM IR (-O2):
define void @ccvt_420p_rgb24(i32 %0, i32 %1, i8* %2, i8* %3) {
%5 = tail call i32 @ccvt_420p(i32 %0, i32 %1, i8* %2, i8* %3, i32 1)
ret void
}
/* Variables and functions */
float max(float, float);
float GeometryNeumann(float NdotL, float NdotV) {
  float d = max(NdotL, NdotV);
  return NdotL * NdotV / d;
}


x86 assembly (clang, -O0):
<GeometryNeumann>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
call   1030 <max@plt>
movss  %xmm0,-0xc(%rbp)
movss  -0x4(%rbp),%xmm0
mulss  -0x8(%rbp),%xmm0
divss  -0xc(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GeometryNeumann>:
push   %rax
movss  %xmm1,(%rsp)
movss  %xmm0,0x4(%rsp)
call   1030 <max@plt>
movss  0x4(%rsp),%xmm1
mulss  (%rsp),%xmm1
divss  %xmm0,%xmm1
movaps %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @GeometryNeumann(float %0, float %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca float
store float %0, float* %3
store float %1, float* %4
%6 = load float, float* %3
%7 = load float, float* %4
%8 = call float @max(float %6, float %7)
store float %8, float* %5
%9 = load float, float* %3
%10 = load float, float* %4
%11 = fmul float %9, %10
%12 = load float, float* %5
%13 = fdiv float %11, %12
ret float %13
}

LLVM IR (-O2):
define float @GeometryNeumann(float %0, float %1) {
%3 = tail call float @max(float %0, float %1)
%4 = fmul float %0, %1
%5 = fdiv float %4, %3
ret float %5
}
int cnst(void) {
  static int x = 1;
  x = (x + 1) & 0xffff;
  return (x);
}


x86 assembly (clang, -O0):
<cnst>:
push   %rbp
mov    %rsp,%rbp
mov    0x2f16(%rip),%eax
add    $0x1,%eax
and    $0xffff,%eax
mov    %eax,0x2f08(%rip)
mov    0x2f02(%rip),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cnst>:
mov    0x2f1a(%rip),%eax
add    $0x1,%eax
movzwl %ax,%eax
mov    %eax,0x2f0e(%rip)
ret

LLVM IR (-O0):
@cnst.x = internal global i32 1
define i32 @cnst() {
%1 = load i32, i32* @cnst.x
%2 = add nsw i32 %1, 1
%3 = and i32 %2, 65535
store i32 %3, i32* @cnst.x
%4 = load i32, i32* @cnst.x
ret i32 %4
}

LLVM IR (-O2):
@cnst.x = internal unnamed_addr global i32 1
define i32 @cnst() {
%1 = load i32, i32* @cnst.x
%2 = add nsw i32 %1, 1
%3 = and i32 %2, 65535
store i32 %3, i32* @cnst.x
ret i32 %3
}
/* Variables and functions */
int printf(char *, double);
int print_float(double f) { return printf("%f", f); }


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

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

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

LLVM IR (-O2):
@.str = [3 x i8] c"%f\00"
define i32 @print_float(double %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), double %0)
ret i32 %2
}
/* Variables and functions */
int sapi_unix_tcp_client_create(char *);
int sapi_open_syslog() {
  char *log_sock = "/dev/log";
  return sapi_unix_tcp_client_create(log_sock);
}


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

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

LLVM IR (-O0):
@.str = [9 x i8] c"/dev/log\00"
define i32 @sapi_open_syslog() {
%1 = alloca i8*
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8** %1
%2 = load i8*, i8** %1
%3 = call i32 @sapi_unix_tcp_client_create(i8* %2)
ret i32 %3
}

LLVM IR (-O2):
@.str = [9 x i8] c"/dev/log\00"
define i32 @sapi_open_syslog() {
%1 = tail call i32 @sapi_unix_tcp_client_create(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
ret i32 %1
}
void null_logger(const char *file, const char *func, int line, int level,
                 const char *fmt, ...) {
  if (file && func && line && level && fmt) {
    return;
  }
  return;
}


x86 assembly (clang, -O0):
<null_logger>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1150 <null_logger+0x50>
cmpq   $0x0,-0x10(%rbp)
je     1150 <null_logger+0x50>
cmpl   $0x0,-0x14(%rbp)
je     1150 <null_logger+0x50>
cmpl   $0x0,-0x18(%rbp)
je     1150 <null_logger+0x50>
cmpq   $0x0,-0x20(%rbp)
je     1150 <null_logger+0x50>
jmp    1155 <null_logger+0x55>
jmp    1155 <null_logger+0x55>
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @null_logger(i8* nocapture %0, i8* nocapture %1, i32 %2, i32 %3, i8* nocapture %4, ...) {
ret void
}
int submat(int nrowb, int row, int col) {
  return (nrowb * (col - 1) + (row - 1));
}


x86 assembly (clang, -O0):
<submat>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
imul   %ecx,%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
add    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<submat>:
add    $0xffffffff,%edx
imul   %edi,%edx
lea    (%rsi,%rdx,1),%eax
add    $0xffffffff,%eax
ret

LLVM IR (-O0):
define i32 @submat(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* %4
%8 = load i32, i32* %6
%9 = sub nsw i32 %8, 1
%10 = mul nsw i32 %7, %9
%11 = load i32, i32* %5
%12 = sub nsw i32 %11, 1
%13 = add nsw i32 %10, %12
ret i32 %13
}

LLVM IR (-O2):
define i32 @submat(i32 %0, i32 %1, i32 %2) {
%4 = add nsw i32 %2, -1
%5 = mul nsw i32 %4, %0
%6 = add nsw i32 %1, -1
%7 = add nsw i32 %6, %5
ret i32 %7
}
/* Type definitions */
typedef int /*<<< orphan*/ buf;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ puts(char *);
int main() {
  FILE *f = fopen("/etc/test.txt", "r");
  char buf[1024];
  fgets(buf, sizeof(buf), f);
  puts(buf);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x410,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeb7(%rip),%rdi
lea    0xebe(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x10(%rbp)
lea    -0x410(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0x400,%esi
call   1040 <fgets@plt>
lea    -0x410(%rbp),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x410,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x400,%rsp
lea    0xec1(%rip),%rdi
lea    0xec8(%rip),%rsi
call   1050 <fopen@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x400,%esi
mov    %rax,%rdx
call   1040 <fgets@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x400,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"/etc/test.txt\00"
@.str.1 = [2 x i8] c"r\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca [1024 x i8]
store i32 0, i32* %1
%4 = call i32* @fopen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %4, i32** %2
%5 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%6 = load i32*, i32** %2
%7 = call i32 @fgets(i8* %5, i32 1024, i32* %6)
%8 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%9 = call i32 @puts(i8* %8)
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"/etc/test.txt\00"
@.str.1 = [2 x i8] c"r\00"
define i32 @main() {
%1 = alloca [1024 x i8]
%2 = tail call i32* @fopen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%3 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%4 = call i32 @fgets(i8* %3, i32 1024, i32* %2)
%5 = call i32 @puts(i8* %3)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;
struct wl_shm {
  int dummy;
};
struct wl_proxy {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ wl_proxy_get_version(struct wl_proxy *);
uint32_t wl_shm_get_version(struct wl_shm *wl_shm) {
  return wl_proxy_get_version((struct wl_proxy *)wl_shm);
}


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

x86 assembly (clang, -O2):
<wl_shm_get_version>:
jmp    1030 <wl_proxy_get_version@plt>

LLVM IR (-O0):
%struct.wl_shm = type { i32 }
%struct.wl_proxy = type { i32 }
define i32 @wl_shm_get_version(%struct.wl_shm* %0) {
%2 = alloca %struct.wl_shm*
store %struct.wl_shm* %0, %struct.wl_shm** %2
%3 = load %struct.wl_shm*, %struct.wl_shm** %2
%4 = bitcast %struct.wl_shm* %3 to %struct.wl_proxy*
%5 = call i32 @wl_proxy_get_version(%struct.wl_proxy* %4)
ret i32 %5
}

LLVM IR (-O2):
%struct.wl_shm = type { i32 }
%struct.wl_proxy = type { i32 }
define i32 @wl_shm_get_version(%struct.wl_shm* %0) {
%2 = bitcast %struct.wl_shm* %0 to %struct.wl_proxy*
%3 = tail call i32 @wl_proxy_get_version(%struct.wl_proxy* %2)
ret i32 %3
}
/* Variables and functions */
int nvram_get_ap_channel_select_mode(int, int *);
int get_channel_select_mode(int radio, int *mode) {
  return nvram_get_ap_channel_select_mode(radio, mode);
}


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

x86 assembly (clang, -O2):
<get_channel_select_mode>:
jmp    1030 <nvram_get_ap_channel_select_mode@plt>

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

LLVM IR (-O2):
define i32 @get_channel_select_mode(i32 %0, i32* %1) {
%3 = tail call i32 @nvram_get_ap_channel_select_mode(i32 %0, i32* %1)
ret i32 %3
}
/* Variables and functions */
float __ocml_tanh_f32(float);
float tanhf(float x) { return __ocml_tanh_f32(x); }


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

x86 assembly (clang, -O2):
<tanhf>:
jmp    1030 <__ocml_tanh_f32@plt>

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

LLVM IR (-O2):
define float @tanhf(float %0) {
%2 = tail call float @__ocml_tanh_f32(float %0)
ret float %2
}
/* Variables and functions */
int /*<<< orphan*/ print(char *);
int /*<<< orphan*/ printid(int);
int main() {
  int c;
  float mm[2] = {11, 2};
  c = mm[1] <= mm[0];
  print("c 1");
  printid(c);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x10(%rbp)
movss  -0xc(%rbp),%xmm1
movss  -0x10(%rbp),%xmm0
ucomiss %xmm1,%xmm0
setae  %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x8(%rbp)
lea    0xeaf(%rip),%rdi
call   1030 <print@plt>
mov    -0x8(%rbp),%edi
call   1040 <printid@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@__const.main.mm = [2 x float] [float 1.100000e+01, float 2.000000e+00]
@.str = [4 x i8] c"c 1\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [2 x float]
store i32 0, i32* %1
%4 = bitcast [2 x float]* %3 to i8*
%5 = getelementptr inbounds [2 x float], [2 x float]* %3, i64 0, i64 1
%6 = load float, float* %5
%7 = getelementptr inbounds [2 x float], [2 x float]* %3, i64 0, i64 0
%8 = load float, float* %7
%9 = fcmp ole float %6, %8
%10 = zext i1 %9 to i32
store i32 %10, i32* %2
%11 = call i32 @print(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%12 = load i32, i32* %2
%13 = call i32 @printid(i32 %12)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"c 1\00"
define i32 @main() {
%1 = tail call i32 @print(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @printid(i32 1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ func0();
main() {
  while (1) {
    func0();
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <func0@plt>
jmp    111f <main+0xf>

x86 assembly (clang, -O2):
<main>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <func0@plt>
jmp    1120 <main+0x10>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
br label %2
2: ; preds = %0, %2
%3 = call i32 (...) @func0()
br label %2
}

LLVM IR (-O2):
define i32 @main() {
br label %1
1: ; preds = %0, %1
%2 = tail call i32 (...) @func0()
br label %1
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char const *, int);
void usage(FILE *file, const char *arg0) {
  fprintf(file,
          "Usage: %s [options] path ...\n"
          "Options:\n"
          "  -h    Print this message\n"
          "  -v    Be verbose\n"
          "  -j N  Operate on N files at a time (default %d)\n"
          "  -e P  Exclude files matching P\n",
          arg0, 4);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xed1(%rip),%rsi
mov    $0x4,%ecx
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
mov    %rsi,%rdx
lea    0xee6(%rip),%rsi
mov    $0x4,%ecx
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@.str = [168 x i8] c"Usage: %s [options] path ...\0AOptions:\0A -h Print this message\0A -v Be verbose\0A -j N Operate on N files at a time (default %d)\0A -e P Exclude files matching P\0A\00"
define void @usage(i32* %0, i8* %1) {
%3 = alloca i32*
%4 = alloca i8*
store i32* %0, i32** %3
store i8* %1, i8** %4
%5 = load i32*, i32** %3
%6 = load i8*, i8** %4
%7 = call i32 @fprintf(i32* %5, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i8* %6, i32 4)
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"Usage: %s [options] path ...\0AOptions:\0A -h Print this message\0A -v Be verbose\0A -j N Operate on N files at a time (default %d)\0A -e P Exclude files matching P\0A\00"
define void @usage(i32* nocapture %0, i8* %1) {
%3 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i8* %1, i32 4)
ret void
}
/* Variables and functions */
double sqrt(double);
double btac1c_ssqrt(double v) { return ((v >= 0) ? sqrt(v) : (-sqrt(-v))); }


x86 assembly (clang, -O0):
<btac1c_ssqrt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1143 <btac1c_ssqrt+0x33>
movsd  -0x8(%rbp),%xmm0
call   1030 <sqrt@plt>
movsd  %xmm0,-0x10(%rbp)
jmp    1180 <btac1c_ssqrt+0x70>
movsd  -0x8(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
call   1030 <sqrt@plt>
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<btac1c_ssqrt>:
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jae    113e <btac1c_ssqrt+0x2e>
push   %rax
movapd 0xedd(%rip),%xmm1
xorpd  %xmm0,%xmm1
movsd  0xee1(%rip),%xmm2
ucomisd %xmm0,%xmm2
jb     1145 <btac1c_ssqrt+0x35>
xorps  %xmm0,%xmm0
sqrtsd %xmm1,%xmm0
jmp    114e <btac1c_ssqrt+0x3e>
jb     115b <btac1c_ssqrt+0x4b>
sqrtsd %xmm0,%xmm0
ret
movapd %xmm1,%xmm0
call   1030 <sqrt@plt>
xorpd  0xeaa(%rip),%xmm0
add    $0x8,%rsp
ret
jmp    1030 <sqrt@plt>

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

LLVM IR (-O2):
define double @btac1c_ssqrt(double %0) {
%2 = fcmp ult double %0, 0.000000e+00
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call double @sqrt(double %0)
br label %9
5: ; preds = %1
%6 = fneg double %0
%7 = tail call double @sqrt(double %6)
%8 = fneg double %7
br label %9
9: ; preds = %5, %3
%10 = phi double [ %4, %3 ], [ %8, %5 ]
ret double %10
}