xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void show_usage() {
  printf("\nUsage: toggle_io -p <port>\n"
         "  -h            Help (this message)\n"
         "  -p <port>     Port; A, B, C, F, H\n\n");
}


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

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

LLVM IR (-O0):
@.str = [102 x i8] c"\0AUsage: toggle_io -p <port>\0A -h Help (this message)\0A -p <port> Port; A, B, C, F, H\0A\0A\00"
define void @show_usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([102 x i8], [102 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [101 x i8] c"\0AUsage: toggle_io -p <port>\0A -h Help (this message)\0A -p <port> Port; A, B, C, F, H\0A\00"
define void @show_usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([101 x i8], [101 x i8]* @str, i64 0, i64 0))
ret void
}
/* Type definitions */
struct timespec {
  int dummy;
};
typedef int /*<<< orphan*/ clockid_t;

/* Variables and functions */
scalar_t__ clock_gettime(int /*<<< orphan*/, struct timespec *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ perror(char *);
void xtime(clockid_t c, struct timespec *tv) {
  if (clock_gettime(c, tv) < 0) {
    perror("clock_gettime");
    exit(1);
  }
}


x86 assembly (clang, -O0):
<xtime>:
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 <clock_gettime@plt>
cmp    $0x0,%rax
jge    116b <xtime+0x3b>
lea    0xea4(%rip),%rdi
call   1040 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xtime>:
push   %rax
call   1030 <clock_gettime@plt>
test   %rax,%rax
js     113d <xtime+0xd>
pop    %rax
ret
lea    0xebc(%rip),%rdi
call   1040 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
%struct.timespec = type { i32 }
@.str = [14 x i8] c"clock_gettime\00"
define void @xtime(i32 %0, %struct.timespec* %1) {
%3 = alloca i32
%4 = alloca %struct.timespec*
store i32 %0, i32* %3
store %struct.timespec* %1, %struct.timespec** %4
%5 = load i32, i32* %3
%6 = load %struct.timespec*, %struct.timespec** %4
%7 = call i64 @clock_gettime(i32 %5, %struct.timespec* %6)
%8 = icmp slt i64 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %2
%10 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @exit(i32 1)
unreachable
12: ; preds = %2
ret void
}

LLVM IR (-O2):
%struct.timespec = type { i32 }
@.str = [14 x i8] c"clock_gettime\00"
define void @xtime(i32 %0, %struct.timespec* %1) {
%3 = tail call i64 @clock_gettime(i32 %0, %struct.timespec* %1)
%4 = icmp slt i64 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %2
%6 = tail call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @exit(i32 1)
unreachable
8: ; preds = %2
ret void
}
/* Variables and functions */
int is_prime(int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int number;
  scanf("%d", &number);
  printf("%d\n", is_prime(number));
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = call i32 @is_prime(i32 %4)
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %5)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void xyz(void) { printf("        main-xyz\n"); }


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

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

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

LLVM IR (-O2):
@str = [17 x i8] c" main-xyz\00"
define void @xyz() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
unsigned int *malloc(unsigned int);
unsigned int rand();
int *create_random_array(unsigned length) {
  unsigned *result = malloc(length * sizeof(int));
  for (unsigned i = 0; i < length; ++i) {
    result[i] = rand();
  }
  return result;
}


x86 assembly (clang, -O0):
<create_random_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x2,%rax
mov    %eax,%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jae    1171 <create_random_array+0x51>
mov    $0x0,%al
call   1040 <rand@plt>
mov    %eax,%edx
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
mov    %edx,(%rax,%rcx,4)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1144 <create_random_array+0x24>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_random_array>:
push   %r15
push   %r14
push   %rbx
mov    %edi,%r14d
lea    0x0(,%r14,4),%edi
call   1030 <malloc@plt>
mov    %rax,%r15
test   %r14d,%r14d
je     1164 <create_random_array+0x44>
mov    %r14d,%r14d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %eax,%eax
call   1040 <rand@plt>
mov    %eax,(%r15,%rbx,4)
add    $0x1,%rbx
cmp    %rbx,%r14
jne    1150 <create_random_array+0x30>
mov    %r15,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32* @create_random_array(i32 %0) {
%2 = alloca i32
%3 = alloca i32*
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = zext i32 %5 to i64
%7 = mul i64 %6, 4
%8 = trunc i64 %7 to i32
%9 = call i32* @malloc(i32 %8)
store i32* %9, i32** %3
store i32 0, i32* %4
br label %10
10: ; preds = %20, %1
%11 = load i32, i32* %4
%12 = load i32, i32* %2
%13 = icmp ult i32 %11, %12
br i1 %13, label %14, label %23
14: ; preds = %10
%15 = call i32 (...) @rand()
%16 = load i32*, i32** %3
%17 = load i32, i32* %4
%18 = zext i32 %17 to i64
%19 = getelementptr inbounds i32, i32* %16, i64 %18
store i32 %15, i32* %19
br label %20
20: ; preds = %14
%21 = load i32, i32* %4
%22 = add i32 %21, 1
store i32 %22, i32* %4
br label %10
23: ; preds = %10
%24 = load i32*, i32** %3
ret i32* %24
}

LLVM IR (-O2):
define noalias i32* @create_random_array(i32 %0) {
%2 = shl i32 %0, 2
%3 = tail call i32* @malloc(i32 %2)
%4 = icmp eq i32 %0, 0
br i1 %4, label %7, label %5
5: ; preds = %1
%6 = zext i32 %0 to i64
br label %8
7: ; preds = %8, %1
ret i32* %3
8: ; preds = %5, %8
%9 = phi i64 [ 0, %5 ], [ %12, %8 ]
%10 = tail call i32 (...) @rand()
%11 = getelementptr inbounds i32, i32* %3, i64 %9
store i32 %10, i32* %11
%12 = add nuw nsw i64 %9, 1
%13 = icmp eq i64 %12, %6
br i1 %13, label %7, label %8
}
int test_imm_2Cuint16_reg(unsigned short val) {
  return ((val) & (0x2C << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_2Cuint16_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%edx
and    $0x2c,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @test_imm_2Cuint16_reg(i16 zeroext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = zext i16 %3 to i32
%5 = and i32 %4, 44
%6 = icmp ne i32 %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_2Cuint16_reg(i16 zeroext %0) {
%2 = and i16 %0, 44
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, char const *);
void usage(const char *argv0, int exit_code) {
  printf("Usage: %s [-h] <file> <key>\n"
         "\n"
         "Options:\n"
         "  -h         display help\n",
         argv0);
  exit(exit_code);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xec6(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rbx
mov    %esi,%ebx
mov    %rdi,%rsi
lea    0xed3(%rip),%rdi
call   1030 <printf@plt>
mov    %ebx,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [65 x i8] c"Usage: %s [-h] <file> <key>\0A\0AOptions:\0A -h display help\0A\00"
define void @usage(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = call i32 @printf(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = load i32, i32* %4
%8 = call i32 @exit(i32 %7)
unreachable
}

LLVM IR (-O2):
@.str = [65 x i8] c"Usage: %s [-h] <file> <key>\0A\0AOptions:\0A -h display help\0A\00"
define void @usage(i8* %0, i32 %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call i32 @exit(i32 %1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ errx(int, char *, ...);
void gerr(const char *s) {
  if (s)
    errx(1, "illegal gfmt1 option -- %s", s);
  else
    errx(1, "illegal gfmt1 option");
}


x86 assembly (clang, -O0):
<gerr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1143 <gerr+0x33>
mov    -0x8(%rbp),%rdx
mov    $0x1,%edi
lea    0xec9(%rip),%rsi
mov    $0x0,%al
call   1030 <errx@plt>
jmp    1156 <gerr+0x46>
mov    $0x1,%edi
lea    0xecc(%rip),%rsi
mov    $0x0,%al
call   1030 <errx@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gerr>:
test   %rdi,%rdi
je     112b <gerr+0x1b>
mov    %rdi,%rdx
lea    0xee1(%rip),%rsi
mov    $0x1,%edi
xor    %eax,%eax
jmp    1030 <errx@plt>
lea    0xee9(%rip),%rsi
mov    $0x1,%edi
xor    %eax,%eax
jmp    1030 <errx@plt>

LLVM IR (-O0):
@.str = [27 x i8] c"illegal gfmt1 option -- %s\00"
@.str.1 = [21 x i8] c"illegal gfmt1 option\00"
define void @gerr(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp ne i8* %3, null
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i8*, i8** %2
%7 = call i32 (i32, i8*, ...) @errx(i32 1, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %6)
br label %10
8: ; preds = %1
%9 = call i32 (i32, i8*, ...) @errx(i32 1, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
br label %10
10: ; preds = %8, %5
ret void
}

LLVM IR (-O2):
@.str = [27 x i8] c"illegal gfmt1 option -- %s\00"
@.str.1 = [21 x i8] c"illegal gfmt1 option\00"
define void @gerr(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 (i32, i8*, ...) @errx(i32 1, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %7
5: ; preds = %1
%6 = tail call i32 (i32, i8*, ...) @errx(i32 1, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
br label %7
7: ; preds = %5, %3
ret void
}
int *f1() {
  int x = 0;
  return &x;
}


x86 assembly (clang, -O0):
<f1>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
lea    -0x4(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f1>:
lea    -0x4(%rsp),%rax
ret

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

LLVM IR (-O2):
define noalias i32* @f1() {
%1 = alloca i32
ret i32* %1
}
int ktapc_fb2int(int x) {
  int e = (x >> 3) & 0x1f;
  if (e == 0)
    return x;
  else
    return ((x & 7) + 8) << (e - 1);
}


x86 assembly (clang, -O0):
<ktapc_fb2int>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
sar    $0x3,%eax
and    $0x1f,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    1128 <ktapc_fb2int+0x28>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    113c <ktapc_fb2int+0x3c>
mov    -0x8(%rbp),%eax
and    $0x7,%eax
add    $0x8,%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
shl    %cl,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ktapc_fb2int>:
mov    %edi,%edx
shr    $0x3,%edx
and    $0x1f,%edx
lea    -0x1(%rdx),%ecx
mov    %edi,%eax
and    $0x7,%eax
or     $0x8,%eax
shl    %cl,%eax
cmp    $0x1,%edx
cmovb  %edi,%eax
ret

LLVM IR (-O0):
define i32 @ktapc_fb2int(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
%5 = load i32, i32* %3
%6 = ashr i32 %5, 3
%7 = and i32 %6, 31
store i32 %7, i32* %4
%8 = load i32, i32* %4
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %1
%11 = load i32, i32* %3
store i32 %11, i32* %2
br label %19
12: ; preds = %1
%13 = load i32, i32* %3
%14 = and i32 %13, 7
%15 = add nsw i32 %14, 8
%16 = load i32, i32* %4
%17 = sub nsw i32 %16, 1
%18 = shl i32 %15, %17
store i32 %18, i32* %2
br label %19
19: ; preds = %12, %10
%20 = load i32, i32* %2
ret i32 %20
}

LLVM IR (-O2):
define i32 @ktapc_fb2int(i32 %0) {
%2 = lshr i32 %0, 3
%3 = and i32 %2, 31
%4 = icmp eq i32 %3, 0
%5 = and i32 %0, 7
%6 = or i32 %5, 8
%7 = add nsw i32 %3, -1
%8 = shl i32 %6, %7
%9 = select i1 %4, i32 %0, i32 %8
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char);
int v(char *p) {
  char *p2 = p;
  while (*++p) {
    printf("%d\n", *p);
  }
  return (p - p2);
}


x86 assembly (clang, -O0):
<v>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
cmpb   $0x0,0x1(%rax)
je     1155 <v+0x45>
mov    -0x8(%rbp),%rax
lea    0xeb8(%rip),%rdi
movsbl (%rax),%esi
call   1030 <printf@plt>
jmp    1124 <v+0x14>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    %rcx,%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<v>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
lea    0x1(%rdi),%rbx
mov    0x1(%rdi),%al
test   %al,%al
je     1147 <v+0x37>
lea    0xed6(%rip),%r15
nopw   0x0(%rax,%rax,1)
movsbl %al,%esi
mov    %r15,%rdi
call   1030 <printf@plt>
movzbl 0x1(%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1130 <v+0x20>
sub    %r14d,%ebx
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
define i32 @v(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 = %10, %1
%6 = load i8*, i8** %2
%7 = getelementptr inbounds i8, i8* %6, i32 1
store i8* %7, i8** %2
%8 = load i8, i8* %7
%9 = icmp ne i8 %8, 0
br i1 %9, label %10, label %14
10: ; preds = %5
%11 = load i8*, i8** %2
%12 = load i8, i8* %11
%13 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 signext %12)
br label %5
14: ; preds = %5
%15 = load i8*, i8** %2
%16 = load i8*, i8** %3
%17 = ptrtoint i8* %15 to i64
%18 = ptrtoint i8* %16 to i64
%19 = sub i64 %17, %18
%20 = trunc i64 %19 to i32
ret i32 %20
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @v(i8* %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 1
%3 = load i8, i8* %2
%4 = icmp eq i8 %3, 0
br i1 %4, label %12, label %5
5: ; preds = %1, %5
%6 = phi i8 [ %10, %5 ], [ %3, %1 ]
%7 = phi i8* [ %9, %5 ], [ %2, %1 ]
%8 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 signext %6)
%9 = getelementptr inbounds i8, i8* %7, i64 1
%10 = load i8, i8* %9
%11 = icmp eq i8 %10, 0
br i1 %11, label %12, label %5
12: ; preds = %5, %1
%13 = phi i8* [ %2, %1 ], [ %9, %5 ]
%14 = ptrtoint i8* %13 to i64
%15 = ptrtoint i8* %0 to i64
%16 = sub i64 %14, %15
%17 = trunc i64 %16 to i32
ret i32 %17
}
int ascii_tolower(int c) {
  if ('A' <= c && c <= 'Z')
    return c | 32;
  return c;
}


x86 assembly (clang, -O0):
<ascii_tolower>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    $0x41,%eax
cmp    -0x8(%rbp),%eax
jg     112d <ascii_tolower+0x2d>
cmpl   $0x5a,-0x8(%rbp)
jg     112d <ascii_tolower+0x2d>
mov    -0x8(%rbp),%eax
or     $0x20,%eax
mov    %eax,-0x4(%rbp)
jmp    1133 <ascii_tolower+0x33>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ascii_tolower>:
lea    -0x41(%rdi),%ecx
mov    %edi,%eax
or     $0x20,%eax
cmp    $0x1a,%ecx
cmovae %edi,%eax
ret

LLVM IR (-O0):
define i32 @ascii_tolower(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp sle i32 65, %4
br i1 %5, label %6, label %12
6: ; preds = %1
%7 = load i32, i32* %3
%8 = icmp sle i32 %7, 90
br i1 %8, label %9, label %12
9: ; preds = %6
%10 = load i32, i32* %3
%11 = or i32 %10, 32
store i32 %11, i32* %2
br label %14
12: ; preds = %6, %1
%13 = load i32, i32* %3
store i32 %13, i32* %2
br label %14
14: ; preds = %12, %9
%15 = load i32, i32* %2
ret i32 %15
}

LLVM IR (-O2):
define i32 @ascii_tolower(i32 %0) {
%2 = add i32 %0, -65
%3 = icmp ult i32 %2, 26
%4 = or i32 %0, 32
%5 = select i1 %3, i32 %4, i32 %0
ret i32 %5
}
void swap(int *x, int i, int j) {
  int t;
  t = x[i];
  x[i] = x[j];
  x[j] = t;
  return;
}


x86 assembly (clang, -O0):
<swap>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x14(%rbp),%edx
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
pop    %rbp
ret

x86 assembly (clang, -O2):
<swap>:
movslq %esi,%rax
mov    (%rdi,%rax,4),%ecx
movslq %edx,%rdx
mov    (%rdi,%rdx,4),%esi
mov    %esi,(%rdi,%rax,4)
mov    %ecx,(%rdi,%rdx,4)
ret

LLVM IR (-O0):
define void @swap(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32*, i32** %4
%9 = load i32, i32* %5
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i32, i32* %8, i64 %10
%12 = load i32, i32* %11
store i32 %12, i32* %7
%13 = load i32*, i32** %4
%14 = load i32, i32* %6
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i32, i32* %13, i64 %15
%17 = load i32, i32* %16
%18 = load i32*, i32** %4
%19 = load i32, i32* %5
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i32, i32* %18, i64 %20
store i32 %17, i32* %21
%22 = load i32, i32* %7
%23 = load i32*, i32** %4
%24 = load i32, i32* %6
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i32, i32* %23, i64 %25
store i32 %22, i32* %26
ret void
}

LLVM IR (-O2):
define void @swap(i32* nocapture %0, i32 %1, i32 %2) {
%4 = sext i32 %1 to i64
%5 = getelementptr inbounds i32, i32* %0, i64 %4
%6 = load i32, i32* %5
%7 = sext i32 %2 to i64
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = load i32, i32* %8
store i32 %9, i32* %5
store i32 %6, i32* %8
ret void
}
int cur_close() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @cur_close() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printk(char *);
int fclose(void **f) {
  printk("Write fclose()\n");
  return 0;
}


x86 assembly (clang, -O0):
<fclose>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xedd(%rip),%rdi
call   1030 <printk@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [16 x i8] c"Write fclose()\0A\00"
define i32 @fclose(i8** %0) {
%2 = alloca i8**
store i8** %0, i8*** %2
%3 = call i32 @printk(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [16 x i8] c"Write fclose()\0A\00"
define i32 @fclose(i8** nocapture readnone %0) {
%2 = tail call i32 @printk(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
int test_imm_2Eint64_highword_reg(long long val) {
  return ((val >> 32) & (0x2E << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_2Eint64_highword_reg(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = ashr i64 %3, 32
%5 = and i64 %4, 46
%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_2Eint64_highword_reg(i64 %0) {
%2 = and i64 %0, 197568495616
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
int do_940() { return 940; }


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

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

LLVM IR (-O0):
define i32 @do_940() {
ret i32 940
}

LLVM IR (-O2):
define i32 @do_940() {
ret i32 940
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
int uiplib_ipaddrconv(char const *, int, int /*<<< orphan*/ *);
void contextconv(const char *parameter, const char *addrstr, uint8_t *ipaddr) {
  int result = uiplib_ipaddrconv(addrstr, 8, ipaddr);
  if (result == 0) {
    fprintf(stderr, "Error: %s: invalid argument\n", parameter);
    exit(1);
  }
}


x86 assembly (clang, -O0):
<contextconv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x8,%esi
call   1030 <uiplib_ipaddrconv@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jne    1186 <contextconv+0x56>
mov    0x2e76(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xe89(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<contextconv>:
push   %rbx
mov    %rdi,%rbx
mov    %rsi,%rdi
mov    $0x8,%esi
call   1030 <uiplib_ipaddrconv@plt>
test   %eax,%eax
je     1147 <contextconv+0x17>
pop    %rbx
ret
mov    0x2e92(%rip),%rax
mov    (%rax),%edi
lea    0xea9(%rip),%rsi
mov    %rbx,%rdx
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [29 x i8] c"Error: %s: invalid argument\0A\00"
define void @contextconv(i8* %0, i8* %1, i32* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32*
%7 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32* %2, i32** %6
%8 = load i8*, i8** %5
%9 = load i32*, i32** %6
%10 = call i32 @uiplib_ipaddrconv(i8* %8, i32 8, i32* %9)
store i32 %10, i32* %7
%11 = load i32, i32* %7
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %18
13: ; preds = %3
%14 = load i32, i32* @stderr
%15 = load i8*, i8** %4
%16 = call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %15)
%17 = call i32 @exit(i32 1)
unreachable
18: ; preds = %3
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [29 x i8] c"Error: %s: invalid argument\0A\00"
define void @contextconv(i8* %0, i8* %1, i32* %2) {
%4 = tail call i32 @uiplib_ipaddrconv(i8* %1, i32 8, i32* %2)
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %10
6: ; preds = %3
%7 = load i32, i32* @stderr
%8 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %0)
%9 = tail call i32 @exit(i32 1)
unreachable
10: ; preds = %3
ret void
}
void lgtd_proto_target_list_clear(struct lgtd_proto_target_list *targets) {
  (void)targets;
}


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

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

LLVM IR (-O0):
%struct.lgtd_proto_target_list = type opaque
define void @lgtd_proto_target_list_clear(%struct.lgtd_proto_target_list* %0) {
%2 = alloca %struct.lgtd_proto_target_list*
store %struct.lgtd_proto_target_list* %0, %struct.lgtd_proto_target_list** %2
%3 = load %struct.lgtd_proto_target_list*, %struct.lgtd_proto_target_list** %2
ret void
}

LLVM IR (-O2):
%struct.lgtd_proto_target_list = type opaque
define void @lgtd_proto_target_list_clear(%struct.lgtd_proto_target_list* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ GPSExtendedStatusHandle();
int /*<<< orphan*/ UAVObjRequestUpdate(int /*<<< orphan*/);
void GPSExtendedStatusRequestUpdate() {
  UAVObjRequestUpdate(GPSExtendedStatusHandle());
}


x86 assembly (clang, -O0):
<GPSExtendedStatusRequestUpdate>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <GPSExtendedStatusHandle@plt>
mov    %eax,%edi
call   1030 <UAVObjRequestUpdate@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<GPSExtendedStatusRequestUpdate>:
push   %rax
xor    %eax,%eax
call   1040 <GPSExtendedStatusHandle@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <UAVObjRequestUpdate@plt>

LLVM IR (-O0):
define void @GPSExtendedStatusRequestUpdate() {
%1 = call i32 (...) @GPSExtendedStatusHandle()
%2 = call i32 @UAVObjRequestUpdate(i32 %1)
ret void
}

LLVM IR (-O2):
define void @GPSExtendedStatusRequestUpdate() {
%1 = tail call i32 (...) @GPSExtendedStatusHandle()
%2 = tail call i32 @UAVObjRequestUpdate(i32 %1)
ret void
}
/* Variables and functions */
unsigned int channelReceiveWord(unsigned int);
unsigned int nOS_getEventID();
void fooEventHandler() {
  unsigned theEventChannel;
  unsigned someData;
  theEventChannel = nOS_getEventID();
  someData = channelReceiveWord(theEventChannel);
}


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

x86 assembly (clang, -O2):
<fooEventHandler>:
push   %rax
xor    %eax,%eax
call   1030 <nOS_getEventID@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <channelReceiveWord@plt>

LLVM IR (-O0):
define void @fooEventHandler() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 (...) @nOS_getEventID()
store i32 %3, i32* %1
%4 = load i32, i32* %1
%5 = call i32 @channelReceiveWord(i32 %4)
store i32 %5, i32* %2
ret void
}

LLVM IR (-O2):
define void @fooEventHandler() {
%1 = tail call i32 (...) @nOS_getEventID()
%2 = tail call i32 @channelReceiveWord(i32 %1)
ret void
}
int is_alnum(int c) {
  return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'z') ||
         (c >= 'A' && c <= 'Z');
}


x86 assembly (clang, -O0):
<is_alnum>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x30,-0x4(%rbp)
jl     1120 <is_alnum+0x20>
mov    $0x1,%al
cmpl   $0x39,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jle    1158 <is_alnum+0x58>
cmpl   $0x61,-0x4(%rbp)
jl     1139 <is_alnum+0x39>
mov    $0x1,%al
cmpl   $0x7a,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jle    1158 <is_alnum+0x58>
xor    %eax,%eax
cmpl   $0x41,-0x4(%rbp)
mov    %al,-0x6(%rbp)
jl     1152 <is_alnum+0x52>
cmpl   $0x5a,-0x4(%rbp)
setle  %al
mov    %al,-0x6(%rbp)
mov    -0x6(%rbp),%al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_alnum>:
lea    -0x30(%rdi),%eax
cmp    $0xa,%eax
setb   %al
and    $0xffffffdf,%edi
add    $0xffffffbf,%edi
cmp    $0x1a,%edi
setb   %cl
or     %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i32 @is_alnum(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sge i32 %3, 48
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp sle i32 %6, 57
br i1 %7, label %22, label %8
8: ; preds = %5, %1
%9 = load i32, i32* %2
%10 = icmp sge i32 %9, 97
br i1 %10, label %11, label %14
11: ; preds = %8
%12 = load i32, i32* %2
%13 = icmp sle i32 %12, 122
br i1 %13, label %22, label %14
14: ; preds = %11, %8
%15 = load i32, i32* %2
%16 = icmp sge i32 %15, 65
br i1 %16, label %17, label %20
17: ; preds = %14
%18 = load i32, i32* %2
%19 = icmp sle i32 %18, 90
br label %20
20: ; preds = %17, %14
%21 = phi i1 [ false, %14 ], [ %19, %17 ]
br label %22
22: ; preds = %20, %11, %5
%23 = phi i1 [ true, %11 ], [ true, %5 ], [ %21, %20 ]
%24 = zext i1 %23 to i32
ret i32 %24
}

LLVM IR (-O2):
define i32 @is_alnum(i32 %0) {
%2 = add i32 %0, -48
%3 = icmp ult i32 %2, 10
%4 = and i32 %0, -33
%5 = add i32 %4, -65
%6 = icmp ult i32 %5, 26
%7 = or i1 %3, %6
%8 = zext i1 %7 to i32
ret i32 %8
}
int nfp_net_tls_init(struct nfp_net *nn) { return 0; }


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

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

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

LLVM IR (-O2):
%struct.nfp_net = type opaque
define i32 @nfp_net_tls_init(%struct.nfp_net* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
unsigned int __gmpf_get_default_prec();
unsigned int get_default_prec_mpf() { return __gmpf_get_default_prec(); }


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

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

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

LLVM IR (-O2):
define i32 @get_default_prec_mpf() {
%1 = tail call i32 (...) @__gmpf_get_default_prec()
ret i32 %1
}
int main() {
  int x;
  x = 0;
  while (x >= 0) {
    x = x - 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     112a <main+0x2a>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1112 <main+0x12>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
xor    %eax,%eax
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 = %6, %0
%4 = load i32, i32* %2
%5 = icmp sge i32 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %3
%7 = load i32, i32* %2
%8 = sub nsw i32 %7, 1
store i32 %8, i32* %2
br label %3
9: ; preds = %3
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
int c(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @c() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ CompileMark(int, int);
void DoWhile(void) { CompileMark(28, 4); }


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

x86 assembly (clang, -O2):
<DoWhile>:
mov    $0x1c,%edi
mov    $0x4,%esi
jmp    1030 <CompileMark@plt>

LLVM IR (-O0):
define void @DoWhile() {
%1 = call i32 @CompileMark(i32 28, i32 4)
ret void
}

LLVM IR (-O2):
define void @DoWhile() {
%1 = tail call i32 @CompileMark(i32 28, i32 4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
void example_description() {
  puts("LibCGI Examples - cgi_redirect() function <br>"
       "This example show how to use cgi_redirect() to transfer <br>"
       "the actual page to an another<br><br>");
}


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

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

LLVM IR (-O0):
@.str = [144 x i8] c"LibCGI Examples - cgi_redirect() function <br>This example show how to use cgi_redirect() to transfer <br>the actual page to an another<br><br>\00"
define void @example_description() {
%1 = call i32 @puts(i8* getelementptr inbounds ([144 x i8], [144 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [144 x i8] c"LibCGI Examples - cgi_redirect() function <br>This example show how to use cgi_redirect() to transfer <br>the actual page to an another<br><br>\00"
define void @example_description() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([144 x i8], [144 x i8]* @.str, i64 0, i64 0))
ret void
}
double cpd2cp(double q) {
  double cpd = 1004.67;
  double cp;
  cp = cpd * (1.0 + 0.84 * q);
  return (cp);
}


x86 assembly (clang, -O0):
<cpd2cp>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  0xeff(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
movsd  0xed8(%rip),%xmm2
mulsd  %xmm2,%xmm1
movsd  0xed4(%rip),%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<cpd2cp>:
mulsd  0xef8(%rip),%xmm0
addsd  0xef8(%rip),%xmm0
mulsd  0xef8(%rip),%xmm0
ret

LLVM IR (-O0):
define double @cpd2cp(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
store double %0, double* %2
store double 1.004670e+03, double* %3
%5 = load double, double* %3
%6 = load double, double* %2
%7 = call double @llvm.fmuladd.f64(double 8.400000e-01, double %6, double 1.000000e+00)
%8 = fmul double %5, %7
store double %8, double* %4
%9 = load double, double* %4
ret double %9
}

LLVM IR (-O2):
define double @cpd2cp(double %0) {
%2 = tail call double @llvm.fmuladd.f64(double %0, double 8.400000e-01, double 1.000000e+00)
%3 = fmul double %2, 1.004670e+03
ret double %3
}
int _stl_predicate(char *path) { return 1; }


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

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

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

LLVM IR (-O2):
define i32 @_stl_predicate(i8* nocapture readnone %0) {
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  printf("%lld\n", (int)(7));
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [6 x i8] c"%lld\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 7)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ multiple_by_2(double *);
int /*<<< orphan*/ printf(char *, double);
int main() {
  double x = 1579.0 / 367.0;
  printf("Value: %.3lf\n", x);
  multiple_by_2(&x);
  printf("Value: %.3lf\n", x);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movabs $0x401135b60f5896ac,%rax
35 11 40
mov    %rax,0x8(%rsp)
lea    0xecd(%rip),%rbx
movsd  0xebd(%rip),%xmm0
mov    %rbx,%rdi
call   1030 <printf@plt>
lea    0x8(%rsp),%rdi
call   1040 <multiple_by_2@plt>
movsd  0x8(%rsp),%xmm0
mov    %rbx,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [14 x i8] c"Value: %.3lf\0A\00"
define i32 @main() {
%1 = alloca double
%2 = bitcast double* %1 to i8*
store double 0x401135B60F5896AC, double* %1
%3 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), double 0x401135B60F5896AC)
%4 = call i32 @multiple_by_2(double* %1)
%5 = load double, double* %1
%6 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), double %5)
ret i32 0
}
void event_acciaccatura() { return; }


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

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

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

LLVM IR (-O2):
define void @event_acciaccatura() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void usage() { printf("usage: ds6cut <filename> <prefix>\n"); }


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

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

LLVM IR (-O0):
@.str = [35 x i8] c"usage: ds6cut <filename> <prefix>\0A\00"
define void @usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [34 x i8] c"usage: ds6cut <filename> <prefix>\00"
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void shm_error(char *error) { printf("\n    ERROR: %s", error); }


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

x86 assembly (clang, -O2):
<shm_error>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [15 x i8] c"\0A ERROR: %s\00"
define void @shm_error(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
void closeAnalogSPI(int fd) {
  close(fd);
  return;
}


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

x86 assembly (clang, -O2):
<closeAnalogSPI>:
jmp    1030 <close@plt>

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

LLVM IR (-O2):
define void @closeAnalogSPI(i32 %0) {
%2 = tail call i32 @close(i32 %0)
ret void
}
int ptn3460_init(struct drm_device *dev, struct i2c_client *client,
                 struct device_node *node) {
  return 0;
}


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

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

LLVM IR (-O0):
%struct.drm_device = type opaque
%struct.i2c_client = type opaque
%struct.device_node = type opaque
define i32 @ptn3460_init(%struct.drm_device* %0, %struct.i2c_client* %1, %struct.device_node* %2) {
%4 = alloca %struct.drm_device*
%5 = alloca %struct.i2c_client*
%6 = alloca %struct.device_node*
store %struct.drm_device* %0, %struct.drm_device** %4
store %struct.i2c_client* %1, %struct.i2c_client** %5
store %struct.device_node* %2, %struct.device_node** %6
ret i32 0
}

LLVM IR (-O2):
%struct.drm_device = type opaque
%struct.i2c_client = type opaque
%struct.device_node = type opaque
define i32 @ptn3460_init(%struct.drm_device* nocapture readnone %0, %struct.i2c_client* nocapture readnone %1, %struct.device_node* nocapture readnone %2) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ pcibios_write_config_byte(int /*<<< orphan*/, scalar_t__,
                                             int, int);
void set_pmcr(void) {
  pcibios_write_config_byte(0, ((0x00 << 3) + 0), 0x7a, 0x90);
}


x86 assembly (clang, -O0):
<set_pmcr>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x7a,%edx
mov    $0x90,%ecx
call   1030 <pcibios_write_config_byte@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_pmcr>:
xor    %edi,%edi
xor    %esi,%esi
mov    $0x7a,%edx
mov    $0x90,%ecx
jmp    1030 <pcibios_write_config_byte@plt>

LLVM IR (-O0):
define void @set_pmcr() {
%1 = call i32 @pcibios_write_config_byte(i32 0, i64 0, i32 122, i32 144)
ret void
}

LLVM IR (-O2):
define void @set_pmcr() {
%1 = tail call i32 @pcibios_write_config_byte(i32 0, i64 0, i32 122, i32 144)
ret void
}
void cprop_result12(int *data) {
  int j = data[0];
  if (j == 5)
    j = 110;
  data[1] = j;
}


x86 assembly (clang, -O0):
<cprop_result12>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x5,-0xc(%rbp)
jne    1122 <cprop_result12+0x22>
movl   $0x6e,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x4(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<cprop_result12>:
mov    (%rdi),%eax
cmp    $0x5,%eax
mov    $0x6e,%ecx
cmovne %eax,%ecx
mov    %ecx,0x4(%rdi)
ret

LLVM IR (-O0):
define void @cprop_result12(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
%4 = load i32*, i32** %2
%5 = getelementptr inbounds i32, i32* %4, i64 0
%6 = load i32, i32* %5
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = icmp eq i32 %7, 5
br i1 %8, label %9, label %10
9: ; preds = %1
store i32 110, i32* %3
br label %10
10: ; preds = %9, %1
%11 = load i32, i32* %3
%12 = load i32*, i32** %2
%13 = getelementptr inbounds i32, i32* %12, i64 1
store i32 %11, i32* %13
ret void
}

LLVM IR (-O2):
define void @cprop_result12(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = icmp eq i32 %2, 5
%4 = select i1 %3, i32 110, i32 %2
%5 = getelementptr inbounds i32, i32* %0, i64 1
store i32 %4, i32* %5
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, char *);
void easy(int linenum, char *svalue) {
  printf("Line %d Token: %s\n", linenum, svalue);
}


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

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

LLVM IR (-O0):
@.str = [19 x i8] c"Line %d Token: %s\0A\00"
define void @easy(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 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %5, i8* %6)
ret void
}

LLVM IR (-O2):
@.str = [19 x i8] c"Line %d Token: %s\0A\00"
define void @easy(i32 %0, i8* %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %0, i8* %1)
ret void
}
int cube(x) { return (x * x * x); }


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

x86 assembly (clang, -O2):
<cube>:
mov    %edi,%eax
imul   %edi,%eax
imul   %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @cube(i32 %0) {
%2 = mul nsw i32 %0, %0
%3 = mul nsw i32 %2, %0
ret i32 %3
}