xunge/DecIR huggingface dataset:
int tzero(int a) {
  int cnt_fives = 0;
  int i;
  for (i = 5; i <= a; i *= 5) {
    cnt_fives += (a / i);
  }
  return cnt_fives;
}


x86 assembly (clang, -O0):
<tzero>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x5,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     113a <tzero+0x3a>
mov    -0x4(%rbp),%eax
cltd
idivl  -0xc(%rbp)
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
imul   $0x5,-0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1115 <tzero+0x15>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<tzero>:
xor    %ecx,%ecx
cmp    $0x5,%edi
jl     111e <tzero+0x1e>
xor    %ecx,%ecx
mov    $0x5,%esi
xchg   %ax,%ax
mov    %edi,%eax
cltd
idiv   %esi
add    %eax,%ecx
lea    (%rsi,%rsi,4),%esi
cmp    %edi,%esi
jle    1110 <tzero+0x10>
mov    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @tzero(i32 %0) {
%2 = icmp slt i32 %0, 5
br i1 %2, label %10, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %8, %3 ], [ 5, %1 ]
%5 = phi i32 [ %7, %3 ], [ 0, %1 ]
%6 = sdiv i32 %0, %4
%7 = add nsw i32 %6, %5
%8 = mul nsw i32 %4, 5
%9 = icmp sgt i32 %8, %0
br i1 %9, label %10, label %3
10: ; preds = %3, %1
%11 = phi i32 [ 0, %1 ], [ %7, %3 ]
ret i32 %11
}
/* Variables and functions */
float *Diff_f(float *, float *, float *, int);
float Norm_f(float *, int, unsigned char);
float NormDiff_f(float *x, float *y, float *tmp, int n, unsigned char norm) {
  float nrm, *z;
  int i;
  z = tmp;
  nrm = 0.0;
  z = Diff_f(x, y, z, n);
  nrm = Norm_f(z, n, norm);
  return nrm;
}


x86 assembly (clang, -O0):
<NormDiff_f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %r8b,%al
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %al,-0x1d(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x30(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x24(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x30(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
call   1030 <Diff_f@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x1c(%rbp),%esi
movzbl -0x1d(%rbp),%edx
call   1040 <Norm_f@plt>
movss  %xmm0,-0x24(%rbp)
movss  -0x24(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<NormDiff_f>:
push   %rbp
push   %rbx
push   %rax
mov    %r8d,%ebx
mov    %ecx,%ebp
call   1030 <Diff_f@plt>
mov    %rax,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <Norm_f@plt>

LLVM IR (-O0):
define float @NormDiff_f(float* %0, float* %1, float* %2, i32 %3, i8 zeroext %4) {
%6 = alloca float*
%7 = alloca float*
%8 = alloca float*
%9 = alloca i32
%10 = alloca i8
%11 = alloca float
%12 = alloca float*
%13 = alloca i32
store float* %0, float** %6
store float* %1, float** %7
store float* %2, float** %8
store i32 %3, i32* %9
store i8 %4, i8* %10
%14 = load float*, float** %8
store float* %14, float** %12
store float 0.000000e+00, float* %11
%15 = load float*, float** %6
%16 = load float*, float** %7
%17 = load float*, float** %12
%18 = load i32, i32* %9
%19 = call float* @Diff_f(float* %15, float* %16, float* %17, i32 %18)
store float* %19, float** %12
%20 = load float*, float** %12
%21 = load i32, i32* %9
%22 = load i8, i8* %10
%23 = call float @Norm_f(float* %20, i32 %21, i8 zeroext %22)
store float %23, float* %11
%24 = load float, float* %11
ret float %24
}

LLVM IR (-O2):
define float @NormDiff_f(float* %0, float* %1, float* %2, i32 %3, i8 zeroext %4) {
%6 = tail call float* @Diff_f(float* %0, float* %1, float* %2, i32 %3)
%7 = tail call float @Norm_f(float* %6, i32 %3, i8 zeroext %4)
ret float %7
}
/* Variables and functions */
char getchar();
int /*<<< orphan*/ printf(char *, ...);
int main(void) {
  int len = 0;
  printf("Enter a message: ");
  while (getchar() != '\n')
    len++;
  printf("Your message is %d character(s) long.\n", len);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
movsbl %al,%eax
cmp    $0xa,%eax
je     1165 <main+0x45>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1144 <main+0x24>
mov    -0x8(%rbp),%esi
lea    0xea3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xed8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0xffffffff,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %eax,%eax
call   1040 <getchar@plt>
add    $0x1,%ebx
cmp    $0xa,%al
jne    1140 <main+0x20>
lea    0xebd(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [18 x i8] c"Enter a message: \00"
@.str.1 = [39 x i8] c"Your message is %d character(s) long.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
br label %4
4: ; preds = %8, %0
%5 = call signext i8 (...) @getchar()
%6 = sext i8 %5 to i32
%7 = icmp ne i32 %6, 10
br i1 %7, label %8, label %11
8: ; preds = %4
%9 = load i32, i32* %2
%10 = add nsw i32 %9, 1
store i32 %10, i32* %2
br label %4
11: ; preds = %4
%12 = load i32, i32* %2
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), i32 %12)
ret i32 0
}

LLVM IR (-O2):
@.str = [18 x i8] c"Enter a message: \00"
@.str.1 = [39 x i8] c"Your message is %d character(s) long.\0A\00"
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
br label %2
2: ; preds = %2, %0
%3 = phi i32 [ 0, %0 ], [ %6, %2 ]
%4 = tail call signext i8 (...) @getchar()
%5 = icmp eq i8 %4, 10
%6 = add nuw nsw i32 %3, 1
br i1 %5, label %7, label %2
7: ; preds = %2
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), i32 %3)
ret i32 0
}
int main(void) {
  int a[100];
#pragma omp parallel for
  for (int i = 0; i < 100; i++) {
    a[i] = 2 * i;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x130,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x1a4(%rbp)
cmpl   $0x64,-0x1a4(%rbp)
jge    1154 <main+0x54>
mov    -0x1a4(%rbp),%ecx
shl    $0x1,%ecx
movslq -0x1a4(%rbp),%rax
mov    %ecx,-0x1a0(%rbp,%rax,4)
mov    -0x1a4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1a4(%rbp)
jmp    111c <main+0x1c>
xor    %eax,%eax
add    $0x130,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Type definitions */
struct siphash {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ siphash24_compress(void const *, scalar_t__,
                                      struct siphash *);
scalar_t__ strlen(void const *);
void string_hash_func(const void *p, struct siphash *state) {
  siphash24_compress(p, strlen(p) + 1, state);
}


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

x86 assembly (clang, -O2):
<string_hash_func>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1040 <strlen@plt>
lea    0x1(%rax),%rsi
mov    %rbx,%rdi
mov    %r14,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <siphash24_compress@plt>

LLVM IR (-O0):
%struct.siphash = type { i32 }
define void @string_hash_func(i8* %0, %struct.siphash* %1) {
%3 = alloca i8*
%4 = alloca %struct.siphash*
store i8* %0, i8** %3
store %struct.siphash* %1, %struct.siphash** %4
%5 = load i8*, i8** %3
%6 = load i8*, i8** %3
%7 = call i64 @strlen(i8* %6)
%8 = add nsw i64 %7, 1
%9 = load %struct.siphash*, %struct.siphash** %4
%10 = call i32 @siphash24_compress(i8* %5, i64 %8, %struct.siphash* %9)
ret void
}

LLVM IR (-O2):
%struct.siphash = type { i32 }
define void @string_hash_func(i8* %0, %struct.siphash* %1) {
%3 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%4 = add nsw i64 %3, 1
%5 = tail call i32 @siphash24_compress(i8* %0, i64 %4, %struct.siphash* %1)
ret void
}
unsigned short ConvertPID(unsigned char c) {
  if (c >= 127 || c < '0')
    return '0';
  return c;
}


x86 assembly (clang, -O0):
<ConvertPID>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x3(%rbp)
movzbl -0x3(%rbp),%eax
cmp    $0x7f,%eax
jge    1124 <ConvertPID+0x24>
movzbl -0x3(%rbp),%eax
cmp    $0x30,%eax
jge    112f <ConvertPID+0x2f>
movw   $0x30,-0x2(%rbp)
jmp    1137 <ConvertPID+0x37>
movzbl -0x3(%rbp),%eax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ConvertPID>:
lea    -0x7f(%rdi),%eax
cmp    $0xb1,%al
mov    $0x30,%eax
cmovae %edi,%eax
ret

LLVM IR (-O0):
define zeroext i16 @ConvertPID(i8 zeroext %0) {
%2 = alloca i16
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = zext i8 %4 to i32
%6 = icmp sge i32 %5, 127
br i1 %6, label %11, label %7
7: ; preds = %1
%8 = load i8, i8* %3
%9 = zext i8 %8 to i32
%10 = icmp slt i32 %9, 48
br i1 %10, label %11, label %12
11: ; preds = %7, %1
store i16 48, i16* %2
br label %15
12: ; preds = %7
%13 = load i8, i8* %3
%14 = zext i8 %13 to i16
store i16 %14, i16* %2
br label %15
15: ; preds = %12, %11
%16 = load i16, i16* %2
ret i16 %16
}

LLVM IR (-O2):
define zeroext i16 @ConvertPID(i8 zeroext %0) {
%2 = add i8 %0, -127
%3 = icmp ult i8 %2, -79
%4 = select i1 %3, i8 48, i8 %0
%5 = zext i8 %4 to i16
ret i16 %5
}
void pinmux_free_gpio(struct pinctrl_dev *pctldev, unsigned pin,
                      struct pinctrl_gpio_range *range) {}


x86 assembly (clang, -O0):
<pinmux_free_gpio>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.pinctrl_dev = type opaque
%struct.pinctrl_gpio_range = type opaque
define void @pinmux_free_gpio(%struct.pinctrl_dev* %0, i32 %1, %struct.pinctrl_gpio_range* %2) {
%4 = alloca %struct.pinctrl_dev*
%5 = alloca i32
%6 = alloca %struct.pinctrl_gpio_range*
store %struct.pinctrl_dev* %0, %struct.pinctrl_dev** %4
store i32 %1, i32* %5
store %struct.pinctrl_gpio_range* %2, %struct.pinctrl_gpio_range** %6
ret void
}

LLVM IR (-O2):
%struct.pinctrl_dev = type opaque
%struct.pinctrl_gpio_range = type opaque
define void @pinmux_free_gpio(%struct.pinctrl_dev* nocapture %0, i32 %1, %struct.pinctrl_gpio_range* nocapture %2) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *, char *);
char *strtok(char *, char *);
void test(char *name) {
  char *strtok_result;
  strtok_result = strtok(name, " ");
  printf("strtok(\"%s\", \" \") == \"%s\"\n", name, strtok_result);
  return;
}


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

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

LLVM IR (-O0):
@.str = [2 x i8] c" \00"
@.str.1 = [27 x i8] c"strtok(\22%s\22, \22 \22) == \22%s\22\0A\00"
define void @test(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i8* @strtok(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* %5, i8** %3
%6 = load i8*, i8** %2
%7 = load i8*, i8** %3
%8 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8* %6, i8* %7)
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c" \00"
@.str.1 = [27 x i8] c"strtok(\22%s\22, \22 \22) == \22%s\22\0A\00"
define void @test(i8* %0) {
%2 = tail call i8* @strtok(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8* %0, i8* %2)
ret void
}
int test_imm_84int16_reg(short val) {
  return ((val) & (-0x84 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_84int16_reg(i16 signext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = sext i16 %3 to i32
%5 = and i32 %4, -132
%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_84int16_reg(i16 signext %0) {
%2 = and i16 %0, -132
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
void handle(int signal) {
  printf("SIGINT signal received!\n");
  exit(EXIT_SUCCESS);
}


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

x86 assembly (clang, -O2):
<handle>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
mov    0x2eac(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [25 x i8] c"SIGINT signal received!\0A\00"
@EXIT_SUCCESS = global i32 0
define void @handle(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* @EXIT_SUCCESS
%5 = call i32 @exit(i32 %4)
unreachable
}

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
@str = [24 x i8] c"SIGINT signal received!\00"
define void @handle(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
%3 = load i32, i32* @EXIT_SUCCESS
%4 = tail call i32 @exit(i32 %3)
unreachable
}
/* Variables and functions */
scalar_t__ EXIT_FAILURE;
int EXIT_SUCCESS;
scalar_t__ init(int, char **);
int /*<<< orphan*/ serverLoop();
int /*<<< orphan*/ stopServer();
int main(int argc, char **args) {
  if (init(argc, args) == EXIT_FAILURE)
    return EXIT_FAILURE;
  serverLoop();
  stopServer();
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1050 <init@plt>
mov    0x2e87(%rip),%rcx
cmp    (%rcx),%rax
jne    1174 <main+0x44>
mov    0x2e77(%rip),%rax
mov    (%rax),%rax
mov    %eax,-0x4(%rbp)
jmp    118e <main+0x5e>
mov    $0x0,%al
call   1040 <serverLoop@plt>
mov    $0x0,%al
call   1030 <stopServer@plt>
mov    0x2e4f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
call   1050 <init@plt>
mov    0x2ea3(%rip),%rcx
cmp    (%rcx),%rax
je     1159 <main+0x29>
xor    %eax,%eax
call   1040 <serverLoop@plt>
xor    %eax,%eax
call   1030 <stopServer@plt>
mov    0x2e81(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret

LLVM IR (-O0):
@EXIT_FAILURE = global i64 0
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = load i8**, i8*** %5
%8 = call i64 @init(i32 %6, i8** %7)
%9 = load i64, i64* @EXIT_FAILURE
%10 = icmp eq i64 %8, %9
br i1 %10, label %11, label %14
11: ; preds = %2
%12 = load i64, i64* @EXIT_FAILURE
%13 = trunc i64 %12 to i32
store i32 %13, i32* %3
br label %18
14: ; preds = %2
%15 = call i32 (...) @serverLoop()
%16 = call i32 (...) @stopServer()
%17 = load i32, i32* @EXIT_SUCCESS
store i32 %17, i32* %3
br label %18
18: ; preds = %14, %11
%19 = load i32, i32* %3
ret i32 %19
}

LLVM IR (-O2):
@EXIT_FAILURE = global i64 0
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i64 @init(i32 %0, i8** %1)
%4 = load i64, i64* @EXIT_FAILURE
%5 = icmp eq i64 %3, %4
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = trunc i64 %3 to i32
br label %12
8: ; preds = %2
%9 = tail call i32 (...) @serverLoop()
%10 = tail call i32 (...) @stopServer()
%11 = load i32, i32* @EXIT_SUCCESS
br label %12
12: ; preds = %8, %6
%13 = phi i32 [ %7, %6 ], [ %11, %8 ]
ret i32 %13
}
/* Variables and functions */
int /*<<< orphan*/ eFree(char *);
char *popString();
int /*<<< orphan*/ pushStringCopy(char *);
char *reverse(char *);
void basReverse() {
  char *string;
  char *dest;
  string = popString();
  dest = reverse(string);
  pushStringCopy(dest);
  eFree(string);
  eFree(dest);
}


x86 assembly (clang, -O0):
<basReverse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1050 <popString@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <reverse@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1060 <pushStringCopy@plt>
mov    -0x8(%rbp),%rdi
call   1040 <eFree@plt>
mov    -0x10(%rbp),%rdi
call   1040 <eFree@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<basReverse>:
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1050 <popString@plt>
mov    %rax,%r14
mov    %rax,%rdi
call   1030 <reverse@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1060 <pushStringCopy@plt>
mov    %r14,%rdi
call   1040 <eFree@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <eFree@plt>

LLVM IR (-O0):
define void @basReverse() {
%1 = alloca i8*
%2 = alloca i8*
%3 = call i8* (...) @popString()
store i8* %3, i8** %1
%4 = load i8*, i8** %1
%5 = call i8* @reverse(i8* %4)
store i8* %5, i8** %2
%6 = load i8*, i8** %2
%7 = call i32 @pushStringCopy(i8* %6)
%8 = load i8*, i8** %1
%9 = call i32 @eFree(i8* %8)
%10 = load i8*, i8** %2
%11 = call i32 @eFree(i8* %10)
ret void
}

LLVM IR (-O2):
define void @basReverse() {
%1 = tail call i8* (...) @popString()
%2 = tail call i8* @reverse(i8* %1)
%3 = tail call i32 @pushStringCopy(i8* %2)
%4 = tail call i32 @eFree(i8* %1)
%5 = tail call i32 @eFree(i8* %2)
ret void
}
char _get_hex_char(unsigned char v, unsigned char caps) {
  if (v < 10)
    return (char)(v + 48);
  else {
    if (caps)
      return (char)(v + 55);
    else
      return (char)(v + 87);
  }
}


x86 assembly (clang, -O0):
<_get_hex_char>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x2(%rbp)
mov    %al,-0x3(%rbp)
movzbl -0x2(%rbp),%eax
cmp    $0xa,%eax
jge    112c <_get_hex_char+0x2c>
movzbl -0x2(%rbp),%eax
add    $0x30,%eax
mov    %al,-0x1(%rbp)
jmp    114f <_get_hex_char+0x4f>
cmpb   $0x0,-0x3(%rbp)
je     1145 <_get_hex_char+0x45>
movzbl -0x2(%rbp),%eax
add    $0x37,%eax
mov    %al,-0x1(%rbp)
jmp    114f <_get_hex_char+0x4f>
movzbl -0x2(%rbp),%eax
add    $0x57,%eax
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_get_hex_char>:
test   %esi,%esi
sete   %al
shl    $0x5,%al
add    $0x37,%al
cmp    $0xa,%dil
movzbl %al,%ecx
mov    $0x30,%eax
cmovae %ecx,%eax
add    %dil,%al
ret

LLVM IR (-O0):
define signext i8 @_get_hex_char(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
%5 = alloca i8
store i8 %0, i8* %4
store i8 %1, i8* %5
%6 = load i8, i8* %4
%7 = zext i8 %6 to i32
%8 = icmp slt i32 %7, 10
br i1 %8, label %9, label %14
9: ; preds = %2
%10 = load i8, i8* %4
%11 = zext i8 %10 to i32
%12 = add nsw i32 %11, 48
%13 = trunc i32 %12 to i8
store i8 %13, i8* %3
br label %27
14: ; preds = %2
%15 = load i8, i8* %5
%16 = icmp ne i8 %15, 0
br i1 %16, label %17, label %22
17: ; preds = %14
%18 = load i8, i8* %4
%19 = zext i8 %18 to i32
%20 = add nsw i32 %19, 55
%21 = trunc i32 %20 to i8
store i8 %21, i8* %3
br label %27
22: ; preds = %14
%23 = load i8, i8* %4
%24 = zext i8 %23 to i32
%25 = add nsw i32 %24, 87
%26 = trunc i32 %25 to i8
store i8 %26, i8* %3
br label %27
27: ; preds = %22, %17, %9
%28 = load i8, i8* %3
ret i8 %28
}

LLVM IR (-O2):
define signext i8 @_get_hex_char(i8 zeroext %0, i8 zeroext %1) {
%3 = icmp ult i8 %0, 10
%4 = icmp eq i8 %1, 0
%5 = select i1 %4, i8 87, i8 55
%6 = select i1 %3, i8 48, i8 %5
%7 = add i8 %6, %0
ret i8 %7
}
int deny_mac(const char *mac) { return 1; }


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

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

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

LLVM IR (-O2):
define i32 @deny_mac(i8* nocapture readnone %0) {
ret i32 1
}
/* Variables and functions */
char *strdup(char const *);
scalar_t__ strlen(char const *);
char *db_sql_strdup(const char *what) {
  return what ? (strlen(what) ? strdup(what) : NULL) : NULL;
}


x86 assembly (clang, -O0):
<db_sql_strdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1174 <db_sql_strdup+0x54>
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x0,%rax
je     115c <db_sql_strdup+0x3c>
mov    -0x8(%rbp),%rdi
call   1040 <strdup@plt>
mov    %rax,-0x10(%rbp)
jmp    1167 <db_sql_strdup+0x47>
xor    %eax,%eax
mov    %rax,-0x10(%rbp)
jmp    1167 <db_sql_strdup+0x47>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    117f <db_sql_strdup+0x5f>
xor    %eax,%eax
mov    %rax,-0x18(%rbp)
jmp    117f <db_sql_strdup+0x5f>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<db_sql_strdup>:
test   %rdi,%rdi
je     111f <db_sql_strdup+0xf>
cmpb   $0x0,(%rdi)
je     111f <db_sql_strdup+0xf>
jmp    1030 <strdup@plt>
xor    %eax,%eax
ret

LLVM IR (-O0):
define i8* @db_sql_strdup(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 %15
5: ; preds = %1
%6 = load i8*, i8** %2
%7 = call i64 @strlen(i8* %6)
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %5
%10 = load i8*, i8** %2
%11 = call i8* @strdup(i8* %10)
br label %13
12: ; preds = %5
br label %13
13: ; preds = %12, %9
%14 = phi i8* [ %11, %9 ], [ null, %12 ]
br label %16
15: ; preds = %1
br label %16
16: ; preds = %15, %13
%17 = phi i8* [ %14, %13 ], [ null, %15 ]
ret i8* %17
}

LLVM IR (-O2):
define noalias i8* @db_sql_strdup(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %8, label %3
3: ; preds = %1
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %3
%7 = tail call i8* @strdup(i8* %0)
br label %8
8: ; preds = %1, %6, %3
%9 = phi i8* [ %7, %6 ], [ null, %3 ], [ null, %1 ]
ret i8* %9
}
/* Variables and functions */
int /*<<< orphan*/ SOCK_DGRAM;
int serversock(int /*<<< orphan*/, int, int /*<<< orphan*/);
int serverUDPsock(int portN) { return serversock(SOCK_DGRAM, portN, 0); }


x86 assembly (clang, -O0):
<serverUDPsock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2ec6(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%esi
xor    %edx,%edx
call   1030 <serversock@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<serverUDPsock>:
mov    %edi,%esi
mov    0x2ecf(%rip),%rax
mov    (%rax),%edi
xor    %edx,%edx
jmp    1030 <serversock@plt>

LLVM IR (-O0):
@SOCK_DGRAM = global i32 0
define i32 @serverUDPsock(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* @SOCK_DGRAM
%4 = load i32, i32* %2
%5 = call i32 @serversock(i32 %3, i32 %4, i32 0)
ret i32 %5
}

LLVM IR (-O2):
@SOCK_DGRAM = global i32 0
define i32 @serverUDPsock(i32 %0) {
%2 = load i32, i32* @SOCK_DGRAM
%3 = tail call i32 @serversock(i32 %2, i32 %0, i32 0)
ret i32 %3
}
/* Variables and functions */
void const *GppcFinfoV1();
const void *pg_finfo_numericfunc2(void) { return GppcFinfoV1(); }


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

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

LLVM IR (-O0):
define i8* @pg_finfo_numericfunc2() {
%1 = call i8* (...) @GppcFinfoV1()
ret i8* %1
}

LLVM IR (-O2):
define i8* @pg_finfo_numericfunc2() {
%1 = tail call i8* (...) @GppcFinfoV1()
ret i8* %1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void print_checkpoint_now() { printf("Please checkpoint now.\n"); }


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

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

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

LLVM IR (-O2):
@str = [23 x i8] c"Please checkpoint now.\00"
define void @print_checkpoint_now() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
ret void
}
int test_imm_0Euint8_reg(unsigned char val) {
  return ((val) & (0x0E << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_0Euint8_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%edx
and    $0xe,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @test_imm_0Euint8_reg(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = and i32 %4, 14
%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_0Euint8_reg(i8 zeroext %0) {
%2 = and i8 %0, 14
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  printf("is not 1\n");
  return 0;
}


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

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

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

LLVM IR (-O2):
@str = [9 x i8] c"is not 1\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
double log(int);
double log10(double n) { return log(n) / log(10); }


x86 assembly (clang, -O0):
<log10>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
cvttsd2si -0x8(%rbp),%edi
call   1030 <log@plt>
movsd  %xmm0,-0x10(%rbp)
mov    $0xa,%edi
call   1030 <log@plt>
movaps %xmm0,%xmm1
movsd  -0x10(%rbp),%xmm0
divsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<log10>:
push   %rax
cvttsd2si %xmm0,%edi
call   1030 <log@plt>
movsd  %xmm0,(%rsp)
mov    $0xa,%edi
call   1030 <log@plt>
movsd  (%rsp),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @log10(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fptosi double %3 to i32
%5 = call double @log(i32 %4)
%6 = call double @log(i32 10)
%7 = fdiv double %5, %6
ret double %7
}

LLVM IR (-O2):
define double @log10(double %0) {
%2 = fptosi double %0 to i32
%3 = tail call double @log(i32 %2)
%4 = tail call double @log(i32 10)
%5 = fdiv double %3, %4
ret double %5
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
void foo(unsigned x) {
  unsigned x1 = ~x;
  unsigned x2 = -x - 1;
  assert(x1 == x2);
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
xor    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
xor    %eax,%eax
sub    -0x4(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
mov    $0x1,%edi
jmp    1030 <assert@plt>

LLVM IR (-O0):
define void @foo(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = xor i32 %5, -1
store i32 %6, i32* %3
%7 = load i32, i32* %2
%8 = sub i32 0, %7
%9 = sub i32 %8, 1
store i32 %9, i32* %4
%10 = load i32, i32* %3
%11 = load i32, i32* %4
%12 = icmp eq i32 %10, %11
%13 = zext i1 %12 to i32
%14 = call i32 @assert(i32 %13)
ret void
}

LLVM IR (-O2):
define void @foo(i32 %0) {
%2 = tail call i32 @assert(i32 1)
ret void
}
int is_leap_year(int year) {
  return (year % 400 == 0) || ((year % 4 == 0) && (year % 100 != 0));
}


x86 assembly (clang, -O0):
<is_leap_year>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x190,%ecx
cltd
idiv   %ecx
mov    $0x1,%al
cmp    $0x0,%edx
mov    %al,-0x5(%rbp)
je     1153 <is_leap_year+0x53>
mov    -0x4(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
xor    %eax,%eax
cmp    $0x0,%edx
mov    %al,-0x6(%rbp)
jne    114d <is_leap_year+0x4d>
mov    -0x4(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
setne  %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_leap_year>:
imul   $0xc28f5c29,%edi,%ecx
add    $0x51eb850,%ecx
mov    %ecx,%eax
ror    $0x4,%eax
cmp    $0xa3d70b,%eax
jb     1121 <is_leap_year+0x21>
xor    %eax,%eax
test   $0x3,%dil
je     1127 <is_leap_year+0x27>
ret
mov    $0x1,%eax
ret
ror    $0x2,%ecx
xor    %eax,%eax
cmp    $0x28f5c29,%ecx
setae  %al
ret

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

LLVM IR (-O2):
define i32 @is_leap_year(i32 %0) {
%2 = srem i32 %0, 400
%3 = icmp eq i32 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %1
%5 = and i32 %0, 3
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %11
7: ; preds = %4
%8 = srem i32 %0, 100
%9 = icmp ne i32 %8, 0
%10 = zext i1 %9 to i32
br label %11
11: ; preds = %4, %7, %1
%12 = phi i32 [ 1, %1 ], [ 0, %4 ], [ %10, %7 ]
ret i32 %12
}
/* Type definitions */
typedef int /*<<< orphan*/ wchar_t;

/* Variables and functions */
int /*<<< orphan*/ *malloc(size_t);
int wcsnlen(int /*<<< orphan*/ const *, size_t);
int /*<<< orphan*/ *wmemcpy(int /*<<< orphan*/ *, int /*<<< orphan*/ const *,
                            size_t);
wchar_t *wcsndup(const wchar_t *string, size_t maxlen) {
  size_t n = wcsnlen(string, maxlen) + 1;
  wchar_t *r = malloc(n * sizeof(wchar_t));
  return r == NULL ? NULL : wmemcpy(r, string, n);
}


x86 assembly (clang, -O0):
<wcsndup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <wcsnlen@plt>
add    $0x1,%eax
cltq
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
shl    $0x2,%rdi
call   1040 <malloc@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    117d <wcsndup+0x4d>
xor    %eax,%eax
mov    %rax,-0x28(%rbp)
jmp    1192 <wcsndup+0x62>
mov    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <wmemcpy@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wcsndup>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1050 <wcsnlen@plt>
movslq %eax,%rbx
lea    0x4(,%rbx,4),%rdi
call   1040 <malloc@plt>
test   %rax,%rax
je     116a <wcsndup+0x3a>
add    $0x1,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <wmemcpy@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32* @wcsndup(i32* %0, i64 %1) {
%3 = alloca i32*
%4 = alloca i64
%5 = alloca i64
%6 = alloca i32*
store i32* %0, i32** %3
store i64 %1, i64* %4
%7 = load i32*, i32** %3
%8 = load i64, i64* %4
%9 = call i32 @wcsnlen(i32* %7, i64 %8)
%10 = add nsw i32 %9, 1
%11 = sext i32 %10 to i64
store i64 %11, i64* %5
%12 = load i64, i64* %5
%13 = mul i64 %12, 4
%14 = call i32* @malloc(i64 %13)
store i32* %14, i32** %6
%15 = load i32*, i32** %6
%16 = icmp eq i32* %15, null
br i1 %16, label %17, label %18
17: ; preds = %2
br label %23
18: ; preds = %2
%19 = load i32*, i32** %6
%20 = load i32*, i32** %3
%21 = load i64, i64* %5
%22 = call i32* @wmemcpy(i32* %19, i32* %20, i64 %21)
br label %23
23: ; preds = %18, %17
%24 = phi i32* [ null, %17 ], [ %22, %18 ]
ret i32* %24
}

LLVM IR (-O2):
define i32* @wcsndup(i32* %0, i64 %1) {
%3 = tail call i32 @wcsnlen(i32* %0, i64 %1)
%4 = add nsw i32 %3, 1
%5 = sext i32 %4 to i64
%6 = shl nsw i64 %5, 2
%7 = tail call i32* @malloc(i64 %6)
%8 = icmp eq i32* %7, null
br i1 %8, label %11, label %9
9: ; preds = %2
%10 = tail call i32* @wmemcpy(i32* %7, i32* %0, i64 %5)
br label %11
11: ; preds = %2, %9
%12 = phi i32* [ %10, %9 ], [ null, %2 ]
ret i32* %12
}
int create_bumpdrop() {}


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

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

LLVM IR (-O0):
define i32 @create_bumpdrop() {
%1 = alloca i32
%2 = load i32, i32* %1
ret i32 %2
}

LLVM IR (-O2):
define i32 @create_bumpdrop() {
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ helper_double_6_recursive(double *, int);
void helper_double_6(double *buf) { helper_double_6_recursive(buf, 6); }


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

x86 assembly (clang, -O2):
<helper_double_6>:
mov    $0x6,%esi
jmp    1030 <helper_double_6_recursive@plt>

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

LLVM IR (-O2):
define void @helper_double_6(double* %0) {
%2 = tail call i32 @helper_double_6_recursive(double* %0, i32 6)
ret void
}
/* Variables and functions */
int strcmp(char *, char *);
int string_comparator_wrapper(const void *a, const void *b) {
  return strcmp((char *)a, (char *)b);
}


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

x86 assembly (clang, -O2):
<string_comparator_wrapper>:
jmp    1030 <strcmp@plt>

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

LLVM IR (-O2):
define i32 @string_comparator_wrapper(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
ret i32 %3
}
void SetRemoteShell(const char *const shell) {}


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

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

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

LLVM IR (-O2):
define void @SetRemoteShell(i8* nocapture %0) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;

/* Variables and functions */
int /*<<< orphan*/ localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ strftime(char *, int, char *, int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int do_date() {
  char datetime[512];
  time_t t = time(NULL);
  strftime(datetime, 512, "%d.%m.%Y %T", localtime(&t));
  printf("%s\n", datetime);
  return 0;
}


x86 assembly (clang, -O0):
<do_date>:
push   %rbp
mov    %rsp,%rbp
sub    $0x210,%rsp
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,-0x204(%rbp)
lea    -0x200(%rbp),%rax
mov    %rax,-0x210(%rbp)
lea    -0x204(%rbp),%rdi
call   1030 <localtime@plt>
mov    -0x210(%rbp),%rdi
mov    %eax,%ecx
mov    $0x200,%esi
lea    0xe77(%rip),%rdx
call   1060 <strftime@plt>
lea    -0x200(%rbp),%rsi
lea    0xe70(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x210,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_date>:
push   %rbx
sub    $0x210,%rsp
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,0xc(%rsp)
lea    0xc(%rsp),%rdi
call   1030 <localtime@plt>
lea    0xe9c(%rip),%rdx
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x200,%esi
mov    %eax,%ecx
call   1060 <strftime@plt>
lea    0xe8d(%rip),%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x210,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [12 x i8] c"%d.%m.%Y %T\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @do_date() {
%1 = alloca [512 x i8]
%2 = alloca i32
%3 = call i32 @time(i32* null)
store i32 %3, i32* %2
%4 = getelementptr inbounds [512 x i8], [512 x i8]* %1, i64 0, i64 0
%5 = call i32 @localtime(i32* %2)
%6 = call i32 @strftime(i8* %4, i32 512, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = getelementptr inbounds [512 x i8], [512 x i8]* %1, i64 0, i64 0
%8 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %7)
ret i32 0
}

LLVM IR (-O2):
@.str = [12 x i8] c"%d.%m.%Y %T\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @do_date() {
%1 = alloca [512 x i8]
%2 = alloca i32
%3 = getelementptr inbounds [512 x i8], [512 x i8]* %1, i64 0, i64 0
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 @time(i32* null)
store i32 %5, i32* %2
%6 = call i32 @localtime(i32* %2)
%7 = call i32 @strftime(i8* %3, i32 512, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %3)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ flag;

/* Variables and functions */
int /*<<< orphan*/ IPPROTO_TCP;
int /*<<< orphan*/ TCP_NODELAY;
int setsockopt(int, int /*<<< orphan*/, int /*<<< orphan*/, char *, int);
int fnet_set_nodely(int fd) {
  int flag = 1;
  return setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, (char *)&flag, sizeof(flag));
}


x86 assembly (clang, -O0):
<fnet_set_nodely>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2eb4(%rip),%rax
mov    (%rax),%esi
mov    0x2eb3(%rip),%rax
mov    (%rax),%edx
lea    -0x8(%rbp),%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fnet_set_nodely>:
push   %rax
movl   $0x1,0x4(%rsp)
mov    0x2ec0(%rip),%rax
mov    (%rax),%esi
mov    0x2ebf(%rip),%rax
mov    (%rax),%edx
lea    0x4(%rsp),%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
pop    %rcx
ret

LLVM IR (-O0):
@IPPROTO_TCP = global i32 0
@TCP_NODELAY = global i32 0
define i32 @fnet_set_nodely(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 1, i32* %3
%4 = load i32, i32* %2
%5 = load i32, i32* @IPPROTO_TCP
%6 = load i32, i32* @TCP_NODELAY
%7 = bitcast i32* %3 to i8*
%8 = call i32 @setsockopt(i32 %4, i32 %5, i32 %6, i8* %7, i32 4)
ret i32 %8
}

LLVM IR (-O2):
@IPPROTO_TCP = global i32 0
@TCP_NODELAY = global i32 0
define i32 @fnet_set_nodely(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
store i32 1, i32* %2
%4 = load i32, i32* @IPPROTO_TCP
%5 = load i32, i32* @TCP_NODELAY
%6 = call i32 @setsockopt(i32 %0, i32 %4, i32 %5, i8* %3, i32 4)
ret i32 %6
}
void scdF(char *x) { signed char *y = x; }


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

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

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

LLVM IR (-O2):
define void @scdF(i8* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ vertex(char, float, float);
void line_to(float x, float y) { vertex('L', x, y); }


x86 assembly (clang, -O0):
<line_to>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
mov    $0x4c,%edi
call   1030 <vertex@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<line_to>:
mov    $0x4c,%edi
jmp    1030 <vertex@plt>

LLVM IR (-O0):
define void @line_to(float %0, float %1) {
%3 = alloca float
%4 = alloca float
store float %0, float* %3
store float %1, float* %4
%5 = load float, float* %3
%6 = load float, float* %4
%7 = call i32 @vertex(i8 signext 76, float %5, float %6)
ret void
}

LLVM IR (-O2):
define void @line_to(float %0, float %1) {
%3 = tail call i32 @vertex(i8 signext 76, float %0, float %1)
ret void
}
int main() {
  int i = 2;
  int sum = 0;
  switch (i) {
  case 2:
    sum += 3;
  default:
    sum += 4;
  }
  return sum;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x2,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%eax
sub    $0x2,%eax
jne    1133 <main+0x33>
jmp    112a <main+0x2a>
mov    -0xc(%rbp),%eax
add    $0x3,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x4,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 2, i32* %2
store i32 0, i32* %3
%4 = load i32, i32* %2
switch i32 %4, label %8 [
i32 2, label %5
]
5: ; preds = %0
%6 = load i32, i32* %3
%7 = add nsw i32 %6, 3
store i32 %7, i32* %3
br label %8
8: ; preds = %0, %5
%9 = load i32, i32* %3
%10 = add nsw i32 %9, 4
store i32 %10, i32* %3
br label %11
11: ; preds = %8
%12 = load i32, i32* %3
ret i32 %12
}

LLVM IR (-O2):
define i32 @main() {
ret i32 7
}
/* Variables and functions */
int /*<<< orphan*/ EEPROM_DriverIRQHandler();
__attribute__((weak)) void EEPROM_IRQHandler(void) {
  EEPROM_DriverIRQHandler();
}


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

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

LLVM IR (-O0):
define weak void @EEPROM_IRQHandler() {
%1 = call i32 (...) @EEPROM_DriverIRQHandler()
ret void
}

LLVM IR (-O2):
define weak void @EEPROM_IRQHandler() {
%1 = tail call i32 (...) @EEPROM_DriverIRQHandler()
ret void
}
void rop3_162_0_0(unsigned char *D, unsigned char S, unsigned char T) {
  unsigned char stk1;
  unsigned char stk2;
  unsigned char stk3;
  stk3 = ~S;
  stk2 = T | stk3;
  stk1 = *D & stk2;
  *D = stk1;
}


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

x86 assembly (clang, -O2):
<rop3_162_0_0>:
not    %sil
or     %dl,%sil
and    %sil,(%rdi)
ret

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

LLVM IR (-O2):
define void @rop3_162_0_0(i8* nocapture %0, i8 zeroext %1, i8 zeroext %2) {
%4 = xor i8 %1, -1
%5 = or i8 %4, %2
%6 = load i8, i8* %0
%7 = and i8 %6, %5
store i8 %7, i8* %0
ret void
}
/* Variables and functions */
int modredcul_initmod_ul(unsigned long *, unsigned long);
int main(void) {
  unsigned long m;
  unsigned long pp = 10003800361UL;
  int re = modredcul_initmod_ul(&m, pp);
  return re;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movabs $0x25445e129,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    -0x10(%rbp),%rdi
call   1030 <modredcul_initmod_ul@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    %rsp,%rdi
movabs $0x25445e129,%rsi
call   1030 <modredcul_initmod_ul@plt>
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = alloca i64
%2 = bitcast i64* %1 to i8*
%3 = call i32 @modredcul_initmod_ul(i64* %1, i64 10003800361)
ret i32 %3
}